Docker image #89

Merged
pitmutt merged 45 commits from milestone2 into master 2024-06-21 18:15:53 +00:00
Showing only changes of commit eb82f250ea - Show all commits

View file

@ -62,7 +62,7 @@ import Control.Monad (forever, void)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Logger (LoggingT, runFileLoggingT, runNoLoggingT)
import Data.Aeson
import Data.HexString (toText)
import Data.HexString (HexString(..), toText)
import Data.Maybe
import qualified Data.Text as T
import qualified Data.Text.Encoding as E
@ -139,6 +139,7 @@ data DisplayType
| MsgDisplay
| PhraseDisplay
| TxDisplay
| TxIdDisplay
| SyncDisplay
| SendDisplay
| BlankDisplay
@ -146,6 +147,7 @@ data DisplayType
data Tick
= TickVal !Float
| TickMsg !String
| TickTx !HexString
data State = State
{ _network :: !ZcashNet
@ -170,6 +172,7 @@ data State = State
, _eventDispatch :: !(BC.BChan Tick)
, _timer :: !Int
, _txForm :: !(Form SendInput () Name)
, _sentTx :: !(Maybe HexString)
}
makeLenses ''State
@ -413,6 +416,16 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
D.renderDialog
(D.dialog (Just $ txt "Message") Nothing 50)
(padAll 1 $ strWrap $ st ^. msg)
TxIdDisplay ->
withBorderStyle unicodeBold $
D.renderDialog
(D.dialog (Just $ txt "Success") Nothing 50)
(padAll 1 $
(txt "Tx ID: " <+>
txtWrapWith
(WrapSettings False True NoFill FillAfterFirst)
(maybe "None" toText (st ^. sentTx))) <=>
C.hCenter (hBox [capCommand "C" "opy", xCommand]))
TxDisplay ->
case L.listSelectedElement $ st ^. transactions of
Nothing -> emptyWidget
@ -645,16 +658,21 @@ appEvent (BT.AppEvent t) = do
MsgDisplay -> return ()
PhraseDisplay -> return ()
TxDisplay -> return ()
TxIdDisplay -> return ()
SyncDisplay -> return ()
SendDisplay -> do
BT.modify $ set msg m
BlankDisplay -> return ()
TickTx txid -> do
BT.modify $ set sentTx (Just txid)
BT.modify $ set displayBox TxIdDisplay
TickVal v -> do
case s ^. displayBox of
AddrDisplay -> return ()
MsgDisplay -> return ()
PhraseDisplay -> return ()
TxDisplay -> return ()
TxIdDisplay -> return ()
SendDisplay -> return ()
SyncDisplay -> do
if s ^. barValue == 1.0
@ -775,6 +793,16 @@ appEvent (BT.VtyEvent e) = do
MsgDisplay -> BT.modify $ set displayBox BlankDisplay
PhraseDisplay -> BT.modify $ set displayBox BlankDisplay
TxDisplay -> BT.modify $ set displayBox BlankDisplay
TxIdDisplay -> do
case e of
V.EvKey (V.KChar 'x') [] ->
BT.modify $ set displayBox BlankDisplay
V.EvKey (V.KChar 'c') [] -> do
liftIO $
setClipboard $
T.unpack $ maybe "None" toText (s ^. sentTx)
BT.modify $ set msg "Copied transaction ID!"
_ev -> return ()
SendDisplay -> BT.modify $ set displayBox BlankDisplay
SyncDisplay -> BT.modify $ set displayBox BlankDisplay
BlankDisplay -> do
@ -1063,6 +1091,7 @@ runZenithCLI config = do
eventChan
0
(mkSendForm 0 $ SendInput "" 0.0 "")
Nothing
Left e -> do
print $
"No Zebra node available on port " <>
@ -1272,7 +1301,7 @@ sendTransaction pool chan zHost zPort znet accId bl amt ua memo = do
[Data.Aeson.String $ toText rawTx]
case resp of
Left e1 -> BC.writeBChan chan $ TickMsg $ "Zebra error: " ++ show e1
Right txId -> BC.writeBChan chan $ TickMsg $ "Tx ID: " ++ txId
Right txId -> BC.writeBChan chan $ TickTx txId
where
parseAddress :: T.Text -> IO UnifiedAddress
parseAddress a =