This commit is contained in:
Rene Vergara 2023-02-08 14:32:13 -06:00
parent e6720e07e1
commit 4fd2d65ced
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2
5 changed files with 38 additions and 12 deletions

View file

@ -5,9 +5,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [0.3.4]
### [0.3.3] ### Added
- Display of node version on splash screen
- Display of Zenith version on splash screen
### Fixed
- Bug [#2](https://git.vergara.tech/Vergara_Tech/zenith/issues/2) when memos were left empty
- Extra `"` in transaction ID display
### Changed
- Display of transaction amounts now uses zats, microZEC (μZEC), miliZEC(mZEC) and ZEC as units for readability.
## [0.3.3]
### Changed ### Changed

View file

@ -158,11 +158,11 @@ parseId = return . readMaybe
displayTx :: ZcashTx -> IO () displayTx :: ZcashTx -> IO ()
displayTx t = do displayTx t = do
putStr "Tx ID: " putStr "Tx ID: "
print $ ztxid t putStrLn $ (T.unpack . ztxid) t
putStr "Block Time: " putStr "Block Time: "
print $ posixSecondsToUTCTime (fromInteger (zblocktime t)) print $ posixSecondsToUTCTime (fromInteger (zblocktime t))
putStr "Zats: " putStr "Amount: "
print $ zamountZat t putStrLn $ displayZec $ zamountZat t
putStr "Memo: " putStr "Memo: "
TIO.putStrLn $ zmemo t TIO.putStrLn $ zmemo t
putStrLn "-----" putStrLn "-----"
@ -202,6 +202,6 @@ main = do
"Zenith" "Zenith"
def def
{ getBanner = { getBanner =
" ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI" " ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.3.3"
} }
(root nodeUser nodePwd) (root nodeUser nodePwd)

View file

@ -1,5 +1,5 @@
name: zenith name: zenith
version: 0.3.3 version: 0.3.4
git: "https://git.vergara.tech/Vergara_Tech/zenith" git: "https://git.vergara.tech/Vergara_Tech/zenith"
license: BOSL license: BOSL
author: "Rene Vergara" author: "Rene Vergara"

View file

@ -182,6 +182,13 @@ instance FromJSON AddressGroup where
p <- v .: "receiver_types" p <- v .: "receiver_types"
return $ ZcashAddress MnemonicSeed p a addr return $ ZcashAddress MnemonicSeed p a addr
displayZec :: Integer -> String
displayZec s
| s < 100 = show s ++ " zats "
| s < 100000 = show (fromIntegral s / 100) ++ " μZEC "
| s < 100000000 = show (fromIntegral s / 100000) ++ " mZEC "
| otherwise = show (fromIntegral s / 100000000) ++ " ZEC "
-- | A type to model a Zcash transaction -- | A type to model a Zcash transaction
data ZcashTx = data ZcashTx =
ZcashTx ZcashTx
@ -313,7 +320,10 @@ encodeHexText t = mconcat (map padHex t)
else showHex (ord x) "" else showHex (ord x) ""
encodeHexText' :: T.Text -> String encodeHexText' :: T.Text -> String
encodeHexText' t = T.unpack . toText . fromBytes $ E.encodeUtf8 t encodeHexText' t =
if T.length t > 0
then T.unpack . toText . fromBytes $ E.encodeUtf8 t
else T.unpack . toText . fromBytes $ E.encodeUtf8 "Sent from Zenith"
-- | Helper function to extract addresses from AddressGroups -- | Helper function to extract addresses from AddressGroups
getAddresses :: AddressGroup -> [ZcashAddress] getAddresses :: AddressGroup -> [ZcashAddress]
@ -484,8 +494,10 @@ displayZcashAddress user pwd (idx, zaddy) = do
zats <- getBalance user pwd zaddy zats <- getBalance user pwd zaddy
putStr $ show idx ++ ": " putStr $ show idx ++ ": "
putStr $ show zaddy putStr $ show zaddy
putStr " Zats: " when (source zaddy == ImportedWatchOnly) (putStr "[VK]")
print zats putStr " Balance: "
mapM_ (putStr . displayZec) zats
putStrLn ""
-- | Copy an address to the clipboard -- | Copy an address to the clipboard
copyAddress :: ZcashAddress -> IO () copyAddress :: ZcashAddress -> IO ()
@ -581,7 +593,7 @@ checkServer user pwd = do
Just myResp -> do Just myResp -> do
let r = result myResp let r = result myResp
if isNodeValid r if isNodeValid r
then putStrLn "Connected to Zcash Full Node :)" then putStrLn $ "Connected to Zcash Full Node (" <> show r <> ") :)"
else do else do
putStrLn "Deprecated Zcash Full Node version found. Exiting" putStrLn "Deprecated Zcash Full Node version found. Exiting"
exitFailure exitFailure

View file

@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
name: zenith name: zenith
version: 0.3.3 version: 0.3.4
synopsis: Haskell CLI for Zcash Full Node synopsis: Haskell CLI for Zcash Full Node
description: Please see the README on repo at <https://git.vergara.tech/Vergara_Tech/zenith#readme> description: Please see the README on repo at <https://git.vergara.tech/Vergara_Tech/zenith#readme>
author: Rene Vergara author: Rene Vergara