Release preparation #90

Merged
pitmutt merged 29 commits from rav001 into milestone2 2024-07-11 13:43:05 +00:00
3 changed files with 67 additions and 11 deletions
Showing only changes of commit f332d9b177 - Show all commits

View file

@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Dialog to display transaction details and copy TX ID - Dialog to display transaction details and copy TX ID
- Dialog to send a new transaction - Dialog to send a new transaction
- Dialog to display Tx ID after successful broadcast - Dialog to display Tx ID after successful broadcast
- Unconfirmed balance display on TUI and GUI
### Fixed ### Fixed

View file

@ -180,6 +180,7 @@ data State = State
, _timer :: !Int , _timer :: !Int
, _txForm :: !(Form SendInput () Name) , _txForm :: !(Form SendInput () Name)
, _sentTx :: !(Maybe HexString) , _sentTx :: !(Maybe HexString)
, _unconfBalance :: !Integer
} }
makeLenses ''State makeLenses ''State
@ -215,6 +216,12 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
if st ^. network == MainNet if st ^. network == MainNet
then displayZec (st ^. balance) then displayZec (st ^. balance)
else displayTaz (st ^. balance))) <=> else displayTaz (st ^. balance))) <=>
C.hCenter
(str
("Unconf: " ++
if st ^. network == MainNet
then displayZec (st ^. unconfBalance)
else displayTaz (st ^. unconfBalance))) <=>
listAddressBox "Addresses" (st ^. addresses) <+> listAddressBox "Addresses" (st ^. addresses) <+>
B.vBorder <+> B.vBorder <+>
(C.hCenter (str ("Last block seen: " ++ show (st ^. syncBlock))) <=> (C.hCenter (str ("Last block seen: " ++ show (st ^. syncBlock))) <=>
@ -1046,6 +1053,10 @@ runZenithCLI config = do
if not (null accList) if not (null accList)
then getBalance pool $ entityKey $ head accList then getBalance pool $ entityKey $ head accList
else return 0 else return 0
uBal <-
if not (null accList)
then getUnconfirmedBalance pool $ entityKey $ head accList
else return 0
eventChan <- BC.newBChan 10 eventChan <- BC.newBChan 10
_ <- _ <-
forkIO $ forkIO $
@ -1083,6 +1094,7 @@ runZenithCLI config = do
0 0
(mkSendForm 0 $ SendInput "" 0.0 "") (mkSendForm 0 $ SendInput "" 0.0 "")
Nothing Nothing
uBal
Left e -> do Left e -> do
print $ print $
"No Zebra node available on port " <> "No Zebra node available on port " <>
@ -1111,6 +1123,10 @@ refreshWallet s = do
if not (null aL) if not (null aL)
then getBalance pool $ entityKey $ head aL then getBalance pool $ entityKey $ head aL
else return 0 else return 0
uBal <-
if not (null aL)
then getUnconfirmedBalance pool $ entityKey $ head aL
else return 0
txL <- txL <-
if not (null addrL) if not (null addrL)
then getUserTx pool $ entityKey $ head addrL then getUserTx pool $ entityKey $ head addrL
@ -1121,6 +1137,8 @@ refreshWallet s = do
let txL' = L.listReplace (Vec.fromList txL) (Just 0) (s ^. transactions) let txL' = L.listReplace (Vec.fromList txL) (Just 0) (s ^. transactions)
return $ return $
s & wallets .~ wL & accounts .~ aL' & syncBlock .~ bl & balance .~ bal & s & wallets .~ wL & accounts .~ aL' & syncBlock .~ bl & balance .~ bal &
unconfBalance .~
uBal &
addresses .~ addresses .~
addrL' & addrL' &
transactions .~ transactions .~
@ -1191,6 +1209,7 @@ refreshAccount s = do
Just (_k, w) -> return w Just (_k, w) -> return w
aL <- runNoLoggingT $ getAddresses pool $ entityKey selAccount aL <- runNoLoggingT $ getAddresses pool $ entityKey selAccount
bal <- getBalance pool $ entityKey selAccount bal <- getBalance pool $ entityKey selAccount
uBal <- getUnconfirmedBalance pool $ entityKey selAccount
let aL' = L.listReplace (Vec.fromList aL) (Just 0) (s ^. addresses) let aL' = L.listReplace (Vec.fromList aL) (Just 0) (s ^. addresses)
selAddress <- selAddress <-
do case L.listSelectedElement aL' of do case L.listSelectedElement aL' of
@ -1201,13 +1220,17 @@ refreshAccount s = do
case selAddress of case selAddress of
Nothing -> Nothing ->
return $ return $
s & balance .~ bal & addresses .~ aL' & msg .~ "Switched to account: " ++ s & balance .~ bal & unconfBalance .~ uBal & addresses .~ aL' & msg .~
"Switched to account: " ++
T.unpack (zcashAccountName $ entityVal selAccount) T.unpack (zcashAccountName $ entityVal selAccount)
Just (_i, a) -> do Just (_i, a) -> do
tList <- getUserTx pool $ entityKey a tList <- getUserTx pool $ entityKey a
let tL' = L.listReplace (Vec.fromList tList) (Just 0) (s ^. transactions) let tL' = L.listReplace (Vec.fromList tList) (Just 0) (s ^. transactions)
return $ return $
s & balance .~ bal & addresses .~ aL' & transactions .~ tL' & msg .~ s & balance .~ bal & unconfBalance .~ uBal & addresses .~ aL' &
transactions .~
tL' &
msg .~
"Switched to account: " ++ "Switched to account: " ++
T.unpack (zcashAccountName $ entityVal selAccount) T.unpack (zcashAccountName $ entityVal selAccount)

View file

@ -75,6 +75,7 @@ data AppEvent
| SwitchAddr !Int | SwitchAddr !Int
| SwitchAcc !Int | SwitchAcc !Int
| SwitchWal !Int | SwitchWal !Int
| UpdateBalance !(Integer, Integer)
| CopyAddr !(Maybe (Entity WalletAddress)) | CopyAddr !(Maybe (Entity WalletAddress))
| LoadTxs ![Entity UserTx] | LoadTxs ![Entity UserTx]
| LoadAddrs ![Entity WalletAddress] | LoadAddrs ![Entity WalletAddress]
@ -311,7 +312,7 @@ buildUI wenv model = widgetTree
hstack hstack
[ addressBox [ addressBox
, vstack , vstack
[ mainButton "Send" ShowSend [ mainButton "Send" ShowSend `styleBasic` [textFont "Bold"]
, txBox `nodeVisible` not (null $ model ^. transactions) , txBox `nodeVisible` not (null $ model ^. transactions)
] ]
] ]
@ -322,19 +323,24 @@ buildUI wenv model = widgetTree
box_ box_
[alignMiddle] [alignMiddle]
(vstack (vstack
[ animFadeIn [ hstack
(label (displayAmount (model ^. network) $ model ^. balance) `styleBasic` [ filler
, animFadeIn
(label
(displayAmount (model ^. network) $ model ^. balance) `styleBasic`
[textSize 20]) [textSize 20])
, filler
]
, hstack , hstack
[ filler [ filler
, remixIcon remixHourglassFill `styleBasic` [textSize 8] , remixIcon remixHourglassFill `styleBasic` [textSize 8]
, label , label
(maybe "0" (displayAmount (model ^. network)) $ (maybe "0" (displayAmount (model ^. network)) $
model ^. unconfBalance) `styleBasic` model ^. unconfBalance) `styleBasic`
[textSize 8] `nodeVisible` [textSize 8]
isJust (model ^. unconfBalance)
, filler , filler
] ] `nodeVisible`
isJust (model ^. unconfBalance)
]) `styleBasic` ]) `styleBasic`
[bgColor white, radius 5, border 1 btnColor] [bgColor white, radius 5, border 1 btnColor]
, filler , filler
@ -923,6 +929,15 @@ handleEvent wenv node model evt =
case selectAccount i of case selectAccount i of
Nothing -> return [] Nothing -> return []
Just acc -> runNoLoggingT $ getAddresses dbPool $ entityKey acc Just acc -> runNoLoggingT $ getAddresses dbPool $ entityKey acc
, Task $
UpdateBalance <$> do
dbPool <- runNoLoggingT $ initPool $ c_dbPath $ model ^. configuration
case selectAccount i of
Nothing -> return (0, 0)
Just acc -> do
b <- getBalance dbPool $ entityKey acc
u <- getUnconfirmedBalance dbPool $ entityKey acc
return (b, u)
, Event $ SetPool Orchard , Event $ SetPool Orchard
] ]
SwitchWal i -> SwitchWal i ->
@ -934,6 +949,13 @@ handleEvent wenv node model evt =
Nothing -> return [] Nothing -> return []
Just wal -> runNoLoggingT $ getAccounts dbPool $ entityKey wal Just wal -> runNoLoggingT $ getAccounts dbPool $ entityKey wal
] ]
UpdateBalance (b, u) ->
[ Model $
model & balance .~ b & unconfBalance .~
(if u == 0
then Nothing
else Just u)
]
CopyAddr a -> CopyAddr a ->
[ setClipboardData ClipboardEmpty [ setClipboardData ClipboardEmpty
, setClipboardData $ , setClipboardData $
@ -1246,6 +1268,14 @@ runZenithGUI config = do
if not (null addrList) if not (null addrList)
then getQrCode pool Orchard $ entityKey $ head addrList then getQrCode pool Orchard $ entityKey $ head addrList
else return Nothing else return Nothing
bal <-
if not (null accList)
then getBalance pool $ entityKey $ head accList
else return 0
unconfBal <-
if not (null accList)
then getUnconfirmedBalance pool $ entityKey $ head accList
else return 0
let model = let model =
AppModel AppModel
config config
@ -1260,8 +1290,10 @@ runZenithGUI config = do
0 0
Nothing Nothing
True True
314259000 bal
(Just 300000) (if unconfBal == 0
then Nothing
else Just unconfBal)
Orchard Orchard
qr qr
False False