Check for accounts during startup

This commit is contained in:
Rene Vergara 2024-02-29 15:02:58 -06:00
parent 0de5dc4f9c
commit 52d3297fae
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -60,6 +60,7 @@ import Zenith.DB
data Name data Name
= WList = WList
| AList | AList
| AcList
| TList | TList
| HelpDialog | HelpDialog
| DialogInputField | DialogInputField
@ -79,6 +80,7 @@ data DialogType
data State = State data State = State
{ _network :: !String { _network :: !String
, _wallets :: !(L.List Name (Entity ZcashWallet)) , _wallets :: !(L.List Name (Entity ZcashWallet))
, _accounts :: !(L.List Name (Entity ZcashAccount))
, _addresses :: !(L.List Name String) , _addresses :: !(L.List Name String)
, _transactions :: !(L.List Name String) , _transactions :: !(L.List Name String)
, _msg :: !String , _msg :: !String
@ -286,11 +288,16 @@ runZenithCLI host port dbFilePath = do
Just chainInfo -> do Just chainInfo -> do
initDb dbFilePath initDb dbFilePath
walList <- getWallets dbFilePath $ zgb_net chainInfo walList <- getWallets dbFilePath $ zgb_net chainInfo
accList <-
if not (null walList)
then getAccounts dbFilePath $ entityKey $ head walList
else return []
void $ void $
M.defaultMain theApp $ M.defaultMain theApp $
State State
((show . zgb_net) chainInfo) ((show . zgb_net) chainInfo)
(L.list WList (Vec.fromList walList) 1) (L.list WList (Vec.fromList walList) 1)
(L.list AcList (Vec.fromList accList) 0)
(L.list AList (Vec.fromList ["addr1", "addr2"]) 1) (L.list AList (Vec.fromList ["addr1", "addr2"]) 1)
(L.list TList (Vec.fromList ["tx1", "tx2", "tx3"]) 1) (L.list TList (Vec.fromList ["tx1", "tx2", "tx3"]) 1)
("Start up Ok! Connected to Zebra " ++ ("Start up Ok! Connected to Zebra " ++