From 2e18cb039770728e59101f7875c038ddac3ec68a Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Mon, 6 Jan 2025 09:52:56 -0600 Subject: [PATCH 1/3] Remove old reference to zcash-haskell --- .gitmodules | 4 ---- zcash-haskell | 1 - 2 files changed, 5 deletions(-) delete mode 160000 zcash-haskell diff --git a/.gitmodules b/.gitmodules index 601b93a..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "zcash-haskell"] - path = zcash-haskell - url = https://git.vergara.tech/Vergara_Tech/zcash-haskell.git - branch = master diff --git a/zcash-haskell b/zcash-haskell deleted file mode 160000 index 4289a9d..0000000 --- a/zcash-haskell +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4289a9ded67ef2ca432abc412934fb5b8b59a9cf -- 2.43.0 From 6d6ef37668e6c902fd53dcbb166efff93bcedc8f Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Mon, 6 Jan 2025 09:54:03 -0600 Subject: [PATCH 2/3] Add new server for zcash-haskell --- .gitmodules | 3 +++ zcash-haskell | 1 + 2 files changed, 4 insertions(+) create mode 160000 zcash-haskell diff --git a/.gitmodules b/.gitmodules index e69de29..78223e1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "zcash-haskell"] + path = zcash-haskell + url = https://code.vergara.tech/Vergara_Tech/zcash-haskell diff --git a/zcash-haskell b/zcash-haskell new file mode 160000 index 0000000..a28edcb --- /dev/null +++ b/zcash-haskell @@ -0,0 +1 @@ +Subproject commit a28edcb5995667677e96a08c6952a568bfd6c51e -- 2.43.0 From 7accde3463b0e0de29cd2c3d3e21108787ba464b Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Wed, 8 Jan 2025 08:12:53 -0600 Subject: [PATCH 3/3] fix(gui): creation of change addresses Fixes #111 --- CHANGELOG.md | 6 ++++++ app/Server.hs | 2 +- cabal.project | 4 ++-- src/Zenith/CLI.hs | 2 +- src/Zenith/Core.hs | 7 +++---- src/Zenith/DB.hs | 6 ++++-- src/Zenith/GUI.hs | 22 ++++++++++++++++++++-- zenith.cabal | 2 +- 8 files changed, 38 insertions(+), 13 deletions(-) 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/app/Server.hs b/app/Server.hs index 7944fe3..acc63d8 100644 --- a/app/Server.hs +++ b/app/Server.hs @@ -67,7 +67,7 @@ main = do zebraPort (zgb_net chainInfo) threadDelay 90000000 - putStrLn "Zenith RPC Server 0.7.0.0-beta" + putStrLn "Zenith RPC Server 0.7.2.0-beta" putStrLn "------------------------------" putStrLn $ "Connected to " ++ 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 41642d0..cd8af03 100644 --- a/src/Zenith/CLI.hs +++ b/src/Zenith/CLI.hs @@ -528,7 +528,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 835a00d..6ba6e65 100644 --- a/src/Zenith/Core.hs +++ b/src/Zenith/Core.hs @@ -787,7 +787,7 @@ shieldTransparentNotes pool zebraHost zebraPort znet za bh = do prepTSpends (getTranSK $ zcashAccountTPrivateKey $ entityVal acc) trNotes - chgAddr <- getInternalAddresses pool $ entityKey acc + chgAddr <- liftIO $ getInternalAddresses pool $ entityKey acc let internalUA = getUA $ walletAddressUAddress $ entityVal $ head chgAddr let oRcvr = @@ -1076,7 +1076,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 -> @@ -1298,8 +1298,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 dfbedf9..bea2240 100644 --- a/src/Zenith/DB.hs +++ b/src/Zenith/DB.hs @@ -647,8 +647,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 @@ -1436,7 +1437,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 0c9dfdf..053a19a 100644 --- a/src/Zenith/GUI.hs +++ b/src/Zenith/GUI.hs @@ -88,6 +88,7 @@ data AppEvent | MenuClicked | NewClicked | NewAddress !(Maybe (Entity ZcashAccount)) + | NewInternalAddress !(Maybe (Entity ZcashAccount)) | NewAccount !(Maybe (Entity ZcashWallet)) | NewWallet | SetPool !ZcashPool @@ -101,6 +102,7 @@ data AppEvent | LoadAddrs ![Entity WalletAddress] | LoadAccs ![Entity ZcashAccount] | LoadWallets ![Entity ZcashWallet] + | CheckChange | ConfirmCancel | SaveAddress !(Maybe (Entity ZcashAccount)) | SaveAccount !(Maybe (Entity ZcashWallet)) @@ -1199,6 +1201,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" & @@ -1365,13 +1368,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] @@ -2010,7 +2028,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/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 -- 2.43.0