Implement Account creation #68
1 changed files with 14 additions and 7 deletions
|
@ -215,7 +215,12 @@ appEvent (BT.VtyEvent e) = do
|
||||||
fs <- BT.zoom inputForm $ BT.gets formState
|
fs <- BT.zoom inputForm $ BT.gets formState
|
||||||
nw <- liftIO $ addNewWallet (fs ^. dialogInput) s
|
nw <- liftIO $ addNewWallet (fs ^. dialogInput) s
|
||||||
BT.put nw
|
BT.put nw
|
||||||
BT.modify $ set dialogBox Blank
|
aL <- use accounts
|
||||||
|
BT.modify $
|
||||||
|
set dialogBox $
|
||||||
|
if not (null $ L.listElements aL)
|
||||||
|
then Blank
|
||||||
|
else AName
|
||||||
ev -> BT.zoom inputForm $ handleFormEvent (BT.VtyEvent ev)
|
ev -> BT.zoom inputForm $ handleFormEvent (BT.VtyEvent ev)
|
||||||
AName -> do
|
AName -> do
|
||||||
case e of
|
case e of
|
||||||
|
@ -224,7 +229,7 @@ appEvent (BT.VtyEvent e) = do
|
||||||
BT.modify $ set dialogBox Blank
|
BT.modify $ set dialogBox Blank
|
||||||
fs <- BT.zoom inputForm $ BT.gets formState
|
fs <- BT.zoom inputForm $ BT.gets formState
|
||||||
printMsg $
|
printMsg $
|
||||||
"Creating new address " <> T.unpack (fs ^. dialogInput)
|
"Creating new account " <> T.unpack (fs ^. dialogInput)
|
||||||
ev -> BT.zoom inputForm $ handleFormEvent (BT.VtyEvent ev)
|
ev -> BT.zoom inputForm $ handleFormEvent (BT.VtyEvent ev)
|
||||||
Blank -> do
|
Blank -> do
|
||||||
case e of
|
case e of
|
||||||
|
@ -332,8 +337,10 @@ addNewWallet n s = do
|
||||||
T.unpack n
|
T.unpack n
|
||||||
Just _ -> do
|
Just _ -> do
|
||||||
wL <- getWallets (s ^. dbPath) netName
|
wL <- getWallets (s ^. dbPath) netName
|
||||||
return $
|
let aL =
|
||||||
(s & wallets .~ L.listReplace (Vec.fromList wL) (Just 0) (s ^. wallets)) &
|
L.listFindBy (\x -> zcashWalletName (entityVal x) == n) $
|
||||||
msg .~
|
L.listReplace (Vec.fromList wL) (Just 0) (s ^. wallets)
|
||||||
"Created new wallet: " ++
|
return $ (s & wallets .~ aL) & msg .~ "Created new wallet: " ++ T.unpack n
|
||||||
T.unpack n
|
|
||||||
|
addNewAccount :: T.Text -> State -> IO State
|
||||||
|
addNewAccount n s = undefined
|
||||||
|
|
Loading…
Reference in a new issue