diff --git a/.gitmodules b/.gitmodules index 601b93a..78223e1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,3 @@ [submodule "zcash-haskell"] path = zcash-haskell - url = https://git.vergara.tech/Vergara_Tech/zcash-haskell.git - branch = master + url = https://code.vergara.tech/Vergara_Tech/zcash-haskell diff --git a/CHANGELOG.md b/CHANGELOG.md index 30d4a3d..212694a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.7.2.0-beta] + +### Fixed + +- Creation of change addresses during account creation in GUI ([#111](https://code.vergara.tech/Vergara_Tech/zenith/issues/111)) + ## [0.7.1.0-beta] ### Changed diff --git a/cabal.project b/cabal.project index d245ac1..41a7b4b 100644 --- a/cabal.project +++ b/cabal.project @@ -6,10 +6,10 @@ with-compiler: ghc-9.6.5 source-repository-package type: git - location: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git + location: https://code.vergara.tech/Vergara_Tech/haskell-hexstring.git tag: 39d8da7b11a80269454c2f134a5c834e0f3cb9a7 source-repository-package type: git - location: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git + location: https://code.vergara.tech/Vergara_Tech/haskell-foreign-rust.git tag: 335e804454cd30da2c526457be37e477f71e4665 diff --git a/src/Zenith/CLI.hs b/src/Zenith/CLI.hs index 29157c1..b080003 100644 --- a/src/Zenith/CLI.hs +++ b/src/Zenith/CLI.hs @@ -530,7 +530,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s] (str " _____ _ _ _ \n|__ /___ _ __ (_) |_| |__\n / // _ \\ '_ \\| | __| '_ \\\n / /| __/ | | | | |_| | | |\n/____\\___|_| |_|_|\\__|_| |_|") <=> C.hCenter - (withAttr titleAttr (str "Zcash Wallet v0.7.1.0-beta")) <=> + (withAttr titleAttr (str "Zcash Wallet v0.7.2.0-beta")) <=> C.hCenter (withAttr blinkAttr $ str "Press any key...")) else emptyWidget capCommand3 :: String -> String -> String -> Widget Name diff --git a/src/Zenith/Core.hs b/src/Zenith/Core.hs index 5d26696..7c88f13 100644 --- a/src/Zenith/Core.hs +++ b/src/Zenith/Core.hs @@ -1142,7 +1142,7 @@ prepareTxV2 pool zebraHost zebraPort zn za bh pnotes policy = do makeOutgoing acc recvs chg pol = do let k = map (\(x, _, _, _) -> x) recvs let j = map (\(_, _, x, _) -> x) recvs - chgAddr <- runNoLoggingT $ getInternalAddresses pool $ entityKey acc + chgAddr <- getInternalAddresses pool $ entityKey acc let internalUA = getUA $ walletAddressUAddress $ entityVal $ head chgAddr case pol of Full -> @@ -1364,8 +1364,7 @@ syncWallet config w = do mapM (liftIO . runNoLoggingT . getAddresses pool . entityKey) accs logDebugN $ "addrs: " <> T.pack (show addrs) intAddrs <- - concat <$> - mapM (liftIO . runNoLoggingT . getInternalAddresses pool . entityKey) accs + concat <$> mapM (liftIO . getInternalAddresses pool . entityKey) accs chainTip <- liftIO $ getMaxBlock pool znet logDebugN $ "chain tip: " <> T.pack (show chainTip) lastBlock <- liftIO $ getLastSyncBlock pool $ entityKey w diff --git a/src/Zenith/DB.hs b/src/Zenith/DB.hs index 7de2015..275ecc1 100644 --- a/src/Zenith/DB.hs +++ b/src/Zenith/DB.hs @@ -648,8 +648,9 @@ getAddressById pool a = do getInternalAddresses :: ConnectionPool -- ^ The database path -> ZcashAccountId -- ^ The account ID to check - -> NoLoggingT IO [Entity WalletAddress] + -> IO [Entity WalletAddress] getInternalAddresses pool a = + runNoLoggingT $ PS.retryOnBusy $ flip PS.runSqlPool pool $ do select $ do @@ -1437,7 +1438,8 @@ getWalletTransactions :: -> NoLoggingT IO () getWalletTransactions pool w = do let w' = entityVal w - chgAddr <- getInternalAddresses pool $ walletAddressAccId $ entityVal w + chgAddr <- + liftIO $ getInternalAddresses pool $ walletAddressAccId $ entityVal w let ctReceiver = t_rec =<< readUnifiedAddressDB (entityVal $ head chgAddr) let csReceiver = s_rec =<< readUnifiedAddressDB (entityVal $ head chgAddr) let coReceiver = o_rec =<< readUnifiedAddressDB (entityVal $ head chgAddr) diff --git a/src/Zenith/GUI.hs b/src/Zenith/GUI.hs index a059b89..a91f239 100644 --- a/src/Zenith/GUI.hs +++ b/src/Zenith/GUI.hs @@ -89,6 +89,7 @@ data AppEvent | MenuClicked | NewClicked | NewAddress !(Maybe (Entity ZcashAccount)) + | NewInternalAddress !(Maybe (Entity ZcashAccount)) | NewAccount !(Maybe (Entity ZcashWallet)) | NewWallet | SetPool !ZcashPool @@ -102,6 +103,7 @@ data AppEvent | LoadAddrs ![Entity WalletAddress] | LoadAccs ![Entity ZcashAccount] | LoadWallets ![Entity ZcashWallet] + | CheckChange | ConfirmCancel | SaveAddress !(Maybe (Entity ZcashAccount)) | SaveAccount !(Maybe (Entity ZcashWallet)) @@ -1200,6 +1202,7 @@ handleEvent wenv node model evt = AccountClicked -> [Model $ model & accPopup .~ True] MenuClicked -> [Model $ model & menuPopup .~ True] NewClicked -> [Model $ model & newPopup .~ not (model ^. newPopup)] + NewInternalAddress acc -> [Task $ addNewAddress "Change" Internal acc] NewAddress acc -> [ Model $ model & confirmTitle ?~ "New Address" & confirmAccept .~ "Create" & @@ -1366,13 +1369,28 @@ handleEvent wenv node model evt = , Event $ ShowMsg "Copied transaction ID!" ] LoadTxs t -> [Model $ model & transactions .~ t] + CheckChange -> + [ Task $ do + case currentAccount of + Nothing -> return $ ShowError "No account available" + Just acc -> do + pool <- + runNoLoggingT $ initPool $ c_dbPath $ model ^. configuration + chgAddr <- getInternalAddresses pool $ entityKey acc + if not (null chgAddr) + then return $ SetPool OrchardPool + else return $ NewInternalAddress currentAccount + ] LoadAddrs a -> if not (null a) then [ Model $ model & addresses .~ a + , Event CheckChange , Event $ SwitchAddr $ model ^. selAddr , Event $ SetPool OrchardPool ] - else [Event $ NewAddress currentAccount] + else [ Event $ NewAddress currentAccount + , Event $ NewInternalAddress currentAccount + ] LoadAccs a -> if not (null a) then [Model $ model & accounts .~ a, Event $ SwitchAcc 0] @@ -1992,7 +2010,7 @@ runZenithGUI config = do Left _e -> print "Zebra not available" where params hd = - [ appWindowTitle "Zenith - Zcash Full Node Wallet - 0.7.1.0-beta" + [ appWindowTitle "Zenith - Zcash Full Node Wallet - 0.7.2.0-beta" , appWindowState $ MainWindowNormal (1000, 700) , appTheme zenithTheme , appFontDef diff --git a/zcash-haskell b/zcash-haskell index 7d3ae36..a28edcb 160000 --- a/zcash-haskell +++ b/zcash-haskell @@ -1 +1 @@ -Subproject commit 7d3ae36d2b48b8ed91a70e40a77fb7efe57765a0 +Subproject commit a28edcb5995667677e96a08c6952a568bfd6c51e diff --git a/zenith.cabal b/zenith.cabal index 8691137..be3f61a 100644 --- a/zenith.cabal +++ b/zenith.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: zenith -version: 0.7.1.0-beta +version: 0.7.2.0-beta license: MIT license-file: LICENSE author: Rene Vergara