Publish Zenith beta version #80

Merged
pitmutt merged 90 commits from dev041 into master 2024-05-09 19:15:41 +00:00
3 changed files with 21 additions and 10 deletions
Showing only changes of commit 0de5dc4f9c - Show all commits

View file

@ -212,9 +212,7 @@ appEvent (BT.VtyEvent e) = do
V.EvKey V.KEnter [] -> do
fs <- BT.zoom inputForm $ BT.gets formState
nw <- liftIO $ addNewWallet (fs ^. dialogInput) s
BT.modify $ set wallets nw
printMsg $
"Creating new wallet " <> T.unpack (fs ^. dialogInput)
BT.put nw
BT.modify $ set dialogBox Blank
ev -> BT.zoom inputForm $ handleFormEvent (BT.VtyEvent ev)
AName -> do
@ -311,12 +309,24 @@ runZenithCLI host port dbFilePath = do
"No Zebra node available on port " <>
show port <> ". Check your configuration"
addNewWallet ::
T.Text -> State -> IO (L.GenericList Name Vec.Vector (Entity ZcashWallet))
addNewWallet :: T.Text -> State -> IO State
addNewWallet n s = do
sP <- generateWalletSeedPhrase
let bH = s ^. startBlock
let netName = read $ s ^. network
_ <- saveWallet (s ^. dbPath) $ ZcashWallet sP bH n netName
r <- saveWallet (s ^. dbPath) $ ZcashWallet sP bH n netName
case r of
Nothing -> do
wL <- getWallets (s ^. dbPath) netName
return $ L.listReplace (Vec.fromList wL) (Just 0) $ s ^. wallets
return $
(s & wallets .~ L.listReplace (Vec.fromList wL) (Just 0) (s ^. wallets)) &
msg .~
"Wallet already exists: " ++
T.unpack n
Just _ -> do
wL <- getWallets (s ^. dbPath) netName
return $
(s & wallets .~ L.listReplace (Vec.fromList wL) (Just 0) (s ^. wallets)) &
msg .~
"Created new wallet: " ++
T.unpack n

View file

@ -24,8 +24,8 @@ initDb dbName = do
saveWallet ::
T.Text -- ^ The database path to use
-> ZcashWallet -- ^ The wallet to add to the database
-> IO ZcashWalletId
saveWallet dbFp w = runSqlite dbFp $ insert w
-> IO (Maybe (Entity ZcashWallet))
saveWallet dbFp w = runSqlite dbFp $ insertUniqueEntity w
-- | Returns a list of accounts associated with the given wallet
getAccounts ::

View file

@ -34,6 +34,7 @@ share
birthdayHeight Int
name T.Text
network ZcashNet
UniqueWallet name network
deriving Show
ZcashAccount
walletId ZcashWalletId