rvv001 - Import Viewing Key Bug

Decoding is not working when importing a new Viewing Key
	 TUI is working.
This commit is contained in:
Rene V. Vergara 2025-02-26 21:56:27 -05:00
parent 7688c6dc1b
commit f701e57cbb

View file

@ -191,9 +191,11 @@ data AppEvent
| ClosePayUsingURI
| ProcIfValidURI
| PreparePaymentURIForm
| SetTimerCount
| ShowNViewingKey
| CloseNVkShow
| SaveViewKey
| ReportVKeySaved
| ShowNSeedPhrase
| CloseNSpShow
| SaveSeedPhrase
@ -2108,8 +2110,38 @@ handleEvent wenv node model evt =
--
-- Show Import Viewing Key Form
--
SetTimerCount ->
[ Model $ model & timer .~ 85 ]
ShowNViewingKey -> [Model $ model & nVkShow .~ True & menuPopup .~ False]
CloseNVkShow -> [Model $ model & nVkShow .~ False]
SaveViewKey ->
[ Task $ do
pool <- runNoLoggingT $ initPool $ c_dbPath $ model ^. configuration
let inKey = parseVK $ model ^. nVkString
case inKey of
Nothing -> return $ ShowError "Invalid viewing key"
Just k -> do
x <-
importViewingKey
pool
(model ^. nVkName)
(model ^. network)
k
(model ^. nVkBirthday)
case x of
Left e -> return $ ShowError e
Right i -> return $ ReportVKeySaved
]
--
ReportVKeySaved ->
[ Task $ do
pool <- runNoLoggingT $ initPool $ c_dbPath $ model ^. configuration
wL <- getWallets pool (model ^. network)
return $ LoadWallets wL
, Event $ CloseNVkShow
, Event $ ShowMessage "Viewing Key imported!"
, Event $ SetTimerCount
]
--
-- Show Import Seed Phrase Form
--
@ -2136,9 +2168,8 @@ handleEvent wenv node model evt =
else return $ ShowError "Invalid Birthday Block!"
else return $ ShowError "Seed Phrase not provided"
else return $ ShowError "Seed Phrase name invalid!"
-- , Task $ return CloseNSpShow
]
--
ReportSeedSaved ->
[ Task $ do
pool <- runNoLoggingT $ initPool $ c_dbPath $ model ^. configuration
@ -2146,6 +2177,7 @@ handleEvent wenv node model evt =
return $ LoadWallets wL
, Event $ CloseNSpShow
, Event $ ShowMessage "Seed Phrase imported!!"
, Event $ SetTimerCount
]
ShowNSeedPhrase -> [Model $ model & nSpShow .~ True &
@ -2170,24 +2202,6 @@ handleEvent wenv node model evt =
, Event $ ShowError "Balance conversion not available for TestNet"
]
CloseFIATBalance -> [Model $ model & displayFIATBalance .~ False]
SaveViewKey ->
[ Task $ do
pool <- runNoLoggingT $ initPool $ c_dbPath $ model ^. configuration
let inKey = parseVK $ model ^. nVkString
case inKey of
Nothing -> return $ ShowError "Invalid viewing key"
Just k -> do
x <-
importViewingKey
pool
(model ^. nVkName)
(model ^. network)
k
(model ^. nVkBirthday)
case x of
Left e -> return $ ShowError e
Right i -> return $ ShowMessage "Viewing Key imported!"
]
--
-- Prepare Viewing Keys
--