Compare commits
No commits in common. "b7f9b2d830066a0902e1c7f7719396a62a50e6da" and "62a4476fc37393d6c59caa38380260de7f5bebb2" have entirely different histories.
b7f9b2d830
...
62a4476fc3
26 changed files with 121 additions and 154 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -5,6 +5,3 @@ zenith.db
|
||||||
zenith.log
|
zenith.log
|
||||||
zenith.db-shm
|
zenith.db-shm
|
||||||
zenith.db-wal
|
zenith.db-wal
|
||||||
installer/*.tar.gz
|
|
||||||
installer/*.tar.gz.prev
|
|
||||||
docker_files/zenith-docker_*
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Upgraded to GHC 9.6.5
|
- Upgraded to GHC 9.6.5
|
||||||
- Implemented config and data folder
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ processUri user pwd =
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
config <- load ["$(HOME)/Zenith/zenith.cfg"]
|
config <- load [ "$(HOME)/Zenith/zenith.cfg" ]
|
||||||
args <- getArgs
|
args <- getArgs
|
||||||
dbFileName <- require config "dbFileName"
|
dbFileName <- require config "dbFileName"
|
||||||
{-nodeUser <- require config "nodeUser"-}
|
{-nodeUser <- require config "nodeUser"-}
|
||||||
|
|
|
@ -28,9 +28,9 @@ RUN echo "1234\n1234\n" | passwd zenusr
|
||||||
|
|
||||||
RUN mkdir /home/zenusr/Zenith
|
RUN mkdir /home/zenusr/Zenith
|
||||||
RUN chown zenusr:zenusr -R /home/zenusr/Zenith
|
RUN chown zenusr:zenusr -R /home/zenusr/Zenith
|
||||||
#RUN mkdir /home/zenusr/Zenith/assets
|
RUN mkdir /home/zenusr/assets
|
||||||
#COPY assets/* /home/zenusr/Zenith/assets/
|
COPY assets/* /home/zenusr/assets/
|
||||||
#RUN chown zenusr:zenusr -R /home/zenusr/Zenith/assets
|
RUN chown zenusr:zenusr -R /home/zenusr/assets
|
||||||
|
|
||||||
COPY scripts/bash_rc_adm /root/.bashrc
|
COPY scripts/bash_rc_adm /root/.bashrc
|
||||||
COPY scripts/bash_rc_usr /home/zenusr/.bashrc
|
COPY scripts/bash_rc_usr /home/zenusr/.bashrc
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#/bin/bash
|
||||||
ZVERSION="0.6.0.0"
|
ZVERSION="0.6.0.0"
|
||||||
echo
|
echo
|
||||||
echo "Zenith Full Node Docker Image Setup"
|
echo "Zenith Full Node Docker Image Setup"
|
||||||
|
@ -27,10 +27,8 @@ if systemctl is-active --quiet docker; then
|
||||||
docker load < zenith-docker_$ZVERSION.tar
|
docker load < zenith-docker_$ZVERSION.tar
|
||||||
echo "... docker image zenith-docker:"$ZVERSION" loaded."
|
echo "... docker image zenith-docker:"$ZVERSION" loaded."
|
||||||
echo "... creating Zenith folder"
|
echo "... creating Zenith folder"
|
||||||
mkdir -p $HOME/Zenith/assets
|
mkdir $HOME/Zenith
|
||||||
echo "... creating default configuration"
|
|
||||||
cp cfg/zenith.cfg $HOME/Zenith/
|
cp cfg/zenith.cfg $HOME/Zenith/
|
||||||
cp -r /assets/ $HOME/Zenith/assets
|
|
||||||
if ! [ -d $HOME/.local/bin ]; then
|
if ! [ -d $HOME/.local/bin ]; then
|
||||||
echo "... creating $HOME/.local/bin folder"
|
echo "... creating $HOME/.local/bin folder"
|
||||||
mkdir -p $HOME/.local/bin
|
mkdir -p $HOME/.local/bin
|
||||||
|
@ -40,10 +38,10 @@ if systemctl is-active --quiet docker; then
|
||||||
if [ -f $HOME/.local/bin/runzenith ]; then
|
if [ -f $HOME/.local/bin/runzenith ]; then
|
||||||
rm $HOME/.local/bin/runzenith
|
rm $HOME/.local/bin/runzenith
|
||||||
fi
|
fi
|
||||||
echo "... copying runzenith to $HOME/.local/bin"
|
echo "... copying runzenith to $HOME/.local/bin "
|
||||||
cp cfg/runzenith $HOME/.local/bin/
|
cp cfg/runzenith $HOME/.local/bin/
|
||||||
if echo $PATH | grep -q $HOME/.local/bin ; then
|
if echo $PATH | grep -q $HOME/.local/bin ; then
|
||||||
echo PATH=$PATH:$HOME/.local/bin | tee -a $HOME/.bashrc
|
echo PATH=$PATH:$HOME/.local/bin' | tee -a $HOME/.bashrc
|
||||||
echo "Reloading configuration ...."
|
echo "Reloading configuration ...."
|
||||||
source $HOME/.bashrc
|
source $HOME/.bashrc
|
||||||
fi
|
fi
|
||||||
|
|
Binary file not shown.
BIN
installer/zenith-0.6.0.0-amd64/bin/1F616_color.png
Normal file
BIN
installer/zenith-0.6.0.0-amd64/bin/1F616_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
installer/zenith-0.6.0.0-amd64/bin/1F928_color.png
Normal file
BIN
installer/zenith-0.6.0.0-amd64/bin/1F928_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
installer/zenith-0.6.0.0-amd64/bin/1F993.png
Normal file
BIN
installer/zenith-0.6.0.0-amd64/bin/1F993.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
installer/zenith-0.6.0.0-amd64/bin/2620_color.png
Normal file
BIN
installer/zenith-0.6.0.0-amd64/bin/2620_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
installer/zenith-0.6.0.0-amd64/bin/DejaVuSansMono-Bold.ttf
Normal file
BIN
installer/zenith-0.6.0.0-amd64/bin/DejaVuSansMono-Bold.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
installer/zenith-0.6.0.0-amd64/bin/DejaVuSansMono-Oblique.ttf
Normal file
BIN
installer/zenith-0.6.0.0-amd64/bin/DejaVuSansMono-Oblique.ttf
Normal file
Binary file not shown.
BIN
installer/zenith-0.6.0.0-amd64/bin/DejaVuSansMono.ttf
Normal file
BIN
installer/zenith-0.6.0.0-amd64/bin/DejaVuSansMono.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
installer/zenith-0.6.0.0-amd64/bin/Roboto-Regular.ttf
Normal file
BIN
installer/zenith-0.6.0.0-amd64/bin/Roboto-Regular.ttf
Normal file
Binary file not shown.
BIN
installer/zenith-0.6.0.0-amd64/bin/remixicon.ttf
Normal file
BIN
installer/zenith-0.6.0.0-amd64/bin/remixicon.ttf
Normal file
Binary file not shown.
Binary file not shown.
|
@ -15,11 +15,12 @@ else
|
||||||
mkdir -p $HOME/Zenith
|
mkdir -p $HOME/Zenith
|
||||||
echo "Copying default configuration ...."
|
echo "Copying default configuration ...."
|
||||||
cp ./cfg/zenith.cfg $HOME/Zenith/
|
cp ./cfg/zenith.cfg $HOME/Zenith/
|
||||||
echo "Creating assets folder ...."
|
|
||||||
mkdir -p $HOME/Zenith/assets
|
|
||||||
echo "Transfering assets to new folder ...."
|
|
||||||
cp ./assets/* $HOME/Zenith/assets
|
|
||||||
chown -R $USER $HOME/Zenith
|
chown -R $USER $HOME/Zenith
|
||||||
|
echo "Creating assets folder ...."
|
||||||
|
mkdir -p $HOME/assets
|
||||||
|
echo "Transfering assets to new folder ...."
|
||||||
|
cp ./assets/* $HOME/assets
|
||||||
|
chown -R $USER $HOME/assets
|
||||||
echo "Configuring library path ...."
|
echo "Configuring library path ...."
|
||||||
if [ ! grep -q "LD_LIBRARY_PATH" "$HOME/.bashrc" ]; then
|
if [ ! grep -q "LD_LIBRARY_PATH" "$HOME/.bashrc" ]; then
|
||||||
echo 'export LD_LIBRARY_PATH=/usr/local/lib' | tee -a $HOME/.bashrc
|
echo 'export LD_LIBRARY_PATH=/usr/local/lib' | tee -a $HOME/.bashrc
|
||||||
|
|
|
@ -25,8 +25,6 @@ import Lens.Micro ((&), (+~), (.~), (?~), (^.), set)
|
||||||
import Lens.Micro.TH
|
import Lens.Micro.TH
|
||||||
import Monomer
|
import Monomer
|
||||||
import qualified Monomer.Lens as L
|
import qualified Monomer.Lens as L
|
||||||
import System.Directory (getHomeDirectory)
|
|
||||||
import System.FilePath ((</>))
|
|
||||||
import System.Hclip
|
import System.Hclip
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
import Text.Wrap (FillScope(..), FillStrategy(..), WrapSettings(..), wrapText)
|
import Text.Wrap (FillScope(..), FillStrategy(..), WrapSettings(..), wrapText)
|
||||||
|
@ -143,7 +141,6 @@ data AppModel = AppModel
|
||||||
, _recipientValid :: !Bool
|
, _recipientValid :: !Bool
|
||||||
, _amountValid :: !Bool
|
, _amountValid :: !Bool
|
||||||
, _showId :: !(Maybe T.Text)
|
, _showId :: !(Maybe T.Text)
|
||||||
, _home :: !FilePath
|
|
||||||
} deriving (Eq, Show)
|
} deriving (Eq, Show)
|
||||||
|
|
||||||
makeLenses ''AppModel
|
makeLenses ''AppModel
|
||||||
|
@ -443,11 +440,7 @@ buildUI wenv model = widgetTree
|
||||||
(fromIntegral $ qrCodeWidth qr))
|
(fromIntegral $ qrCodeWidth qr))
|
||||||
[fitWidth]
|
[fitWidth]
|
||||||
Nothing ->
|
Nothing ->
|
||||||
image_
|
image_ "./assets/1F928_color.png" [fitEither]) `styleBasic`
|
||||||
(T.pack $
|
|
||||||
(model ^. home) </>
|
|
||||||
"Zenith/assets/1F928_color.png")
|
|
||||||
[fitEither]) `styleBasic`
|
|
||||||
[bgColor white, height 100, width 100]
|
[bgColor white, height 100, width 100]
|
||||||
, filler
|
, filler
|
||||||
] `styleBasic`
|
] `styleBasic`
|
||||||
|
@ -511,9 +504,7 @@ buildUI wenv model = widgetTree
|
||||||
, spacer
|
, spacer
|
||||||
, label (showt $ model ^. timer) `styleBasic` [padding 3, textSize 8]
|
, label (showt $ model ^. timer) `styleBasic` [padding 3, textSize 8]
|
||||||
, filler
|
, filler
|
||||||
, image_
|
, image_ "./assets/1F993.png" [fitHeight] `styleBasic`
|
||||||
(T.pack $ (model ^. home) </> "Zenith/assets/1F993.png")
|
|
||||||
[fitHeight] `styleBasic`
|
|
||||||
[height 24, width 24] `nodeVisible`
|
[height 24, width 24] `nodeVisible`
|
||||||
(model ^. zebraOn)
|
(model ^. zebraOn)
|
||||||
, label
|
, label
|
||||||
|
@ -1251,121 +1242,66 @@ txtWrap = wrapText (WrapSettings False True NoFill FillAfterFirst) 32
|
||||||
|
|
||||||
runZenithGUI :: Config -> IO ()
|
runZenithGUI :: Config -> IO ()
|
||||||
runZenithGUI config = do
|
runZenithGUI config = do
|
||||||
homeDir <- try getHomeDirectory :: IO (Either IOError FilePath)
|
let host = c_zebraHost config
|
||||||
case homeDir of
|
let port = c_zebraPort config
|
||||||
Left e -> print e
|
let dbFilePath = c_dbPath config
|
||||||
Right hD -> do
|
pool <- runNoLoggingT $ initPool dbFilePath
|
||||||
let host = c_zebraHost config
|
w <- try $ checkZebra host port :: IO (Either IOError ZebraGetInfo)
|
||||||
let port = c_zebraPort config
|
case w of
|
||||||
let dbFilePath = c_dbPath config
|
Right zebra -> do
|
||||||
pool <- runNoLoggingT $ initPool dbFilePath
|
bc <-
|
||||||
w <- try $ checkZebra host port :: IO (Either IOError ZebraGetInfo)
|
try $ checkBlockChain host port :: IO
|
||||||
case w of
|
(Either IOError ZebraGetBlockChainInfo)
|
||||||
Right zebra -> do
|
case bc of
|
||||||
bc <-
|
Left e1 -> throwIO e1
|
||||||
try $ checkBlockChain host port :: IO
|
Right chainInfo -> do
|
||||||
(Either IOError ZebraGetBlockChainInfo)
|
|
||||||
case bc of
|
|
||||||
Left e1 -> throwIO e1
|
|
||||||
Right chainInfo -> do
|
|
||||||
initDb dbFilePath
|
|
||||||
generateQRCodes config
|
|
||||||
walList <- getWallets pool $ zgb_net chainInfo
|
|
||||||
accList <-
|
|
||||||
if not (null walList)
|
|
||||||
then runNoLoggingT $
|
|
||||||
getAccounts pool $ entityKey $ head walList
|
|
||||||
else return []
|
|
||||||
addrList <-
|
|
||||||
if not (null accList)
|
|
||||||
then runNoLoggingT $
|
|
||||||
getAddresses pool $ entityKey $ head accList
|
|
||||||
else return []
|
|
||||||
txList <-
|
|
||||||
if not (null addrList)
|
|
||||||
then getUserTx pool $ entityKey $ head addrList
|
|
||||||
else return []
|
|
||||||
qr <-
|
|
||||||
if not (null addrList)
|
|
||||||
then getQrCode pool Orchard $ entityKey $ head addrList
|
|
||||||
else return Nothing
|
|
||||||
bal <-
|
|
||||||
if not (null accList)
|
|
||||||
then getBalance pool $ entityKey $ head accList
|
|
||||||
else return 0
|
|
||||||
unconfBal <-
|
|
||||||
if not (null accList)
|
|
||||||
then getUnconfirmedBalance pool $ entityKey $ head accList
|
|
||||||
else return 0
|
|
||||||
let model =
|
|
||||||
AppModel
|
|
||||||
config
|
|
||||||
(zgb_net chainInfo)
|
|
||||||
walList
|
|
||||||
0
|
|
||||||
accList
|
|
||||||
0
|
|
||||||
addrList
|
|
||||||
0
|
|
||||||
txList
|
|
||||||
0
|
|
||||||
Nothing
|
|
||||||
True
|
|
||||||
bal
|
|
||||||
(if unconfBal == 0
|
|
||||||
then Nothing
|
|
||||||
else Just unconfBal)
|
|
||||||
Orchard
|
|
||||||
qr
|
|
||||||
False
|
|
||||||
False
|
|
||||||
False
|
|
||||||
False
|
|
||||||
""
|
|
||||||
Nothing
|
|
||||||
""
|
|
||||||
""
|
|
||||||
(SaveAddress $
|
|
||||||
if not (null accList)
|
|
||||||
then Just (head accList)
|
|
||||||
else Nothing)
|
|
||||||
False
|
|
||||||
False
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
0
|
|
||||||
1.0
|
|
||||||
False
|
|
||||||
""
|
|
||||||
0.0
|
|
||||||
""
|
|
||||||
False
|
|
||||||
False
|
|
||||||
Nothing
|
|
||||||
hD
|
|
||||||
startApp model handleEvent buildUI (params hD)
|
|
||||||
Left e -> do
|
|
||||||
initDb dbFilePath
|
initDb dbFilePath
|
||||||
|
generateQRCodes config
|
||||||
|
walList <- getWallets pool $ zgb_net chainInfo
|
||||||
|
accList <-
|
||||||
|
if not (null walList)
|
||||||
|
then runNoLoggingT $ getAccounts pool $ entityKey $ head walList
|
||||||
|
else return []
|
||||||
|
addrList <-
|
||||||
|
if not (null accList)
|
||||||
|
then runNoLoggingT $ getAddresses pool $ entityKey $ head accList
|
||||||
|
else return []
|
||||||
|
txList <-
|
||||||
|
if not (null addrList)
|
||||||
|
then getUserTx pool $ entityKey $ head addrList
|
||||||
|
else return []
|
||||||
|
qr <-
|
||||||
|
if not (null addrList)
|
||||||
|
then getQrCode pool Orchard $ entityKey $ head addrList
|
||||||
|
else return Nothing
|
||||||
|
bal <-
|
||||||
|
if not (null accList)
|
||||||
|
then getBalance pool $ entityKey $ head accList
|
||||||
|
else return 0
|
||||||
|
unconfBal <-
|
||||||
|
if not (null accList)
|
||||||
|
then getUnconfirmedBalance pool $ entityKey $ head accList
|
||||||
|
else return 0
|
||||||
let model =
|
let model =
|
||||||
AppModel
|
AppModel
|
||||||
config
|
config
|
||||||
TestNet
|
(zgb_net chainInfo)
|
||||||
[]
|
walList
|
||||||
0
|
0
|
||||||
[]
|
accList
|
||||||
0
|
0
|
||||||
[]
|
addrList
|
||||||
0
|
0
|
||||||
[]
|
txList
|
||||||
0
|
0
|
||||||
(Just $
|
Nothing
|
||||||
"Couldn't connect to Zebra on " <>
|
True
|
||||||
host <> ":" <> showt port <> ". Check your configuration.")
|
bal
|
||||||
False
|
(if unconfBal == 0
|
||||||
314259000
|
then Nothing
|
||||||
(Just 30000)
|
else Just unconfBal)
|
||||||
Orchard
|
Orchard
|
||||||
Nothing
|
qr
|
||||||
False
|
False
|
||||||
False
|
False
|
||||||
False
|
False
|
||||||
|
@ -1374,7 +1310,10 @@ runZenithGUI config = do
|
||||||
Nothing
|
Nothing
|
||||||
""
|
""
|
||||||
""
|
""
|
||||||
(SaveAddress Nothing)
|
(SaveAddress $
|
||||||
|
if not (null accList)
|
||||||
|
then Just (head accList)
|
||||||
|
else Nothing)
|
||||||
False
|
False
|
||||||
False
|
False
|
||||||
Nothing
|
Nothing
|
||||||
|
@ -1388,26 +1327,61 @@ runZenithGUI config = do
|
||||||
False
|
False
|
||||||
False
|
False
|
||||||
Nothing
|
Nothing
|
||||||
hD
|
startApp model handleEvent buildUI params
|
||||||
startApp model handleEvent buildUI (params hD)
|
Left e -> do
|
||||||
|
initDb dbFilePath
|
||||||
|
let model =
|
||||||
|
AppModel
|
||||||
|
config
|
||||||
|
TestNet
|
||||||
|
[]
|
||||||
|
0
|
||||||
|
[]
|
||||||
|
0
|
||||||
|
[]
|
||||||
|
0
|
||||||
|
[]
|
||||||
|
0
|
||||||
|
(Just $
|
||||||
|
"Couldn't connect to Zebra on " <>
|
||||||
|
host <> ":" <> showt port <> ". Check your configuration.")
|
||||||
|
False
|
||||||
|
314259000
|
||||||
|
(Just 30000)
|
||||||
|
Orchard
|
||||||
|
Nothing
|
||||||
|
False
|
||||||
|
False
|
||||||
|
False
|
||||||
|
False
|
||||||
|
""
|
||||||
|
Nothing
|
||||||
|
""
|
||||||
|
""
|
||||||
|
(SaveAddress Nothing)
|
||||||
|
False
|
||||||
|
False
|
||||||
|
Nothing
|
||||||
|
Nothing
|
||||||
|
0
|
||||||
|
1.0
|
||||||
|
False
|
||||||
|
""
|
||||||
|
0.0
|
||||||
|
""
|
||||||
|
False
|
||||||
|
False
|
||||||
|
Nothing
|
||||||
|
startApp model handleEvent buildUI params
|
||||||
where
|
where
|
||||||
params hd =
|
params =
|
||||||
[ appWindowTitle "Zenith - Zcash Full Node Wallet"
|
[ appWindowTitle "Zenith - Zcash Full Node Wallet"
|
||||||
, appWindowState $ MainWindowNormal (1000, 700)
|
, appWindowState $ MainWindowNormal (1000, 700)
|
||||||
, appTheme zenithTheme
|
, appTheme zenithTheme
|
||||||
, appFontDef
|
, appFontDef "Regular" "./assets/Atkinson-Hyperlegible-Regular-102.ttf" --"./assets/DejaVuSansMono.ttf"
|
||||||
"Regular"
|
, appFontDef "Bold" "./assets/Atkinson-Hyperlegible-Bold-102.ttf"
|
||||||
(T.pack $
|
, appFontDef "Italic" "./assets/Atkinson-Hyperlegible-Italic-102.ttf"
|
||||||
hd </>
|
, appFontDef "Remix" "./assets/remixicon.ttf"
|
||||||
"Zenith/assets/Atkinson-Hyperlegible-Regular-102.ttf" --"./assets/DejaVuSansMono.ttf"
|
|
||||||
)
|
|
||||||
, appFontDef
|
|
||||||
"Bold"
|
|
||||||
(T.pack $ hd </> "Zenith/assets/Atkinson-Hyperlegible-Bold-102.ttf")
|
|
||||||
, appFontDef
|
|
||||||
"Italic"
|
|
||||||
(T.pack $ hd </> "Zenith/assets/Atkinson-Hyperlegible-Italic-102.ttf")
|
|
||||||
, appFontDef "Remix" (T.pack $ hd </> "Zenith/assets/remixicon.ttf")
|
|
||||||
, appDisableAutoScale True
|
, appDisableAutoScale True
|
||||||
, appScaleFactor 2.0
|
, appScaleFactor 2.0
|
||||||
, appInitEvent AppInit
|
, appInitEvent AppInit
|
||||||
|
|
|
@ -47,8 +47,6 @@ library
|
||||||
, brick
|
, brick
|
||||||
, bytestring
|
, bytestring
|
||||||
, data-default
|
, data-default
|
||||||
, directory
|
|
||||||
, filepath
|
|
||||||
, esqueleto
|
, esqueleto
|
||||||
, resource-pool
|
, resource-pool
|
||||||
, binary
|
, binary
|
||||||
|
|
Loading…
Reference in a new issue