Compare commits
88 commits
0.5.1.0-be
...
master
Author | SHA1 | Date | |
---|---|---|---|
69acf4b001 | |||
5a00a41b47 | |||
31d3a18ef1 | |||
041b021ed6 | |||
e803984455 | |||
fd7f1b1727 | |||
5339ea51c6 | |||
f9dfd38613 | |||
bf452242a5 | |||
c306d6bb0c | |||
e9e342e77f | |||
51cf375265 | |||
96c9df571e | |||
c69d4f9974 | |||
1673e653eb | |||
f332d9b177 | |||
ccc19d635b | |||
56eeeaaf20 | |||
75dc71459f | |||
06c58f62df | |||
a8d1333600 | |||
709cfde151 | |||
7956a2ec22 | |||
b9ab1623b3 | |||
d3f3651bcd | |||
2f88c89083 | |||
bf663843b3 | |||
eae4bfc949 | |||
71cc28434a | |||
c4a3ccadb1 | |||
995356f1f6 | |||
8da9a67abd | |||
77a0890ac8 | |||
3a9c5a8430 | |||
f8bac14df3 | |||
244bbf76a7 | |||
b63b0ff444 | |||
d1a5fdfa50 | |||
122d24a929 | |||
e14ae0febd | |||
eb925c21f7 | |||
0c5b2952c7 | |||
f89e9b72ca | |||
dbbce675f5 | |||
84265de3e2 | |||
3f33295bdc | |||
e098480223 | |||
8754c79079 | |||
4f0fa9bc34 | |||
c5b7714917 | |||
eb82f250ea | |||
0ae6e1d458 | |||
ddbd08d474 | |||
772025e317 | |||
d57ac5db14 | |||
51116e8083 | |||
4b826e814b | |||
4e8c01c8d9 | |||
006c101c06 | |||
1c88ea5f08 | |||
42412e12b9 | |||
c6e006edf3 | |||
f79570c8f8 | |||
0b70bbb8de | |||
dbfc91d33a | |||
edb7422951 | |||
a33ae3b595 | |||
4cb4f401a3 | |||
bd1f4e3a5c | |||
28bbcb48f0 | |||
537f3bc46f | |||
939a23f7ca | |||
16b5acabf2 | |||
e946df43f8 | |||
2fb889b1a2 | |||
2f65401ee7 | |||
8cb5211453 | |||
79b0464ff6 | |||
146e111586 | |||
b137b022cc | |||
a96d713859 | |||
e4498e1b7d | |||
83cc1905ad | |||
e9e56453c1 | |||
2fb6747bfb | |||
94b16f743f | |||
d6faa3e5e5 | |||
3f4bfefe64 |
37 changed files with 3091 additions and 165 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,3 +1,7 @@
|
||||||
.stack-work/
|
.stack-work/
|
||||||
*~
|
*~
|
||||||
dist-newstyle/
|
dist-newstyle/
|
||||||
|
zenith.db
|
||||||
|
zenith.log
|
||||||
|
zenith.db-shm
|
||||||
|
zenith.db-wal
|
||||||
|
|
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,4 +1,4 @@
|
||||||
[submodule "zcash-haskell"]
|
[submodule "zcash-haskell"]
|
||||||
path = zcash-haskell
|
path = zcash-haskell
|
||||||
url = https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
url = https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||||
branch = dev040
|
branch = milestone2
|
||||||
|
|
78
CHANGELOG.md
78
CHANGELOG.md
|
@ -5,6 +5,84 @@ 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).
|
||||||
|
|
||||||
|
## [0.6.0.0-beta]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- GUI module
|
||||||
|
- Address list
|
||||||
|
- Transaction list
|
||||||
|
- Balance display
|
||||||
|
- Account selector
|
||||||
|
- Menu for new addresses, accounts, wallets
|
||||||
|
- Dialog to display and copy seed phrase
|
||||||
|
- Dialog to add new address
|
||||||
|
- Dialog to add new account
|
||||||
|
- Dialog to add new wallet
|
||||||
|
- Dialog to display transaction details and copy TX ID
|
||||||
|
- Dialog to send a new transaction
|
||||||
|
- Dialog to display Tx ID after successful broadcast
|
||||||
|
- Unconfirmed balance display on TUI and GUI
|
||||||
|
- Tracking of unconfirmed notes
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Upgraded to GHC 9.6.5
|
||||||
|
- Implemented config and data folder
|
||||||
|
- Improved the `configure` script for installation
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Validation of input of amount for sending in TUI
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Legacy interface to `zcashd`
|
||||||
|
|
||||||
|
## [0.5.3.1-beta]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Docker image
|
||||||
|
|
||||||
|
## [0.5.3.0-beta]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Address Book functionality. Allows users to store frequently used zcash addresses and
|
||||||
|
generate transactions using them.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Improved formatting of sync progress
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Wallet sync when no new block has been detected on-chain.
|
||||||
|
|
||||||
|
## [0.5.2.0-beta]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Update to `zcash-haskell-0.6.2.0` to increase performance of transaction creation
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Truncation of transaction ID when displaying a successfully sent transaction
|
||||||
|
- Missing command in menu for Send
|
||||||
|
|
||||||
|
## [0.5.1.1-beta.1]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Installation instructions in README
|
||||||
|
|
||||||
|
## [0.5.1.1-beta]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Implement CLI changes to send transactions
|
||||||
|
|
||||||
## [0.5.0.0]
|
## [0.5.0.0]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -21,6 +21,7 @@ Zenith is a wallet for the [Zebra](https://zfnd.org/zebra/) Zcash node . It has
|
||||||
- Listing transactions for specific addresses, decoding memos for easy reading.
|
- Listing transactions for specific addresses, decoding memos for easy reading.
|
||||||
- Copying addresses to the clipboard.
|
- Copying addresses to the clipboard.
|
||||||
- Sending transactions with shielded memo support.
|
- Sending transactions with shielded memo support.
|
||||||
|
- Address Book for storing frequently used zcash addresses
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|
27
app/Main.hs
27
app/Main.hs
|
@ -11,7 +11,8 @@ import Data.Sort
|
||||||
import qualified Data.Text as T
|
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.Environment (getArgs)
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import System.IO
|
import System.IO
|
||||||
|
@ -19,10 +20,11 @@ import Text.Read (readMaybe)
|
||||||
import ZcashHaskell.Types
|
import ZcashHaskell.Types
|
||||||
import Zenith.CLI
|
import Zenith.CLI
|
||||||
import Zenith.Core (clearSync, testSync)
|
import Zenith.Core (clearSync, testSync)
|
||||||
|
import Zenith.GUI (runZenithGUI)
|
||||||
import Zenith.Types (Config(..), ZcashAddress(..), ZcashPool(..), ZcashTx(..))
|
import Zenith.Types (Config(..), ZcashAddress(..), ZcashPool(..), ZcashTx(..))
|
||||||
import Zenith.Utils
|
import Zenith.Utils
|
||||||
import Zenith.Zcashd
|
import Zenith.Zcashd
|
||||||
|
{-
|
||||||
prompt :: String -> IO String
|
prompt :: String -> IO String
|
||||||
prompt text = do
|
prompt text = do
|
||||||
putStr text
|
putStr text
|
||||||
|
@ -196,21 +198,22 @@ processUri user pwd =
|
||||||
_ -> False
|
_ -> False
|
||||||
_ <- liftIO $ sendWithUri user pwd (addList !! (idx - 1)) u repTo
|
_ <- liftIO $ sendWithUri user pwd (addList !! (idx - 1)) u repTo
|
||||||
return NoAction
|
return NoAction
|
||||||
|
-}
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
config <- load ["zenith.cfg"]
|
config <- load ["$(HOME)/Zenith/zenith.cfg"]
|
||||||
args <- getArgs
|
args <- getArgs
|
||||||
dbFilePath <- require config "dbFilePath"
|
dbFilePath <- require config "dbFilePath"
|
||||||
nodeUser <- require config "nodeUser"
|
{-nodeUser <- require config "nodeUser"-}
|
||||||
nodePwd <- require config "nodePwd"
|
{-nodePwd <- require config "nodePwd"-}
|
||||||
zebraPort <- require config "zebraPort"
|
zebraPort <- require config "zebraPort"
|
||||||
zebraHost <- require config "zebraHost"
|
zebraHost <- require config "zebraHost"
|
||||||
let myConfig = Config dbFilePath zebraHost zebraPort
|
let myConfig = Config dbFilePath zebraHost zebraPort
|
||||||
if not (null args)
|
if not (null args)
|
||||||
then do
|
then do
|
||||||
case head args of
|
case head args
|
||||||
"legacy" -> do
|
{-"legacy" -> do
|
||||||
checkServer nodeUser nodePwd
|
checkServer nodeUser nodePwd
|
||||||
void $
|
void $
|
||||||
runCLI
|
runCLI
|
||||||
|
@ -219,8 +222,10 @@ main = do
|
||||||
{ getBanner =
|
{ getBanner =
|
||||||
" ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.4.0"
|
" ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.4.0"
|
||||||
}
|
}
|
||||||
(root nodeUser nodePwd)
|
(root nodeUser nodePwd) -}
|
||||||
"cli" -> runZenithCLI myConfig
|
of
|
||||||
|
"gui" -> runZenithGUI myConfig
|
||||||
|
"tui" -> runZenithTUI myConfig
|
||||||
"rescan" -> clearSync myConfig
|
"rescan" -> clearSync myConfig
|
||||||
_ -> printUsage
|
_ -> printUsage
|
||||||
else printUsage
|
else printUsage
|
||||||
|
@ -229,6 +234,6 @@ printUsage :: IO ()
|
||||||
printUsage = do
|
printUsage = do
|
||||||
putStrLn "zenith [command] [parameters]\n"
|
putStrLn "zenith [command] [parameters]\n"
|
||||||
putStrLn "Available commands:"
|
putStrLn "Available commands:"
|
||||||
putStrLn "legacy\tLegacy CLI for zcashd"
|
{-putStrLn "legacy\tLegacy CLI for zcashd"-}
|
||||||
putStrLn "cli\tCLI for zebrad"
|
putStrLn "tui\tTUI for zebrad"
|
||||||
putStrLn "rescan\tRescan the existing wallet(s)"
|
putStrLn "rescan\tRescan the existing wallet(s)"
|
||||||
|
|
BIN
assets/1F616_color.png
Normal file
BIN
assets/1F616_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
assets/1F928_color.png
Normal file
BIN
assets/1F928_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
assets/1F993.png
Normal file
BIN
assets/1F993.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
assets/2620_color.png
Normal file
BIN
assets/2620_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
assets/Atkinson-Hyperlegible-Bold-102.ttf
Normal file
BIN
assets/Atkinson-Hyperlegible-Bold-102.ttf
Normal file
Binary file not shown.
BIN
assets/Atkinson-Hyperlegible-BoldItalic-102.ttf
Normal file
BIN
assets/Atkinson-Hyperlegible-BoldItalic-102.ttf
Normal file
Binary file not shown.
BIN
assets/Atkinson-Hyperlegible-Font-License-2020-1104.pdf
Normal file
BIN
assets/Atkinson-Hyperlegible-Font-License-2020-1104.pdf
Normal file
Binary file not shown.
BIN
assets/Atkinson-Hyperlegible-Italic-102.ttf
Normal file
BIN
assets/Atkinson-Hyperlegible-Italic-102.ttf
Normal file
Binary file not shown.
BIN
assets/Atkinson-Hyperlegible-Regular-102.ttf
Normal file
BIN
assets/Atkinson-Hyperlegible-Regular-102.ttf
Normal file
Binary file not shown.
BIN
assets/DejaVuSansMono-Bold.ttf
Normal file
BIN
assets/DejaVuSansMono-Bold.ttf
Normal file
Binary file not shown.
BIN
assets/DejaVuSansMono-BoldOblique.ttf
Normal file
BIN
assets/DejaVuSansMono-BoldOblique.ttf
Normal file
Binary file not shown.
BIN
assets/DejaVuSansMono-Oblique.ttf
Normal file
BIN
assets/DejaVuSansMono-Oblique.ttf
Normal file
Binary file not shown.
BIN
assets/DejaVuSansMono.ttf
Normal file
BIN
assets/DejaVuSansMono.ttf
Normal file
Binary file not shown.
BIN
assets/OpenMoji-color-glyf_colr_1.ttf
Normal file
BIN
assets/OpenMoji-color-glyf_colr_1.ttf
Normal file
Binary file not shown.
BIN
assets/Roboto-Regular.ttf
Normal file
BIN
assets/Roboto-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/remixicon.ttf
Normal file
BIN
assets/remixicon.ttf
Normal file
Binary file not shown.
|
@ -2,7 +2,7 @@ packages:
|
||||||
./*.cabal
|
./*.cabal
|
||||||
zcash-haskell/zcash-haskell.cabal
|
zcash-haskell/zcash-haskell.cabal
|
||||||
|
|
||||||
with-compiler: ghc-9.4.8
|
with-compiler: ghc-9.6.5
|
||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
|
|
336
cabal.project.freeze
Normal file
336
cabal.project.freeze
Normal file
|
@ -0,0 +1,336 @@
|
||||||
|
active-repositories: hackage.haskell.org:merge
|
||||||
|
constraints: any.Cabal ==3.10.3.0,
|
||||||
|
any.Cabal-syntax ==3.10.3.0,
|
||||||
|
any.Clipboard ==2.3.2.0,
|
||||||
|
any.HUnit ==1.6.2.0,
|
||||||
|
any.Hclip ==3.0.0.4,
|
||||||
|
any.JuicyPixels ==3.3.9,
|
||||||
|
JuicyPixels -mmap,
|
||||||
|
any.OneTuple ==0.4.2,
|
||||||
|
any.OpenGLRaw ==3.3.4.1,
|
||||||
|
OpenGLRaw -osandroid +usegles2 +useglxgetprocaddress +usenativewindowslibraries,
|
||||||
|
any.QuickCheck ==2.14.3,
|
||||||
|
QuickCheck -old-random +templatehaskell,
|
||||||
|
any.RSA ==2.4.1,
|
||||||
|
any.SHA ==1.6.4.4,
|
||||||
|
SHA -exe,
|
||||||
|
any.StateVar ==1.2.2,
|
||||||
|
any.X11 ==1.10.3,
|
||||||
|
X11 -pedantic,
|
||||||
|
any.adjunctions ==4.4.2,
|
||||||
|
any.aeson ==2.2.3.0,
|
||||||
|
aeson +ordered-keymap,
|
||||||
|
any.alex ==3.5.1.0,
|
||||||
|
any.ansi-terminal ==1.1.1,
|
||||||
|
ansi-terminal -example,
|
||||||
|
any.ansi-terminal-types ==1.1,
|
||||||
|
any.appar ==0.1.8,
|
||||||
|
any.array ==0.5.6.0,
|
||||||
|
any.ascii-progress ==0.3.3.0,
|
||||||
|
ascii-progress -examples,
|
||||||
|
any.asn1-encoding ==0.9.6,
|
||||||
|
any.asn1-parse ==0.9.5,
|
||||||
|
any.asn1-types ==0.3.4,
|
||||||
|
any.assoc ==1.1.1,
|
||||||
|
assoc -tagged,
|
||||||
|
any.async ==2.2.5,
|
||||||
|
async -bench,
|
||||||
|
any.attoparsec ==0.14.4,
|
||||||
|
attoparsec -developer,
|
||||||
|
any.attoparsec-aeson ==2.2.2.0,
|
||||||
|
any.authenticate-oauth ==1.7,
|
||||||
|
any.auto-update ==0.2.1,
|
||||||
|
any.base ==4.18.2.1,
|
||||||
|
any.base-compat ==0.14.0,
|
||||||
|
any.base-compat-batteries ==0.14.0,
|
||||||
|
any.base-orphans ==0.9.2,
|
||||||
|
any.base16 ==1.0,
|
||||||
|
any.base16-bytestring ==1.0.2.0,
|
||||||
|
any.base58-bytestring ==0.1.0,
|
||||||
|
any.base64-bytestring ==1.2.1.0,
|
||||||
|
any.basement ==0.0.16,
|
||||||
|
any.bifunctors ==5.6.2,
|
||||||
|
bifunctors +tagged,
|
||||||
|
any.bimap ==0.5.0,
|
||||||
|
any.binary ==0.8.9.1,
|
||||||
|
any.binary-orphans ==1.0.5,
|
||||||
|
any.bitvec ==1.1.5.0,
|
||||||
|
bitvec +simd,
|
||||||
|
any.blaze-builder ==0.4.2.3,
|
||||||
|
any.blaze-html ==0.9.2.0,
|
||||||
|
any.blaze-markup ==0.8.3.0,
|
||||||
|
any.borsh ==0.3.0,
|
||||||
|
any.brick ==2.4,
|
||||||
|
brick -demos,
|
||||||
|
any.byteorder ==1.0.4,
|
||||||
|
any.bytes ==0.17.3,
|
||||||
|
any.bytestring ==0.11.5.3,
|
||||||
|
any.bytestring-builder ==0.10.8.2.0,
|
||||||
|
bytestring-builder +bytestring_has_builder,
|
||||||
|
any.bytestring-to-vector ==0.3.0.1,
|
||||||
|
any.c2hs ==0.28.8,
|
||||||
|
c2hs +base3 -regression,
|
||||||
|
any.cabal-doctest ==1.0.10,
|
||||||
|
any.call-stack ==0.4.0,
|
||||||
|
any.case-insensitive ==1.2.1.0,
|
||||||
|
any.cborg ==0.2.10.0,
|
||||||
|
cborg +optimize-gmp,
|
||||||
|
any.cereal ==0.5.8.3,
|
||||||
|
cereal -bytestring-builder,
|
||||||
|
any.character-ps ==0.1,
|
||||||
|
any.clock ==0.8.4,
|
||||||
|
clock -llvm,
|
||||||
|
any.colour ==2.3.6,
|
||||||
|
any.comonad ==5.0.8,
|
||||||
|
comonad +containers +distributive +indexed-traversable,
|
||||||
|
any.concurrent-output ==1.10.21,
|
||||||
|
any.conduit ==1.3.5,
|
||||||
|
any.conduit-extra ==1.3.6,
|
||||||
|
any.config-ini ==0.2.7.0,
|
||||||
|
config-ini -enable-doctests,
|
||||||
|
any.configurator ==0.3.0.0,
|
||||||
|
configurator -developer,
|
||||||
|
any.containers ==0.6.7,
|
||||||
|
any.contravariant ==1.5.5,
|
||||||
|
contravariant +semigroups +statevar +tagged,
|
||||||
|
any.cookie ==0.5.0,
|
||||||
|
any.crypto-api ==0.13.3,
|
||||||
|
crypto-api -all_cpolys,
|
||||||
|
any.crypto-pubkey-types ==0.4.3,
|
||||||
|
any.crypton ==1.0.0,
|
||||||
|
crypton -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq +support_pclmuldq +support_rdrand -support_sse +use_target_attributes,
|
||||||
|
any.crypton-connection ==0.4.1,
|
||||||
|
any.crypton-x509 ==1.7.7,
|
||||||
|
any.crypton-x509-store ==1.6.9,
|
||||||
|
any.crypton-x509-system ==1.6.7,
|
||||||
|
any.crypton-x509-validation ==1.6.12,
|
||||||
|
any.cryptonite ==0.30,
|
||||||
|
cryptonite -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq -support_pclmuldq +support_rdrand -support_sse +use_target_attributes,
|
||||||
|
any.data-clist ==0.2,
|
||||||
|
any.data-default ==0.7.1.1,
|
||||||
|
any.data-default-class ==0.1.2.0,
|
||||||
|
any.data-default-instances-containers ==0.0.1,
|
||||||
|
any.data-default-instances-dlist ==0.0.1,
|
||||||
|
any.data-default-instances-old-locale ==0.0.1,
|
||||||
|
any.data-fix ==0.3.4,
|
||||||
|
any.deepseq ==1.4.8.1,
|
||||||
|
any.directory ==1.3.8.4,
|
||||||
|
any.distributive ==0.6.2.1,
|
||||||
|
distributive +semigroups +tagged,
|
||||||
|
any.dlist ==1.0,
|
||||||
|
dlist -werror,
|
||||||
|
any.double-conversion ==2.0.5.0,
|
||||||
|
double-conversion -developer +embedded_double_conversion,
|
||||||
|
any.easy-file ==0.2.5,
|
||||||
|
any.entropy ==0.4.1.10,
|
||||||
|
entropy -donotgetentropy,
|
||||||
|
any.envy ==2.1.3.0,
|
||||||
|
any.esqueleto ==3.5.11.2,
|
||||||
|
any.exceptions ==0.10.7,
|
||||||
|
any.extra ==1.7.16,
|
||||||
|
any.fast-logger ==3.2.3,
|
||||||
|
any.filepath ==1.4.300.1,
|
||||||
|
any.fixed ==0.3,
|
||||||
|
any.foreign-rust ==0.1.0,
|
||||||
|
any.foreign-store ==0.2.1,
|
||||||
|
any.formatting ==7.2.0,
|
||||||
|
formatting -no-double-conversion,
|
||||||
|
any.free ==5.2,
|
||||||
|
any.generic-deriving ==1.14.5,
|
||||||
|
generic-deriving +base-4-9,
|
||||||
|
any.generically ==0.1.1,
|
||||||
|
any.generics-sop ==0.5.1.4,
|
||||||
|
any.ghc ==9.6.5,
|
||||||
|
any.ghc-bignum ==1.3,
|
||||||
|
any.ghc-boot ==9.6.5,
|
||||||
|
any.ghc-boot-th ==9.6.5,
|
||||||
|
any.ghc-heap ==9.6.5,
|
||||||
|
any.ghc-prim ==0.10.0,
|
||||||
|
any.ghci ==9.6.5,
|
||||||
|
any.half ==0.3.1,
|
||||||
|
any.happy ==1.20.1.1,
|
||||||
|
any.hashable ==1.4.7.0,
|
||||||
|
hashable -arch-native +integer-gmp -random-initial-seed,
|
||||||
|
any.haskell-lexer ==1.1.1,
|
||||||
|
any.haskoin-core ==1.1.0,
|
||||||
|
any.hexstring ==0.12.1.0,
|
||||||
|
any.hourglass ==0.2.12,
|
||||||
|
any.hpc ==0.6.2.0,
|
||||||
|
any.hsc2hs ==0.68.10,
|
||||||
|
hsc2hs -in-ghc-tree,
|
||||||
|
any.hspec ==2.11.9,
|
||||||
|
any.hspec-core ==2.11.9,
|
||||||
|
any.hspec-discover ==2.11.9,
|
||||||
|
any.hspec-expectations ==0.8.4,
|
||||||
|
any.http-api-data ==0.6.1,
|
||||||
|
http-api-data -use-text-show,
|
||||||
|
any.http-client ==0.7.17,
|
||||||
|
http-client +network-uri,
|
||||||
|
any.http-client-tls ==0.3.6.3,
|
||||||
|
any.http-conduit ==2.3.8.3,
|
||||||
|
http-conduit +aeson,
|
||||||
|
any.http-types ==0.12.4,
|
||||||
|
any.indexed-traversable ==0.1.4,
|
||||||
|
any.indexed-traversable-instances ==0.1.2,
|
||||||
|
any.integer-conversion ==0.1.1,
|
||||||
|
any.integer-gmp ==1.1,
|
||||||
|
any.integer-logarithms ==1.0.3.1,
|
||||||
|
integer-logarithms -check-bounds +integer-gmp,
|
||||||
|
any.invariant ==0.6.3,
|
||||||
|
any.iproute ==1.7.12,
|
||||||
|
any.kan-extensions ==5.2.6,
|
||||||
|
any.language-c ==0.9.3,
|
||||||
|
language-c -allwarnings +iecfpextension +usebytestrings,
|
||||||
|
any.lens ==5.3.2,
|
||||||
|
lens -benchmark-uniplate -dump-splices +inlining -j +test-hunit +test-properties +test-templates +trustworthy,
|
||||||
|
any.lens-aeson ==1.2.3,
|
||||||
|
any.lift-type ==0.1.1.1,
|
||||||
|
any.lifted-base ==0.2.3.12,
|
||||||
|
any.linear ==1.22,
|
||||||
|
linear -herbie +template-haskell,
|
||||||
|
any.megaparsec ==9.6.1,
|
||||||
|
megaparsec -dev,
|
||||||
|
any.memory ==0.18.0,
|
||||||
|
memory +support_bytestring +support_deepseq,
|
||||||
|
any.microlens ==0.4.13.1,
|
||||||
|
any.microlens-mtl ==0.2.0.3,
|
||||||
|
any.microlens-th ==0.4.3.15,
|
||||||
|
any.mime-types ==0.1.2.0,
|
||||||
|
any.monad-control ==1.0.3.1,
|
||||||
|
any.monad-logger ==0.3.40,
|
||||||
|
monad-logger +template_haskell,
|
||||||
|
any.monad-loops ==0.4.3,
|
||||||
|
monad-loops +base4,
|
||||||
|
any.mono-traversable ==1.0.17.0,
|
||||||
|
any.monomer ==1.6.0.1,
|
||||||
|
monomer -examples,
|
||||||
|
any.mtl ==2.3.1,
|
||||||
|
any.murmur3 ==1.0.5,
|
||||||
|
any.nanovg ==0.8.1.0,
|
||||||
|
nanovg -examples -gl2 -gles3 -stb_truetype,
|
||||||
|
any.network ==3.2.1.0,
|
||||||
|
network -devel,
|
||||||
|
any.network-uri ==2.6.4.2,
|
||||||
|
any.old-locale ==1.0.0.7,
|
||||||
|
any.old-time ==1.1.0.4,
|
||||||
|
any.os-string ==2.0.6,
|
||||||
|
any.parallel ==3.2.2.0,
|
||||||
|
any.parsec ==3.1.16.1,
|
||||||
|
any.parser-combinators ==1.3.0,
|
||||||
|
parser-combinators -dev,
|
||||||
|
any.path-pieces ==0.2.1,
|
||||||
|
any.pem ==0.2.4,
|
||||||
|
any.persistent ==2.14.6.1,
|
||||||
|
any.persistent-sqlite ==2.13.3.0,
|
||||||
|
persistent-sqlite -build-sanity-exe +full-text-search +have-usleep +json1 -systemlib +uri-filenames -use-pkgconfig -use-stat3 +use-stat4,
|
||||||
|
any.persistent-template ==2.12.0.0,
|
||||||
|
any.pretty ==1.1.3.6,
|
||||||
|
any.primitive ==0.9.0.0,
|
||||||
|
any.process ==1.6.19.0,
|
||||||
|
any.profunctors ==5.6.2,
|
||||||
|
any.psqueues ==0.2.8.0,
|
||||||
|
any.pureMD5 ==2.1.4,
|
||||||
|
pureMD5 -test,
|
||||||
|
any.qrcode-core ==0.9.9,
|
||||||
|
any.qrcode-juicypixels ==0.8.5,
|
||||||
|
any.quickcheck-io ==0.2.0,
|
||||||
|
any.quickcheck-transformer ==0.3.1.2,
|
||||||
|
any.random ==1.2.1.2,
|
||||||
|
any.reflection ==2.1.8,
|
||||||
|
reflection -slow +template-haskell,
|
||||||
|
any.regex-base ==0.94.0.2,
|
||||||
|
any.regex-compat ==0.95.2.1,
|
||||||
|
any.regex-posix ==0.96.0.1,
|
||||||
|
regex-posix -_regex-posix-clib,
|
||||||
|
any.resource-pool ==0.4.0.0,
|
||||||
|
any.resourcet ==1.3.0,
|
||||||
|
any.rts ==1.0.2,
|
||||||
|
any.safe ==0.3.21,
|
||||||
|
any.safe-exceptions ==0.1.7.4,
|
||||||
|
any.scientific ==0.3.8.0,
|
||||||
|
scientific -integer-simple,
|
||||||
|
any.sdl2 ==2.5.5.0,
|
||||||
|
sdl2 -examples -no-linear -opengl-example +pkgconfig +recent-ish,
|
||||||
|
any.secp256k1-haskell ==1.2.0,
|
||||||
|
any.semialign ==1.3.1,
|
||||||
|
semialign +semigroupoids,
|
||||||
|
any.semigroupoids ==6.0.1,
|
||||||
|
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
||||||
|
any.semigroups ==0.20,
|
||||||
|
semigroups +binary +bytestring -bytestring-builder +containers +deepseq +hashable +tagged +template-haskell +text +transformers +unordered-containers,
|
||||||
|
any.serialise ==0.2.6.1,
|
||||||
|
serialise +newtime15,
|
||||||
|
any.silently ==1.2.5.3,
|
||||||
|
any.socks ==0.6.1,
|
||||||
|
any.sop-core ==0.5.0.2,
|
||||||
|
any.sort ==1.0.0.0,
|
||||||
|
any.split ==0.2.5,
|
||||||
|
any.splitmix ==0.1.0.5,
|
||||||
|
splitmix -optimised-mixer,
|
||||||
|
any.stm ==2.5.1.0,
|
||||||
|
any.stm-chans ==3.0.0.9,
|
||||||
|
any.streaming-commons ==0.2.2.6,
|
||||||
|
streaming-commons -use-bytestring-builder,
|
||||||
|
any.strict ==0.5.1,
|
||||||
|
any.string-conversions ==0.4.0.1,
|
||||||
|
any.system-cxx-std-lib ==1.0,
|
||||||
|
any.tagged ==0.8.8,
|
||||||
|
tagged +deepseq +transformers,
|
||||||
|
any.template-haskell ==2.20.0.0,
|
||||||
|
any.terminal-size ==0.3.4,
|
||||||
|
any.terminfo ==0.4.1.6,
|
||||||
|
any.text ==2.0.2,
|
||||||
|
any.text-iso8601 ==0.1.1,
|
||||||
|
any.text-short ==0.1.6,
|
||||||
|
text-short -asserts,
|
||||||
|
any.text-show ==3.10.5,
|
||||||
|
text-show +base-4-9 +integer-gmp +new-functor-classes +template-haskell-2-11,
|
||||||
|
any.text-zipper ==0.13,
|
||||||
|
any.tf-random ==0.5,
|
||||||
|
any.th-abstraction ==0.7.0.0,
|
||||||
|
any.th-compat ==0.1.5,
|
||||||
|
any.th-lift ==0.8.4,
|
||||||
|
any.th-lift-instances ==0.1.20,
|
||||||
|
any.these ==1.2.1,
|
||||||
|
any.time ==1.12.2,
|
||||||
|
any.time-compat ==1.9.7,
|
||||||
|
any.time-locale-compat ==0.1.1.5,
|
||||||
|
time-locale-compat -old-locale,
|
||||||
|
any.tls ==2.1.0,
|
||||||
|
tls -devel,
|
||||||
|
any.transformers ==0.6.1.0,
|
||||||
|
any.transformers-base ==0.4.6,
|
||||||
|
transformers-base +orphaninstances,
|
||||||
|
any.transformers-compat ==0.7.2,
|
||||||
|
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
||||||
|
any.typed-process ==0.2.11.1,
|
||||||
|
any.unix ==2.8.4.0,
|
||||||
|
any.unix-compat ==0.7.2,
|
||||||
|
any.unix-time ==0.4.15,
|
||||||
|
any.unliftio ==0.2.25.0,
|
||||||
|
any.unliftio-core ==0.2.1.0,
|
||||||
|
any.unordered-containers ==0.2.20,
|
||||||
|
unordered-containers -debug,
|
||||||
|
any.utf8-string ==1.0.2,
|
||||||
|
any.uuid-types ==1.0.6,
|
||||||
|
any.vault ==0.3.1.5,
|
||||||
|
vault +useghc,
|
||||||
|
any.vector ==0.13.1.0,
|
||||||
|
vector +boundschecks -internalchecks -unsafechecks -wall,
|
||||||
|
any.vector-algorithms ==0.9.0.2,
|
||||||
|
vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks,
|
||||||
|
any.vector-stream ==0.1.0.1,
|
||||||
|
any.void ==0.7.3,
|
||||||
|
void -safe,
|
||||||
|
any.vty ==6.2,
|
||||||
|
any.vty-crossplatform ==0.4.0.0,
|
||||||
|
vty-crossplatform -demos,
|
||||||
|
any.vty-unix ==0.2.0.0,
|
||||||
|
any.wide-word ==0.1.6.0,
|
||||||
|
any.witherable ==0.5,
|
||||||
|
any.word-wrap ==0.5,
|
||||||
|
any.wreq ==0.5.4.3,
|
||||||
|
wreq -aws -developer +doctest -httpbin,
|
||||||
|
any.zlib ==0.7.1.0,
|
||||||
|
zlib -bundled-c-zlib +non-blocking-ffi +pkg-config
|
||||||
|
index-state: hackage.haskell.org 2024-07-10T18:40:26Z
|
17
configure
vendored
17
configure
vendored
|
@ -1,6 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
echo "Configuring Zenith...."
|
||||||
echo "export PKG_CONFIG_PATH=$HOME/.local/share/zcash-haskell:\$PKG_CONFIG_PATH" | tee -a ~/.bashrc
|
if grep -q "local/share/zcash-haskell" "$HOME/.bashrc"; then
|
||||||
echo "export LD_LIBRARY_PATH=$HOME/.local/share/zcash-haskell:\$LD_LIBRARY_PATH" | tee -a ~/.bashrc
|
echo "... Paths already exist"
|
||||||
|
else
|
||||||
|
# Set Paths
|
||||||
|
echo "... Adding new zenith paths to local configuration"
|
||||||
|
echo "export PKG_CONFIG_PATH=$HOME/.local/share/zcash-haskell:\$PKG_CONFIG_PATH" | tee -a ~/.bashrc
|
||||||
|
echo "export LD_LIBRARY_PATH=$HOME/.local/share/zcash-haskell:\$LD_LIBRARY_PATH" | tee -a ~/.bashrc
|
||||||
|
fi
|
||||||
|
echo "... Reloading paths"
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
|
echo "... building zcash-haskell"
|
||||||
cd zcash-haskell && cabal build
|
cd zcash-haskell && cabal build
|
||||||
|
echo
|
||||||
|
echo "Done"
|
||||||
|
echo
|
||||||
|
|
5
install
Executable file
5
install
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Deploying Zenith executable..."
|
||||||
|
ln -s ${PWD}/dist-newstyle/build/x86_64-linux/ghc-9.6.5/zenith-0.6.0.0/build/zenith/zenith ~/.local/bin/zenith
|
||||||
|
echo "Done."
|
File diff suppressed because it is too large
Load diff
|
@ -24,7 +24,7 @@ import Data.Binary.Get hiding (getBytes)
|
||||||
import qualified Data.ByteString as BS
|
import qualified Data.ByteString as BS
|
||||||
import qualified Data.ByteString.Lazy as LBS
|
import qualified Data.ByteString.Lazy as LBS
|
||||||
import Data.Digest.Pure.MD5
|
import Data.Digest.Pure.MD5
|
||||||
import Data.HexString (HexString, hexString, toBytes)
|
import Data.HexString (HexString, hexString, toBytes, toText)
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Maybe (fromJust)
|
import Data.Maybe (fromJust)
|
||||||
import Data.Pool (Pool)
|
import Data.Pool (Pool)
|
||||||
|
@ -574,6 +574,7 @@ prepareTx pool zebraHost zebraPort zn za bh amt ua memo = do
|
||||||
zn
|
zn
|
||||||
(bh + 3)
|
(bh + 3)
|
||||||
True
|
True
|
||||||
|
logDebugN $ T.pack $ show tx
|
||||||
return tx
|
return tx
|
||||||
where
|
where
|
||||||
makeOutgoing ::
|
makeOutgoing ::
|
||||||
|
|
283
src/Zenith/DB.hs
283
src/Zenith/DB.hs
|
@ -32,7 +32,6 @@ import qualified Data.Text as T
|
||||||
import qualified Data.Text.Encoding as TE
|
import qualified Data.Text.Encoding as TE
|
||||||
import Data.Word
|
import Data.Word
|
||||||
import Database.Esqueleto.Experimental
|
import Database.Esqueleto.Experimental
|
||||||
import qualified Database.Persist as P
|
|
||||||
import qualified Database.Persist.Sqlite as PS
|
import qualified Database.Persist.Sqlite as PS
|
||||||
import Database.Persist.TH
|
import Database.Persist.TH
|
||||||
import Haskoin.Transaction.Common
|
import Haskoin.Transaction.Common
|
||||||
|
@ -43,7 +42,6 @@ import Haskoin.Transaction.Common
|
||||||
)
|
)
|
||||||
import qualified Lens.Micro as ML ((&), (.~), (^.))
|
import qualified Lens.Micro as ML ((&), (.~), (^.))
|
||||||
import ZcashHaskell.Orchard (isValidUnifiedAddress)
|
import ZcashHaskell.Orchard (isValidUnifiedAddress)
|
||||||
import ZcashHaskell.Sapling (decodeSaplingOutputEsk)
|
|
||||||
import ZcashHaskell.Types
|
import ZcashHaskell.Types
|
||||||
( DecodedNote(..)
|
( DecodedNote(..)
|
||||||
, OrchardAction(..)
|
, OrchardAction(..)
|
||||||
|
@ -77,6 +75,7 @@ import Zenith.Types
|
||||||
, TransparentSpendingKeyDB
|
, TransparentSpendingKeyDB
|
||||||
, UnifiedAddressDB(..)
|
, UnifiedAddressDB(..)
|
||||||
, ZcashNetDB(..)
|
, ZcashNetDB(..)
|
||||||
|
, ZcashPool(..)
|
||||||
)
|
)
|
||||||
|
|
||||||
share
|
share
|
||||||
|
@ -246,6 +245,21 @@ share
|
||||||
position Int
|
position Int
|
||||||
UniqueSSPos tx position
|
UniqueSSPos tx position
|
||||||
deriving Show Eq
|
deriving Show Eq
|
||||||
|
QrCode
|
||||||
|
address WalletAddressId OnDeleteCascade OnUpdateCascade
|
||||||
|
version ZcashPool
|
||||||
|
bytes BS.ByteString
|
||||||
|
height Int
|
||||||
|
width Int
|
||||||
|
name T.Text
|
||||||
|
UniqueQr address version
|
||||||
|
deriving Show Eq
|
||||||
|
AddressBook
|
||||||
|
network ZcashNetDB
|
||||||
|
abdescrip T.Text
|
||||||
|
abaddress T.Text
|
||||||
|
UniqueABA abaddress
|
||||||
|
deriving Show Eq
|
||||||
|]
|
|]
|
||||||
|
|
||||||
-- * Database functions
|
-- * Database functions
|
||||||
|
@ -416,6 +430,16 @@ getWalletAddresses pool w = do
|
||||||
addrs <- mapM (getAddresses pool . entityKey) accs
|
addrs <- mapM (getAddresses pool . entityKey) accs
|
||||||
return $ concat addrs
|
return $ concat addrs
|
||||||
|
|
||||||
|
getExternalAddresses :: ConnectionPool -> IO [Entity WalletAddress]
|
||||||
|
getExternalAddresses pool = do
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
select $ do
|
||||||
|
addrs <- from $ table @WalletAddress
|
||||||
|
where_ $ addrs ^. WalletAddressScope ==. val (ScopeDB External)
|
||||||
|
return addrs
|
||||||
|
|
||||||
-- | Returns the largest address index for the given account
|
-- | Returns the largest address index for the given account
|
||||||
getMaxAddress ::
|
getMaxAddress ::
|
||||||
ConnectionPool -- ^ The database path
|
ConnectionPool -- ^ The database path
|
||||||
|
@ -548,6 +572,41 @@ getZcashTransactions pool b =
|
||||||
orderBy [asc $ txs ^. ZcashTransactionBlock]
|
orderBy [asc $ txs ^. ZcashTransactionBlock]
|
||||||
return txs
|
return txs
|
||||||
|
|
||||||
|
-- ** QR codes
|
||||||
|
-- | Functions to manage the QR codes stored in the database
|
||||||
|
saveQrCode ::
|
||||||
|
ConnectionPool -- ^ the connection pool
|
||||||
|
-> QrCode
|
||||||
|
-> NoLoggingT IO (Maybe (Entity QrCode))
|
||||||
|
saveQrCode pool qr =
|
||||||
|
PS.retryOnBusy $ flip PS.runSqlPool pool $ insertUniqueEntity qr
|
||||||
|
|
||||||
|
getQrCodes ::
|
||||||
|
ConnectionPool -- ^ the connection pool
|
||||||
|
-> WalletAddressId
|
||||||
|
-> IO [Entity QrCode]
|
||||||
|
getQrCodes pool wId =
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
select $ do
|
||||||
|
qrs <- from $ table @QrCode
|
||||||
|
where_ $ qrs ^. QrCodeAddress ==. val wId
|
||||||
|
return qrs
|
||||||
|
|
||||||
|
getQrCode :: ConnectionPool -> ZcashPool -> WalletAddressId -> IO (Maybe QrCode)
|
||||||
|
getQrCode pool zp wId = do
|
||||||
|
r <-
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
selectOne $ do
|
||||||
|
qrs <- from $ table @QrCode
|
||||||
|
where_ $ qrs ^. QrCodeAddress ==. val wId
|
||||||
|
where_ $ qrs ^. QrCodeVersion ==. val zp
|
||||||
|
return qrs
|
||||||
|
return $ entityVal <$> r
|
||||||
|
|
||||||
-- * Wallet
|
-- * Wallet
|
||||||
-- | Get the block of the last transaction known to the wallet
|
-- | Get the block of the last transaction known to the wallet
|
||||||
getMaxWalletBlock ::
|
getMaxWalletBlock ::
|
||||||
|
@ -1337,6 +1396,35 @@ getBalance pool za = do
|
||||||
let oBal = sum oAmts
|
let oBal = sum oAmts
|
||||||
return . fromIntegral $ tBal + sBal + oBal
|
return . fromIntegral $ tBal + sBal + oBal
|
||||||
|
|
||||||
|
getTransparentBalance :: ConnectionPool -> ZcashAccountId -> IO Integer
|
||||||
|
getTransparentBalance pool za = do
|
||||||
|
trNotes <- getWalletUnspentTrNotes pool za
|
||||||
|
let tAmts = map (walletTrNoteValue . entityVal) trNotes
|
||||||
|
return . fromIntegral $ sum tAmts
|
||||||
|
|
||||||
|
getShieldedBalance :: ConnectionPool -> ZcashAccountId -> IO Integer
|
||||||
|
getShieldedBalance pool za = do
|
||||||
|
sapNotes <- getWalletUnspentSapNotes pool za
|
||||||
|
let sAmts = map (walletSapNoteValue . entityVal) sapNotes
|
||||||
|
let sBal = sum sAmts
|
||||||
|
orchNotes <- getWalletUnspentOrchNotes pool za
|
||||||
|
let oAmts = map (walletOrchNoteValue . entityVal) orchNotes
|
||||||
|
let oBal = sum oAmts
|
||||||
|
return . fromIntegral $ sBal + oBal
|
||||||
|
|
||||||
|
getUnconfirmedBalance :: ConnectionPool -> ZcashAccountId -> IO Integer
|
||||||
|
getUnconfirmedBalance pool za = do
|
||||||
|
trNotes <- getWalletUnspentUnconfirmedTrNotes pool za
|
||||||
|
let tAmts = map (walletTrNoteValue . entityVal) trNotes
|
||||||
|
let tBal = sum tAmts
|
||||||
|
sapNotes <- getWalletUnspentUnconfirmedSapNotes pool za
|
||||||
|
let sAmts = map (walletSapNoteValue . entityVal) sapNotes
|
||||||
|
let sBal = sum sAmts
|
||||||
|
orchNotes <- getWalletUnspentUnconfirmedOrchNotes pool za
|
||||||
|
let oAmts = map (walletOrchNoteValue . entityVal) orchNotes
|
||||||
|
let oBal = sum oAmts
|
||||||
|
return . fromIntegral $ tBal + sBal + oBal
|
||||||
|
|
||||||
clearWalletTransactions :: ConnectionPool -> IO ()
|
clearWalletTransactions :: ConnectionPool -> IO ()
|
||||||
clearWalletTransactions pool = do
|
clearWalletTransactions pool = do
|
||||||
runNoLoggingT $
|
runNoLoggingT $
|
||||||
|
@ -1374,10 +1462,42 @@ getWalletUnspentTrNotes pool za = do
|
||||||
PS.retryOnBusy $
|
PS.retryOnBusy $
|
||||||
flip PS.runSqlPool pool $ do
|
flip PS.runSqlPool pool $ do
|
||||||
select $ do
|
select $ do
|
||||||
n <- from $ table @WalletTrNote
|
(txs :& tNotes) <-
|
||||||
where_ (n ^. WalletTrNoteAccId ==. val za)
|
from $ table @WalletTransaction `innerJoin` table @WalletTrNote `on`
|
||||||
where_ (n ^. WalletTrNoteSpent ==. val False)
|
(\(txs :& tNotes) ->
|
||||||
pure n
|
txs ^. WalletTransactionId ==. tNotes ^. WalletTrNoteTx)
|
||||||
|
where_ (tNotes ^. WalletTrNoteAccId ==. val za)
|
||||||
|
where_ (tNotes ^. WalletTrNoteSpent ==. val False)
|
||||||
|
where_
|
||||||
|
((tNotes ^. WalletTrNoteChange ==. val True &&. txs ^.
|
||||||
|
WalletTransactionConf >=.
|
||||||
|
val 3) ||.
|
||||||
|
(tNotes ^. WalletTrNoteChange ==. val False &&. txs ^.
|
||||||
|
WalletTransactionConf >=.
|
||||||
|
val 10))
|
||||||
|
pure tNotes
|
||||||
|
|
||||||
|
getWalletUnspentUnconfirmedTrNotes ::
|
||||||
|
ConnectionPool -> ZcashAccountId -> IO [Entity WalletTrNote]
|
||||||
|
getWalletUnspentUnconfirmedTrNotes pool za = do
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
select $ do
|
||||||
|
(txs :& tNotes) <-
|
||||||
|
from $ table @WalletTransaction `innerJoin` table @WalletTrNote `on`
|
||||||
|
(\(txs :& tNotes) ->
|
||||||
|
txs ^. WalletTransactionId ==. tNotes ^. WalletTrNoteTx)
|
||||||
|
where_ (tNotes ^. WalletTrNoteAccId ==. val za)
|
||||||
|
where_ (tNotes ^. WalletTrNoteSpent ==. val False)
|
||||||
|
where_
|
||||||
|
((tNotes ^. WalletTrNoteChange ==. val True &&. txs ^.
|
||||||
|
WalletTransactionConf <.
|
||||||
|
val 3) ||.
|
||||||
|
(tNotes ^. WalletTrNoteChange ==. val False &&. txs ^.
|
||||||
|
WalletTransactionConf <.
|
||||||
|
val 10))
|
||||||
|
pure tNotes
|
||||||
|
|
||||||
getWalletUnspentSapNotes ::
|
getWalletUnspentSapNotes ::
|
||||||
ConnectionPool -> ZcashAccountId -> IO [Entity WalletSapNote]
|
ConnectionPool -> ZcashAccountId -> IO [Entity WalletSapNote]
|
||||||
|
@ -1386,10 +1506,42 @@ getWalletUnspentSapNotes pool za = do
|
||||||
PS.retryOnBusy $
|
PS.retryOnBusy $
|
||||||
flip PS.runSqlPool pool $ do
|
flip PS.runSqlPool pool $ do
|
||||||
select $ do
|
select $ do
|
||||||
n1 <- from $ table @WalletSapNote
|
(txs :& sNotes) <-
|
||||||
where_ (n1 ^. WalletSapNoteAccId ==. val za)
|
from $ table @WalletTransaction `innerJoin` table @WalletSapNote `on`
|
||||||
where_ (n1 ^. WalletSapNoteSpent ==. val False)
|
(\(txs :& sNotes) ->
|
||||||
pure n1
|
txs ^. WalletTransactionId ==. sNotes ^. WalletSapNoteTx)
|
||||||
|
where_ (sNotes ^. WalletSapNoteAccId ==. val za)
|
||||||
|
where_ (sNotes ^. WalletSapNoteSpent ==. val False)
|
||||||
|
where_
|
||||||
|
((sNotes ^. WalletSapNoteChange ==. val True &&. txs ^.
|
||||||
|
WalletTransactionConf >=.
|
||||||
|
val 3) ||.
|
||||||
|
(sNotes ^. WalletSapNoteChange ==. val False &&. txs ^.
|
||||||
|
WalletTransactionConf >=.
|
||||||
|
val 10))
|
||||||
|
pure sNotes
|
||||||
|
|
||||||
|
getWalletUnspentUnconfirmedSapNotes ::
|
||||||
|
ConnectionPool -> ZcashAccountId -> IO [Entity WalletSapNote]
|
||||||
|
getWalletUnspentUnconfirmedSapNotes pool za = do
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
select $ do
|
||||||
|
(txs :& sNotes) <-
|
||||||
|
from $ table @WalletTransaction `innerJoin` table @WalletSapNote `on`
|
||||||
|
(\(txs :& sNotes) ->
|
||||||
|
txs ^. WalletTransactionId ==. sNotes ^. WalletSapNoteTx)
|
||||||
|
where_ (sNotes ^. WalletSapNoteAccId ==. val za)
|
||||||
|
where_ (sNotes ^. WalletSapNoteSpent ==. val False)
|
||||||
|
where_
|
||||||
|
((sNotes ^. WalletSapNoteChange ==. val True &&. txs ^.
|
||||||
|
WalletTransactionConf <.
|
||||||
|
val 3) ||.
|
||||||
|
(sNotes ^. WalletSapNoteChange ==. val False &&. txs ^.
|
||||||
|
WalletTransactionConf <.
|
||||||
|
val 10))
|
||||||
|
pure sNotes
|
||||||
|
|
||||||
getWalletUnspentOrchNotes ::
|
getWalletUnspentOrchNotes ::
|
||||||
ConnectionPool -> ZcashAccountId -> IO [Entity WalletOrchNote]
|
ConnectionPool -> ZcashAccountId -> IO [Entity WalletOrchNote]
|
||||||
|
@ -1398,10 +1550,42 @@ getWalletUnspentOrchNotes pool za = do
|
||||||
PS.retryOnBusy $
|
PS.retryOnBusy $
|
||||||
flip PS.runSqlPool pool $ do
|
flip PS.runSqlPool pool $ do
|
||||||
select $ do
|
select $ do
|
||||||
n2 <- from $ table @WalletOrchNote
|
(txs :& oNotes) <-
|
||||||
where_ (n2 ^. WalletOrchNoteAccId ==. val za)
|
from $ table @WalletTransaction `innerJoin` table @WalletOrchNote `on`
|
||||||
where_ (n2 ^. WalletOrchNoteSpent ==. val False)
|
(\(txs :& oNotes) ->
|
||||||
pure n2
|
txs ^. WalletTransactionId ==. oNotes ^. WalletOrchNoteTx)
|
||||||
|
where_ (oNotes ^. WalletOrchNoteAccId ==. val za)
|
||||||
|
where_ (oNotes ^. WalletOrchNoteSpent ==. val False)
|
||||||
|
where_
|
||||||
|
((oNotes ^. WalletOrchNoteChange ==. val True &&. txs ^.
|
||||||
|
WalletTransactionConf >=.
|
||||||
|
val 3) ||.
|
||||||
|
(oNotes ^. WalletOrchNoteChange ==. val False &&. txs ^.
|
||||||
|
WalletTransactionConf >=.
|
||||||
|
val 10))
|
||||||
|
pure oNotes
|
||||||
|
|
||||||
|
getWalletUnspentUnconfirmedOrchNotes ::
|
||||||
|
ConnectionPool -> ZcashAccountId -> IO [Entity WalletOrchNote]
|
||||||
|
getWalletUnspentUnconfirmedOrchNotes pool za = do
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
select $ do
|
||||||
|
(txs :& oNotes) <-
|
||||||
|
from $ table @WalletTransaction `innerJoin` table @WalletOrchNote `on`
|
||||||
|
(\(txs :& oNotes) ->
|
||||||
|
txs ^. WalletTransactionId ==. oNotes ^. WalletOrchNoteTx)
|
||||||
|
where_ (oNotes ^. WalletOrchNoteAccId ==. val za)
|
||||||
|
where_ (oNotes ^. WalletOrchNoteSpent ==. val False)
|
||||||
|
where_
|
||||||
|
((oNotes ^. WalletOrchNoteChange ==. val True &&. txs ^.
|
||||||
|
WalletTransactionConf <.
|
||||||
|
val 3) ||.
|
||||||
|
(oNotes ^. WalletOrchNoteChange ==. val False &&. txs ^.
|
||||||
|
WalletTransactionConf <.
|
||||||
|
val 10))
|
||||||
|
pure oNotes
|
||||||
|
|
||||||
selectUnspentNotes ::
|
selectUnspentNotes ::
|
||||||
ConnectionPool
|
ConnectionPool
|
||||||
|
@ -1462,10 +1646,81 @@ getWalletTxId pool wId = do
|
||||||
where_ (wtx ^. WalletTransactionId ==. val wId)
|
where_ (wtx ^. WalletTransactionId ==. val wId)
|
||||||
pure $ wtx ^. WalletTransactionTxId
|
pure $ wtx ^. WalletTransactionTxId
|
||||||
|
|
||||||
|
getUnconfirmedBlocks :: ConnectionPool -> IO [Int]
|
||||||
|
getUnconfirmedBlocks pool = do
|
||||||
|
r <-
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
select $ do
|
||||||
|
wtx <- from $ table @WalletTransaction
|
||||||
|
where_ (wtx ^. WalletTransactionConf <=. val 10)
|
||||||
|
pure $ wtx ^. WalletTransactionBlock
|
||||||
|
return $ map (\(Value i) -> i) r
|
||||||
|
|
||||||
|
saveConfs :: ConnectionPool -> Int -> Int -> IO ()
|
||||||
|
saveConfs pool b c = do
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
update $ \t -> do
|
||||||
|
set t [WalletTransactionConf =. val c]
|
||||||
|
where_ $ t ^. WalletTransactionBlock ==. val b
|
||||||
|
|
||||||
-- | Helper function to extract a Unified Address from the database
|
-- | Helper function to extract a Unified Address from the database
|
||||||
readUnifiedAddressDB :: WalletAddress -> Maybe UnifiedAddress
|
readUnifiedAddressDB :: WalletAddress -> Maybe UnifiedAddress
|
||||||
readUnifiedAddressDB =
|
readUnifiedAddressDB =
|
||||||
isValidUnifiedAddress . TE.encodeUtf8 . getUA . walletAddressUAddress
|
isValidUnifiedAddress . TE.encodeUtf8 . getUA . walletAddressUAddress
|
||||||
|
|
||||||
|
-- | Get list of external zcash addresses from database
|
||||||
|
getAdrBook :: ConnectionPool -> ZcashNet -> IO [Entity AddressBook]
|
||||||
|
getAdrBook pool n =
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
select $ do
|
||||||
|
adrbook <- from $ table @AddressBook
|
||||||
|
where_ (adrbook ^. AddressBookNetwork ==. val (ZcashNetDB n))
|
||||||
|
pure adrbook
|
||||||
|
|
||||||
|
-- | Save a new address into AddressBook
|
||||||
|
saveAdrsInAdrBook ::
|
||||||
|
ConnectionPool -- ^ The database path to use
|
||||||
|
-> AddressBook -- ^ The address to add to the database
|
||||||
|
-> IO (Maybe (Entity AddressBook))
|
||||||
|
saveAdrsInAdrBook pool a =
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $ flip PS.runSqlPool pool $ insertUniqueEntity a
|
||||||
|
|
||||||
|
-- | Update an existing address into AddressBook
|
||||||
|
updateAdrsInAdrBook :: ConnectionPool -> T.Text -> T.Text -> T.Text -> IO ()
|
||||||
|
updateAdrsInAdrBook pool d a ia = do
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
update $ \ab -> do
|
||||||
|
set ab [AddressBookAbdescrip =. val d, AddressBookAbaddress =. val a]
|
||||||
|
where_ $ ab ^. AddressBookAbaddress ==. val ia
|
||||||
|
|
||||||
|
-- | Get one AddrssBook record using the Address as a key
|
||||||
|
-- getABookRec :: ConnectionPool -> T.Tex t -> IO (Maybe (Entity AddressBook))
|
||||||
|
-- getABookRec pool a = do
|
||||||
|
-- runNoLoggingT $
|
||||||
|
-- PS.retryOnBusy $
|
||||||
|
-- flip PS.runSqlPool pool $
|
||||||
|
-- select $ do
|
||||||
|
-- adrbook <- from $ table @AddressBook
|
||||||
|
-- where_ ((adrbook ^. AddressBookAbaddress) ==. val a)
|
||||||
|
-- return adrbook
|
||||||
|
-- | delete an existing address from AddressBook
|
||||||
|
deleteAdrsFromAB :: ConnectionPool -> T.Text -> IO ()
|
||||||
|
deleteAdrsFromAB pool ia = do
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
delete $ do
|
||||||
|
ab <- from $ table @AddressBook
|
||||||
|
where_ (ab ^. AddressBookAbaddress ==. val ia)
|
||||||
|
|
||||||
rmdups :: Ord a => [a] -> [a]
|
rmdups :: Ord a => [a] -> [a]
|
||||||
rmdups = map head . group . sort
|
rmdups = map head . group . sort
|
||||||
|
|
1414
src/Zenith/GUI.hs
Normal file
1414
src/Zenith/GUI.hs
Normal file
File diff suppressed because it is too large
Load diff
340
src/Zenith/GUI/Theme.hs
Normal file
340
src/Zenith/GUI/Theme.hs
Normal file
|
@ -0,0 +1,340 @@
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
|
module Zenith.GUI.Theme
|
||||||
|
( zenithTheme
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Data.Default
|
||||||
|
import Lens.Micro ((&), (+~), (.~), (?~), (^.), at, set)
|
||||||
|
import Monomer
|
||||||
|
import Monomer.Core.Themes.BaseTheme
|
||||||
|
import Monomer.Core.Themes.SampleThemes
|
||||||
|
import Monomer.Graphics (rgbHex, transparent)
|
||||||
|
import Monomer.Graphics.ColorTable
|
||||||
|
import qualified Monomer.Lens as L
|
||||||
|
|
||||||
|
baseTextStyle :: TextStyle
|
||||||
|
baseTextStyle = def & L.fontSize ?~ FontSize 10 & L.fontColor ?~ black
|
||||||
|
|
||||||
|
hiliteTextStyle :: TextStyle
|
||||||
|
hiliteTextStyle = def & L.fontSize ?~ FontSize 10 & L.fontColor ?~ white
|
||||||
|
|
||||||
|
zenithTheme :: Theme
|
||||||
|
zenithTheme =
|
||||||
|
baseTheme zgoThemeColors & L.basic . L.labelStyle . L.text ?~ baseTextStyle &
|
||||||
|
L.hover .
|
||||||
|
L.tooltipStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.hover .
|
||||||
|
L.labelStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.basic .
|
||||||
|
L.dialogTitleStyle . L.text ?~
|
||||||
|
(baseTextStyle & L.fontSize ?~ FontSize 12 & L.font ?~ "Bold") &
|
||||||
|
L.hover .
|
||||||
|
L.dialogTitleStyle . L.text ?~
|
||||||
|
(baseTextStyle & L.fontSize ?~ FontSize 12 & L.font ?~ "Bold") &
|
||||||
|
L.basic .
|
||||||
|
L.btnStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.hover .
|
||||||
|
L.btnStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focus .
|
||||||
|
L.btnStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focusHover .
|
||||||
|
L.btnStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.active .
|
||||||
|
L.btnStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.basic .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.hover .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.focus .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.focusHover .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.active .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.disabled .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.disabled .
|
||||||
|
L.btnMainStyle . L.bgColor ?~
|
||||||
|
gray07c &
|
||||||
|
L.basic .
|
||||||
|
L.textFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.hover .
|
||||||
|
L.textFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focus .
|
||||||
|
L.textFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.active .
|
||||||
|
L.textFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focusHover .
|
||||||
|
L.textFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.basic .
|
||||||
|
L.numericFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.hover .
|
||||||
|
L.numericFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focus .
|
||||||
|
L.numericFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.active .
|
||||||
|
L.numericFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focusHover .
|
||||||
|
L.numericFieldStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.basic .
|
||||||
|
L.textAreaStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.hover .
|
||||||
|
L.textAreaStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focus .
|
||||||
|
L.textAreaStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.active .
|
||||||
|
L.textAreaStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focusHover .
|
||||||
|
L.textAreaStyle . L.text ?~
|
||||||
|
baseTextStyle
|
||||||
|
|
||||||
|
zenithThemeColors :: BaseThemeColors
|
||||||
|
zenithThemeColors =
|
||||||
|
BaseThemeColors
|
||||||
|
{ clearColor = gray01
|
||||||
|
, sectionColor = gray01
|
||||||
|
, btnFocusBorder = blue09
|
||||||
|
, btnBgBasic = gray07b
|
||||||
|
, btnBgHover = gray08
|
||||||
|
, btnBgFocus = gray07c
|
||||||
|
, btnBgActive = gray06
|
||||||
|
, btnBgDisabled = gray05
|
||||||
|
, btnText = gray02
|
||||||
|
, btnTextDisabled = gray01
|
||||||
|
, btnMainFocusBorder = blue08
|
||||||
|
, btnMainBgBasic = btnColor
|
||||||
|
, btnMainBgHover = btnHiLite
|
||||||
|
, btnMainBgFocus = btnColor
|
||||||
|
, btnMainBgActive = btnHiLite
|
||||||
|
, btnMainBgDisabled = blue04
|
||||||
|
, btnMainText = white
|
||||||
|
, btnMainTextDisabled = gray08
|
||||||
|
, dialogBg = gray01
|
||||||
|
, dialogBorder = gray01
|
||||||
|
, dialogText = white
|
||||||
|
, dialogTitleText = white
|
||||||
|
, emptyOverlay = gray05 & L.a .~ 0.8
|
||||||
|
, shadow = gray00 & L.a .~ 0.33
|
||||||
|
, externalLinkBasic = blue07
|
||||||
|
, externalLinkHover = blue08
|
||||||
|
, externalLinkFocus = blue07
|
||||||
|
, externalLinkActive = blue06
|
||||||
|
, externalLinkDisabled = gray06
|
||||||
|
, iconBg = gray08
|
||||||
|
, iconFg = gray01
|
||||||
|
, inputIconFg = black
|
||||||
|
, inputBorder = gray02
|
||||||
|
, inputFocusBorder = blue08
|
||||||
|
, inputBgBasic = gray04
|
||||||
|
, inputBgHover = gray06
|
||||||
|
, inputBgFocus = gray05
|
||||||
|
, inputBgActive = gray03
|
||||||
|
, inputBgDisabled = gray07
|
||||||
|
, inputFgBasic = gray06
|
||||||
|
, inputFgHover = blue08
|
||||||
|
, inputFgFocus = blue08
|
||||||
|
, inputFgActive = blue07
|
||||||
|
, inputFgDisabled = gray07
|
||||||
|
, inputSndBasic = gray05
|
||||||
|
, inputSndHover = gray06
|
||||||
|
, inputSndFocus = gray05
|
||||||
|
, inputSndActive = gray05
|
||||||
|
, inputSndDisabled = gray03
|
||||||
|
, inputHlBasic = gray07
|
||||||
|
, inputHlHover = blue08
|
||||||
|
, inputHlFocus = blue08
|
||||||
|
, inputHlActive = blue08
|
||||||
|
, inputHlDisabled = gray08
|
||||||
|
, inputSelBasic = gray06
|
||||||
|
, inputSelFocus = blue06
|
||||||
|
, inputText = white
|
||||||
|
, inputTextDisabled = gray02
|
||||||
|
, labelText = white
|
||||||
|
, scrollBarBasic = gray01 & L.a .~ 0.2
|
||||||
|
, scrollThumbBasic = gray07 & L.a .~ 0.6
|
||||||
|
, scrollBarHover = gray01 & L.a .~ 0.4
|
||||||
|
, scrollThumbHover = gray07 & L.a .~ 0.8
|
||||||
|
, slMainBg = gray00
|
||||||
|
, slNormalBgBasic = transparent
|
||||||
|
, slNormalBgHover = gray05
|
||||||
|
, slNormalText = white
|
||||||
|
, slNormalFocusBorder = blue08
|
||||||
|
, slSelectedBgBasic = gray04
|
||||||
|
, slSelectedBgHover = gray05
|
||||||
|
, slSelectedText = white
|
||||||
|
, slSelectedFocusBorder = blue08
|
||||||
|
, tooltipBorder = gray05
|
||||||
|
, tooltipBg = rgbHex "#1D212B"
|
||||||
|
, tooltipText = white
|
||||||
|
}
|
||||||
|
|
||||||
|
zgoThemeColors =
|
||||||
|
BaseThemeColors
|
||||||
|
{ clearColor = gray10 -- gray12,
|
||||||
|
, sectionColor = gray09 -- gray11,
|
||||||
|
, btnFocusBorder = blue08
|
||||||
|
, btnBgBasic = gray07
|
||||||
|
, btnBgHover = gray07c
|
||||||
|
, btnBgFocus = gray07b
|
||||||
|
, btnBgActive = gray06
|
||||||
|
, btnBgDisabled = gray05
|
||||||
|
, btnText = gray02
|
||||||
|
, btnTextDisabled = gray02
|
||||||
|
, btnMainFocusBorder = blue09
|
||||||
|
, btnMainBgBasic = btnColor
|
||||||
|
, btnMainBgHover = btnHiLite
|
||||||
|
, btnMainBgFocus = btnColor
|
||||||
|
, btnMainBgActive = btnHiLite
|
||||||
|
, btnMainBgDisabled = blue04
|
||||||
|
, btnMainText = white
|
||||||
|
, btnMainTextDisabled = white
|
||||||
|
, dialogBg = white
|
||||||
|
, dialogBorder = white
|
||||||
|
, dialogText = black
|
||||||
|
, dialogTitleText = black
|
||||||
|
, emptyOverlay = gray07 & L.a .~ 0.8
|
||||||
|
, shadow = gray00 & L.a .~ 0.2
|
||||||
|
, externalLinkBasic = blue07
|
||||||
|
, externalLinkHover = blue08
|
||||||
|
, externalLinkFocus = blue07
|
||||||
|
, externalLinkActive = blue06
|
||||||
|
, externalLinkDisabled = gray06
|
||||||
|
, iconBg = gray07
|
||||||
|
, iconFg = gray01
|
||||||
|
, inputIconFg = black
|
||||||
|
, inputBorder = gray06
|
||||||
|
, inputFocusBorder = blue07
|
||||||
|
, inputBgBasic = gray10
|
||||||
|
, inputBgHover = white
|
||||||
|
, inputBgFocus = white
|
||||||
|
, inputBgActive = gray09
|
||||||
|
, inputBgDisabled = gray05
|
||||||
|
, inputFgBasic = gray05
|
||||||
|
, inputFgHover = blue07
|
||||||
|
, inputFgFocus = blue07
|
||||||
|
, inputFgActive = blue06
|
||||||
|
, inputFgDisabled = gray04
|
||||||
|
, inputSndBasic = gray04
|
||||||
|
, inputSndHover = gray05
|
||||||
|
, inputSndFocus = gray05
|
||||||
|
, inputSndActive = gray04
|
||||||
|
, inputSndDisabled = gray03
|
||||||
|
, inputHlBasic = gray06
|
||||||
|
, inputHlHover = blue07
|
||||||
|
, inputHlFocus = blue07
|
||||||
|
, inputHlActive = blue06
|
||||||
|
, inputHlDisabled = gray05
|
||||||
|
, inputSelBasic = gray07
|
||||||
|
, inputSelFocus = blue08
|
||||||
|
, inputText = black
|
||||||
|
, inputTextDisabled = gray02
|
||||||
|
, labelText = black
|
||||||
|
, scrollBarBasic = gray03 & L.a .~ 0.2
|
||||||
|
, scrollThumbBasic = gray01 & L.a .~ 0.2
|
||||||
|
, scrollBarHover = gray07 & L.a .~ 0.8
|
||||||
|
, scrollThumbHover = gray05 & L.a .~ 0.8
|
||||||
|
, slMainBg = white
|
||||||
|
, slNormalBgBasic = transparent
|
||||||
|
, slNormalBgHover = gray09
|
||||||
|
, slNormalText = black
|
||||||
|
, slNormalFocusBorder = blue07
|
||||||
|
, slSelectedBgBasic = gray08
|
||||||
|
, slSelectedBgHover = gray09
|
||||||
|
, slSelectedText = black
|
||||||
|
, slSelectedFocusBorder = blue07
|
||||||
|
, tooltipBorder = gray08
|
||||||
|
, tooltipBg = gray07
|
||||||
|
, tooltipText = black
|
||||||
|
}
|
||||||
|
|
||||||
|
--black = rgbHex "#000000"
|
||||||
|
{-white = rgbHex "#FFFFFF"-}
|
||||||
|
btnColor = rgbHex "#ff5722" --rgbHex "#1818B2"
|
||||||
|
|
||||||
|
btnHiLite = rgbHex "#207DE8"
|
||||||
|
|
||||||
|
blue01 = rgbHex "#002159"
|
||||||
|
|
||||||
|
blue02 = rgbHex "#01337D"
|
||||||
|
|
||||||
|
blue03 = rgbHex "#03449E"
|
||||||
|
|
||||||
|
blue04 = rgbHex "#0552B5"
|
||||||
|
|
||||||
|
blue05 = rgbHex "#0967D2"
|
||||||
|
|
||||||
|
blue05b = rgbHex "#0F6BD7"
|
||||||
|
|
||||||
|
blue05c = rgbHex "#1673DE"
|
||||||
|
|
||||||
|
blue06 = rgbHex "#2186EB"
|
||||||
|
|
||||||
|
blue06b = rgbHex "#2489EE"
|
||||||
|
|
||||||
|
blue06c = rgbHex "#2B8FF6"
|
||||||
|
|
||||||
|
blue07 = rgbHex "#47A3F3"
|
||||||
|
|
||||||
|
blue07b = rgbHex "#50A6F6"
|
||||||
|
|
||||||
|
blue07c = rgbHex "#57ACFC"
|
||||||
|
|
||||||
|
blue08 = rgbHex "#7CC4FA"
|
||||||
|
|
||||||
|
blue09 = rgbHex "#BAE3FF"
|
||||||
|
|
||||||
|
blue10 = rgbHex "#E6F6FF"
|
||||||
|
|
||||||
|
gray00 = rgbHex "#111111"
|
||||||
|
|
||||||
|
gray01 = rgbHex "#2E2E2E"
|
||||||
|
|
||||||
|
gray02 = rgbHex "#393939"
|
||||||
|
|
||||||
|
gray03 = rgbHex "#515151"
|
||||||
|
|
||||||
|
gray04 = rgbHex "#626262"
|
||||||
|
|
||||||
|
gray05 = rgbHex "#7E7E7E"
|
||||||
|
|
||||||
|
gray06 = rgbHex "#9E9E9E"
|
||||||
|
|
||||||
|
gray07 = rgbHex "#B1B1B1"
|
||||||
|
|
||||||
|
gray07b = rgbHex "#B4B4B4"
|
||||||
|
|
||||||
|
gray07c = rgbHex "#BBBBBB"
|
||||||
|
|
||||||
|
gray08 = rgbHex "#CFCFCF"
|
||||||
|
|
||||||
|
gray09 = rgbHex "#E1E1E1"
|
||||||
|
|
||||||
|
gray10 = rgbHex "#F7F7F7"
|
|
@ -33,7 +33,13 @@ import ZcashHaskell.Types
|
||||||
)
|
)
|
||||||
import ZcashHaskell.Utils (getBlockTime, makeZebraCall, readZebraTransaction)
|
import ZcashHaskell.Utils (getBlockTime, makeZebraCall, readZebraTransaction)
|
||||||
import Zenith.Core (checkBlockChain)
|
import Zenith.Core (checkBlockChain)
|
||||||
import Zenith.DB (getMaxBlock, initDb, saveTransaction)
|
import Zenith.DB
|
||||||
|
( getMaxBlock
|
||||||
|
, getUnconfirmedBlocks
|
||||||
|
, initDb
|
||||||
|
, saveConfs
|
||||||
|
, saveTransaction
|
||||||
|
)
|
||||||
import Zenith.Utils (jsonNumber)
|
import Zenith.Utils (jsonNumber)
|
||||||
|
|
||||||
-- | Function to scan the Zcash blockchain through the Zebra node and populate the Zenith database
|
-- | Function to scan the Zcash blockchain through the Zebra node and populate the Zenith database
|
||||||
|
@ -155,3 +161,26 @@ processTx host port bt pool t = do
|
||||||
(fromRawSBundle $ zt_sBundle rzt)
|
(fromRawSBundle $ zt_sBundle rzt)
|
||||||
(fromRawOBundle $ zt_oBundle rzt)
|
(fromRawOBundle $ zt_oBundle rzt)
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
|
-- | Function to update unconfirmed transactions
|
||||||
|
updateConfs ::
|
||||||
|
T.Text -- ^ Host name for `zebrad`
|
||||||
|
-> Int -- ^ Port for `zebrad`
|
||||||
|
-> ConnectionPool
|
||||||
|
-> IO ()
|
||||||
|
updateConfs host port pool = do
|
||||||
|
targetBlocks <- getUnconfirmedBlocks pool
|
||||||
|
mapM_ updateTx targetBlocks
|
||||||
|
where
|
||||||
|
updateTx :: Int -> IO ()
|
||||||
|
updateTx b = do
|
||||||
|
r <-
|
||||||
|
makeZebraCall
|
||||||
|
host
|
||||||
|
port
|
||||||
|
"getblock"
|
||||||
|
[Data.Aeson.String $ T.pack $ show b, jsonNumber 1]
|
||||||
|
case r of
|
||||||
|
Left e -> throwIO $ userError e
|
||||||
|
Right blk -> do
|
||||||
|
saveConfs pool b $ fromInteger $ bl_confirmations blk
|
||||||
|
|
|
@ -143,7 +143,9 @@ data ZcashPool
|
||||||
| Sprout
|
| Sprout
|
||||||
| Sapling
|
| Sapling
|
||||||
| Orchard
|
| Orchard
|
||||||
deriving (Show, Eq, Generic, ToJSON)
|
deriving (Show, Read, Eq, Generic, ToJSON)
|
||||||
|
|
||||||
|
derivePersistField "ZcashPool"
|
||||||
|
|
||||||
instance FromJSON ZcashPool where
|
instance FromJSON ZcashPool where
|
||||||
parseJSON =
|
parseJSON =
|
||||||
|
|
|
@ -5,13 +5,24 @@ module Zenith.Utils where
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Functor (void)
|
import Data.Functor (void)
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Data.Ord (clamp)
|
||||||
import Data.Scientific (Scientific(..), scientific)
|
import Data.Scientific (Scientific(..), scientific)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.Text.Encoding as E
|
import qualified Data.Text.Encoding as E
|
||||||
import System.Process (createProcess_, shell)
|
import System.Process (createProcess_, shell)
|
||||||
import Text.Regex.Posix
|
import Text.Regex.Posix
|
||||||
import ZcashHaskell.Orchard (encodeUnifiedAddress, isValidUnifiedAddress)
|
import ZcashHaskell.Orchard (encodeUnifiedAddress, isValidUnifiedAddress)
|
||||||
import ZcashHaskell.Sapling (isValidShieldedAddress)
|
import ZcashHaskell.Sapling (decodeSaplingAddress, isValidShieldedAddress)
|
||||||
|
import ZcashHaskell.Transparent
|
||||||
|
( decodeExchangeAddress
|
||||||
|
, decodeTransparentAddress
|
||||||
|
)
|
||||||
|
import ZcashHaskell.Types
|
||||||
|
( SaplingAddress(..)
|
||||||
|
, TransparentAddress(..)
|
||||||
|
, UnifiedAddress(..)
|
||||||
|
, ZcashNet(..)
|
||||||
|
)
|
||||||
import Zenith.Types
|
import Zenith.Types
|
||||||
( AddressGroup(..)
|
( AddressGroup(..)
|
||||||
, UnifiedAddressDB(..)
|
, UnifiedAddressDB(..)
|
||||||
|
@ -26,18 +37,24 @@ jsonNumber i = Number $ scientific (fromIntegral i) 0
|
||||||
-- | Helper function to display small amounts of ZEC
|
-- | Helper function to display small amounts of ZEC
|
||||||
displayZec :: Integer -> String
|
displayZec :: Integer -> String
|
||||||
displayZec s
|
displayZec s
|
||||||
| abs s < 100 = show s ++ " zats "
|
| abs s < 100 = show s ++ " zats"
|
||||||
| abs s < 100000 = show (fromIntegral s / 100) ++ " μZEC "
|
| abs s < 100000 = show (fromIntegral s / 100) ++ " μZEC"
|
||||||
| abs s < 100000000 = show (fromIntegral s / 100000) ++ " mZEC "
|
| abs s < 100000000 = show (fromIntegral s / 100000) ++ " mZEC"
|
||||||
| otherwise = show (fromIntegral s / 100000000) ++ " ZEC "
|
| otherwise = show (fromIntegral s / 100000000) ++ " ZEC "
|
||||||
|
|
||||||
-- | Helper function to display small amounts of ZEC
|
-- | Helper function to display small amounts of ZEC
|
||||||
displayTaz :: Integer -> String
|
displayTaz :: Integer -> String
|
||||||
displayTaz s
|
displayTaz s
|
||||||
| abs s < 100 = show s ++ " tazs "
|
| abs s < 100 = show s ++ " tazs"
|
||||||
| abs s < 100000 = show (fromIntegral s / 100) ++ " μTAZ "
|
| abs s < 100000 = show (fromIntegral s / 100) ++ " μTAZ"
|
||||||
| abs s < 100000000 = show (fromIntegral s / 100000) ++ " mTAZ "
|
| abs s < 100000000 = show (fromIntegral s / 100000) ++ " mTAZ"
|
||||||
| otherwise = show (fromIntegral s / 100000000) ++ " TAZ "
|
| otherwise = show (fromIntegral s / 100000000) ++ " TAZ"
|
||||||
|
|
||||||
|
displayAmount :: ZcashNet -> Integer -> T.Text
|
||||||
|
displayAmount n a =
|
||||||
|
if n == MainNet
|
||||||
|
then T.pack $ displayZec a
|
||||||
|
else T.pack $ displayTaz a
|
||||||
|
|
||||||
-- | Helper function to display abbreviated Unified Address
|
-- | Helper function to display abbreviated Unified Address
|
||||||
showAddress :: UnifiedAddressDB -> T.Text
|
showAddress :: UnifiedAddressDB -> T.Text
|
||||||
|
@ -72,3 +89,34 @@ copyAddress a =
|
||||||
void $
|
void $
|
||||||
createProcess_ "toClipboard" $
|
createProcess_ "toClipboard" $
|
||||||
shell $ "echo " ++ T.unpack (addy a) ++ " | xclip -r -selection clipboard"
|
shell $ "echo " ++ T.unpack (addy a) ++ " | xclip -r -selection clipboard"
|
||||||
|
|
||||||
|
-- | Bound a value to the 0..1 range, used for progress reporting on UIs
|
||||||
|
validBarValue :: Float -> Float
|
||||||
|
validBarValue = clamp (0, 1)
|
||||||
|
|
||||||
|
isRecipientValid :: T.Text -> Bool
|
||||||
|
isRecipientValid a =
|
||||||
|
case isValidUnifiedAddress (E.encodeUtf8 a) of
|
||||||
|
Just _a1 -> True
|
||||||
|
Nothing ->
|
||||||
|
isValidShieldedAddress (E.encodeUtf8 a) ||
|
||||||
|
(case decodeTransparentAddress (E.encodeUtf8 a) of
|
||||||
|
Just _a3 -> True
|
||||||
|
Nothing ->
|
||||||
|
case decodeExchangeAddress a of
|
||||||
|
Just _a4 -> True
|
||||||
|
Nothing -> False)
|
||||||
|
|
||||||
|
parseAddress :: T.Text -> ZcashNet -> Maybe UnifiedAddress
|
||||||
|
parseAddress a znet =
|
||||||
|
case isValidUnifiedAddress (E.encodeUtf8 a) of
|
||||||
|
Just a1 -> Just a1
|
||||||
|
Nothing ->
|
||||||
|
case decodeSaplingAddress (E.encodeUtf8 a) of
|
||||||
|
Just a2 ->
|
||||||
|
Just $ UnifiedAddress znet Nothing (Just $ sa_receiver a2) Nothing
|
||||||
|
Nothing ->
|
||||||
|
case decodeTransparentAddress (E.encodeUtf8 a) of
|
||||||
|
Just a3 ->
|
||||||
|
Just $ UnifiedAddress znet Nothing Nothing (Just $ ta_receiver a3)
|
||||||
|
Nothing -> Nothing
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9dddb42bb3ab78ed0c4d44efb00960ac112c2ce6
|
Subproject commit e8074419cfb54559a4c09731ad2448d5930869a2
|
16
zenith.cabal
16
zenith.cabal
|
@ -1,6 +1,6 @@
|
||||||
cabal-version: 3.0
|
cabal-version: 3.0
|
||||||
name: zenith
|
name: zenith
|
||||||
version: 0.5.1.0-beta
|
version: 0.6.0.0-beta
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Rene Vergara
|
author: Rene Vergara
|
||||||
|
@ -27,6 +27,8 @@ library
|
||||||
ghc-options: -Wall -Wunused-imports
|
ghc-options: -Wall -Wunused-imports
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
Zenith.CLI
|
Zenith.CLI
|
||||||
|
Zenith.GUI
|
||||||
|
Zenith.GUI.Theme
|
||||||
Zenith.Core
|
Zenith.Core
|
||||||
Zenith.DB
|
Zenith.DB
|
||||||
Zenith.Types
|
Zenith.Types
|
||||||
|
@ -44,13 +46,16 @@ library
|
||||||
, base64-bytestring
|
, base64-bytestring
|
||||||
, brick
|
, brick
|
||||||
, bytestring
|
, bytestring
|
||||||
|
, data-default
|
||||||
|
, directory
|
||||||
|
, filepath
|
||||||
, esqueleto
|
, esqueleto
|
||||||
, resource-pool
|
, resource-pool
|
||||||
, binary
|
, binary
|
||||||
, exceptions
|
, exceptions
|
||||||
, monad-logger
|
, monad-logger
|
||||||
, vty-crossplatform
|
, vty-crossplatform
|
||||||
, secp256k1-haskell
|
, secp256k1-haskell >= 1
|
||||||
, pureMD5
|
, pureMD5
|
||||||
, ghc
|
, ghc
|
||||||
, haskoin-core
|
, haskoin-core
|
||||||
|
@ -58,9 +63,13 @@ library
|
||||||
, http-client
|
, http-client
|
||||||
, http-conduit
|
, http-conduit
|
||||||
, http-types
|
, http-types
|
||||||
|
, JuicyPixels
|
||||||
|
, qrcode-core
|
||||||
|
, qrcode-juicypixels
|
||||||
, microlens
|
, microlens
|
||||||
, microlens-mtl
|
, microlens-mtl
|
||||||
, microlens-th
|
, microlens-th
|
||||||
|
, monomer
|
||||||
, mtl
|
, mtl
|
||||||
, persistent
|
, persistent
|
||||||
, Hclip
|
, Hclip
|
||||||
|
@ -72,6 +81,7 @@ library
|
||||||
, regex-posix
|
, regex-posix
|
||||||
, scientific
|
, scientific
|
||||||
, text
|
, text
|
||||||
|
, text-show
|
||||||
, time
|
, time
|
||||||
, vector
|
, vector
|
||||||
, vty
|
, vty
|
||||||
|
@ -92,7 +102,7 @@ executable zenith
|
||||||
, configurator
|
, configurator
|
||||||
, data-default
|
, data-default
|
||||||
, sort
|
, sort
|
||||||
, structured-cli
|
--, structured-cli
|
||||||
, text
|
, text
|
||||||
, time
|
, time
|
||||||
, zenith
|
, zenith
|
||||||
|
|
BIN
zenith_er.bmp
Normal file
BIN
zenith_er.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 MiB |
BIN
zenith_er.png
Normal file
BIN
zenith_er.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 329 KiB |
Loading…
Reference in a new issue