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
|
||||
nw <- liftIO $ addNewWallet (fs ^. dialogInput) s
|
||||
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)
|
||||
AName -> do
|
||||
case e of
|
||||
|
@ -224,7 +229,7 @@ appEvent (BT.VtyEvent e) = do
|
|||
BT.modify $ set dialogBox Blank
|
||||
fs <- BT.zoom inputForm $ BT.gets formState
|
||||
printMsg $
|
||||
"Creating new address " <> T.unpack (fs ^. dialogInput)
|
||||
"Creating new account " <> T.unpack (fs ^. dialogInput)
|
||||
ev -> BT.zoom inputForm $ handleFormEvent (BT.VtyEvent ev)
|
||||
Blank -> do
|
||||
case e of
|
||||
|
@ -332,8 +337,10 @@ addNewWallet n s = do
|
|||
T.unpack n
|
||||
Just _ -> do
|
||||
wL <- getWallets (s ^. dbPath) netName
|
||||
return $
|
||||
(s & wallets .~ L.listReplace (Vec.fromList wL) (Just 0) (s ^. wallets)) &
|
||||
msg .~
|
||||
"Created new wallet: " ++
|
||||
T.unpack n
|
||||
let aL =
|
||||
L.listFindBy (\x -> zcashWalletName (entityVal x) == n) $
|
||||
L.listReplace (Vec.fromList wL) (Just 0) (s ^. wallets)
|
||||
return $ (s & wallets .~ aL) & msg .~ "Created new wallet: " ++ T.unpack n
|
||||
|
||||
addNewAccount :: T.Text -> State -> IO State
|
||||
addNewAccount n s = undefined
|
||||
|
|
Loading…
Reference in a new issue