This PR fixes the bug reported on #111 regarding change addresses in the GUI. Reviewed-on: #112 Co-authored-by: Rene Vergara <rene@vergara.network> Co-committed-by: Rene Vergara <rene@vergara.network>
This commit is contained in:
parent
19643ff022
commit
16cf30a8e4
10 changed files with 40 additions and 16 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,4 +1,3 @@
|
||||||
[submodule "zcash-haskell"]
|
[submodule "zcash-haskell"]
|
||||||
path = zcash-haskell
|
path = zcash-haskell
|
||||||
url = https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
url = https://code.vergara.tech/Vergara_Tech/zcash-haskell
|
||||||
branch = master
|
|
||||||
|
|
|
@ -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/),
|
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.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]
|
## [0.7.1.0-beta]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -67,7 +67,7 @@ main = do
|
||||||
zebraPort
|
zebraPort
|
||||||
(zgb_net chainInfo)
|
(zgb_net chainInfo)
|
||||||
threadDelay 90000000
|
threadDelay 90000000
|
||||||
putStrLn "Zenith RPC Server 0.7.0.0-beta"
|
putStrLn "Zenith RPC Server 0.7.2.0-beta"
|
||||||
putStrLn "------------------------------"
|
putStrLn "------------------------------"
|
||||||
putStrLn $
|
putStrLn $
|
||||||
"Connected to " ++
|
"Connected to " ++
|
||||||
|
|
|
@ -6,10 +6,10 @@ with-compiler: ghc-9.6.5
|
||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git
|
location: https://code.vergara.tech/Vergara_Tech/haskell-hexstring.git
|
||||||
tag: 39d8da7b11a80269454c2f134a5c834e0f3cb9a7
|
tag: 39d8da7b11a80269454c2f134a5c834e0f3cb9a7
|
||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
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
|
tag: 335e804454cd30da2c526457be37e477f71e4665
|
||||||
|
|
|
@ -528,7 +528,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
|
||||||
(str
|
(str
|
||||||
" _____ _ _ _ \n|__ /___ _ __ (_) |_| |__\n / // _ \\ '_ \\| | __| '_ \\\n / /| __/ | | | | |_| | | |\n/____\\___|_| |_|_|\\__|_| |_|") <=>
|
" _____ _ _ _ \n|__ /___ _ __ (_) |_| |__\n / // _ \\ '_ \\| | __| '_ \\\n / /| __/ | | | | |_| | | |\n/____\\___|_| |_|_|\\__|_| |_|") <=>
|
||||||
C.hCenter
|
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..."))
|
C.hCenter (withAttr blinkAttr $ str "Press any key..."))
|
||||||
else emptyWidget
|
else emptyWidget
|
||||||
capCommand3 :: String -> String -> String -> Widget Name
|
capCommand3 :: String -> String -> String -> Widget Name
|
||||||
|
|
|
@ -787,7 +787,7 @@ shieldTransparentNotes pool zebraHost zebraPort znet za bh = do
|
||||||
prepTSpends
|
prepTSpends
|
||||||
(getTranSK $ zcashAccountTPrivateKey $ entityVal acc)
|
(getTranSK $ zcashAccountTPrivateKey $ entityVal acc)
|
||||||
trNotes
|
trNotes
|
||||||
chgAddr <- getInternalAddresses pool $ entityKey acc
|
chgAddr <- liftIO $ getInternalAddresses pool $ entityKey acc
|
||||||
let internalUA =
|
let internalUA =
|
||||||
getUA $ walletAddressUAddress $ entityVal $ head chgAddr
|
getUA $ walletAddressUAddress $ entityVal $ head chgAddr
|
||||||
let oRcvr =
|
let oRcvr =
|
||||||
|
@ -1076,7 +1076,7 @@ prepareTxV2 pool zebraHost zebraPort zn za bh pnotes policy = do
|
||||||
makeOutgoing acc recvs chg pol = do
|
makeOutgoing acc recvs chg pol = do
|
||||||
let k = map (\(x, _, _, _) -> x) recvs
|
let k = map (\(x, _, _, _) -> x) recvs
|
||||||
let j = 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
|
let internalUA = getUA $ walletAddressUAddress $ entityVal $ head chgAddr
|
||||||
case pol of
|
case pol of
|
||||||
Full ->
|
Full ->
|
||||||
|
@ -1298,8 +1298,7 @@ syncWallet config w = do
|
||||||
mapM (liftIO . runNoLoggingT . getAddresses pool . entityKey) accs
|
mapM (liftIO . runNoLoggingT . getAddresses pool . entityKey) accs
|
||||||
logDebugN $ "addrs: " <> T.pack (show addrs)
|
logDebugN $ "addrs: " <> T.pack (show addrs)
|
||||||
intAddrs <-
|
intAddrs <-
|
||||||
concat <$>
|
concat <$> mapM (liftIO . getInternalAddresses pool . entityKey) accs
|
||||||
mapM (liftIO . runNoLoggingT . getInternalAddresses pool . entityKey) accs
|
|
||||||
chainTip <- liftIO $ getMaxBlock pool znet
|
chainTip <- liftIO $ getMaxBlock pool znet
|
||||||
logDebugN $ "chain tip: " <> T.pack (show chainTip)
|
logDebugN $ "chain tip: " <> T.pack (show chainTip)
|
||||||
lastBlock <- liftIO $ getLastSyncBlock pool $ entityKey w
|
lastBlock <- liftIO $ getLastSyncBlock pool $ entityKey w
|
||||||
|
|
|
@ -647,8 +647,9 @@ getAddressById pool a = do
|
||||||
getInternalAddresses ::
|
getInternalAddresses ::
|
||||||
ConnectionPool -- ^ The database path
|
ConnectionPool -- ^ The database path
|
||||||
-> ZcashAccountId -- ^ The account ID to check
|
-> ZcashAccountId -- ^ The account ID to check
|
||||||
-> NoLoggingT IO [Entity WalletAddress]
|
-> IO [Entity WalletAddress]
|
||||||
getInternalAddresses pool a =
|
getInternalAddresses pool a =
|
||||||
|
runNoLoggingT $
|
||||||
PS.retryOnBusy $
|
PS.retryOnBusy $
|
||||||
flip PS.runSqlPool pool $ do
|
flip PS.runSqlPool pool $ do
|
||||||
select $ do
|
select $ do
|
||||||
|
@ -1436,7 +1437,8 @@ getWalletTransactions ::
|
||||||
-> NoLoggingT IO ()
|
-> NoLoggingT IO ()
|
||||||
getWalletTransactions pool w = do
|
getWalletTransactions pool w = do
|
||||||
let w' = entityVal w
|
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 ctReceiver = t_rec =<< readUnifiedAddressDB (entityVal $ head chgAddr)
|
||||||
let csReceiver = s_rec =<< readUnifiedAddressDB (entityVal $ head chgAddr)
|
let csReceiver = s_rec =<< readUnifiedAddressDB (entityVal $ head chgAddr)
|
||||||
let coReceiver = o_rec =<< readUnifiedAddressDB (entityVal $ head chgAddr)
|
let coReceiver = o_rec =<< readUnifiedAddressDB (entityVal $ head chgAddr)
|
||||||
|
|
|
@ -88,6 +88,7 @@ data AppEvent
|
||||||
| MenuClicked
|
| MenuClicked
|
||||||
| NewClicked
|
| NewClicked
|
||||||
| NewAddress !(Maybe (Entity ZcashAccount))
|
| NewAddress !(Maybe (Entity ZcashAccount))
|
||||||
|
| NewInternalAddress !(Maybe (Entity ZcashAccount))
|
||||||
| NewAccount !(Maybe (Entity ZcashWallet))
|
| NewAccount !(Maybe (Entity ZcashWallet))
|
||||||
| NewWallet
|
| NewWallet
|
||||||
| SetPool !ZcashPool
|
| SetPool !ZcashPool
|
||||||
|
@ -101,6 +102,7 @@ data AppEvent
|
||||||
| LoadAddrs ![Entity WalletAddress]
|
| LoadAddrs ![Entity WalletAddress]
|
||||||
| LoadAccs ![Entity ZcashAccount]
|
| LoadAccs ![Entity ZcashAccount]
|
||||||
| LoadWallets ![Entity ZcashWallet]
|
| LoadWallets ![Entity ZcashWallet]
|
||||||
|
| CheckChange
|
||||||
| ConfirmCancel
|
| ConfirmCancel
|
||||||
| SaveAddress !(Maybe (Entity ZcashAccount))
|
| SaveAddress !(Maybe (Entity ZcashAccount))
|
||||||
| SaveAccount !(Maybe (Entity ZcashWallet))
|
| SaveAccount !(Maybe (Entity ZcashWallet))
|
||||||
|
@ -1199,6 +1201,7 @@ handleEvent wenv node model evt =
|
||||||
AccountClicked -> [Model $ model & accPopup .~ True]
|
AccountClicked -> [Model $ model & accPopup .~ True]
|
||||||
MenuClicked -> [Model $ model & menuPopup .~ True]
|
MenuClicked -> [Model $ model & menuPopup .~ True]
|
||||||
NewClicked -> [Model $ model & newPopup .~ not (model ^. newPopup)]
|
NewClicked -> [Model $ model & newPopup .~ not (model ^. newPopup)]
|
||||||
|
NewInternalAddress acc -> [Task $ addNewAddress "Change" Internal acc]
|
||||||
NewAddress acc ->
|
NewAddress acc ->
|
||||||
[ Model $
|
[ Model $
|
||||||
model & confirmTitle ?~ "New Address" & confirmAccept .~ "Create" &
|
model & confirmTitle ?~ "New Address" & confirmAccept .~ "Create" &
|
||||||
|
@ -1365,13 +1368,28 @@ handleEvent wenv node model evt =
|
||||||
, Event $ ShowMsg "Copied transaction ID!"
|
, Event $ ShowMsg "Copied transaction ID!"
|
||||||
]
|
]
|
||||||
LoadTxs t -> [Model $ model & transactions .~ t]
|
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 ->
|
LoadAddrs a ->
|
||||||
if not (null a)
|
if not (null a)
|
||||||
then [ Model $ model & addresses .~ a
|
then [ Model $ model & addresses .~ a
|
||||||
|
, Event CheckChange
|
||||||
, Event $ SwitchAddr $ model ^. selAddr
|
, Event $ SwitchAddr $ model ^. selAddr
|
||||||
, Event $ SetPool OrchardPool
|
, Event $ SetPool OrchardPool
|
||||||
]
|
]
|
||||||
else [Event $ NewAddress currentAccount]
|
else [ Event $ NewAddress currentAccount
|
||||||
|
, Event $ NewInternalAddress currentAccount
|
||||||
|
]
|
||||||
LoadAccs a ->
|
LoadAccs a ->
|
||||||
if not (null a)
|
if not (null a)
|
||||||
then [Model $ model & accounts .~ a, Event $ SwitchAcc 0]
|
then [Model $ model & accounts .~ a, Event $ SwitchAcc 0]
|
||||||
|
@ -2010,7 +2028,7 @@ runZenithGUI config = do
|
||||||
Left _e -> print "Zebra not available"
|
Left _e -> print "Zebra not available"
|
||||||
where
|
where
|
||||||
params hd =
|
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)
|
, appWindowState $ MainWindowNormal (1000, 700)
|
||||||
, appTheme zenithTheme
|
, appTheme zenithTheme
|
||||||
, appFontDef
|
, appFontDef
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4289a9ded67ef2ca432abc412934fb5b8b59a9cf
|
Subproject commit a28edcb5995667677e96a08c6952a568bfd6c51e
|
|
@ -1,6 +1,6 @@
|
||||||
cabal-version: 3.0
|
cabal-version: 3.0
|
||||||
name: zenith
|
name: zenith
|
||||||
version: 0.7.1.0-beta
|
version: 0.7.2.0-beta
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Rene Vergara
|
author: Rene Vergara
|
||||||
|
|
Loading…
Reference in a new issue