rvv001 - Issue 0122 - Generate Viewing Keys
The Viewing Keys deriving functions are now integrated to the CLI.hs module (TUI).
This commit is contained in:
parent
d8457eceb6
commit
e4b6b36a7d
1 changed files with 45 additions and 14 deletions
|
@ -96,7 +96,7 @@ import Text.Wrap
|
||||||
, defaultWrapSettings
|
, defaultWrapSettings
|
||||||
, wrapTextToLines
|
, wrapTextToLines
|
||||||
)
|
)
|
||||||
import ZcashHaskell.Keys (generateWalletSeedPhrase)
|
import ZcashHaskell.Keys (generateWalletSeedPhrase, deriveUfvk, deriveUivk)
|
||||||
import ZcashHaskell.Orchard
|
import ZcashHaskell.Orchard
|
||||||
( getSaplingFromUA
|
( getSaplingFromUA
|
||||||
, isValidUnifiedAddress
|
, isValidUnifiedAddress
|
||||||
|
@ -122,6 +122,9 @@ import Zenith.Types
|
||||||
, ValidAddressAPI(..)
|
, ValidAddressAPI(..)
|
||||||
, ZcashNetDB(..)
|
, ZcashNetDB(..)
|
||||||
, ZenithStatus(..)
|
, ZenithStatus(..)
|
||||||
|
, OrchardSpendingKeyDB(..)
|
||||||
|
, SaplingSpendingKeyDB(..)
|
||||||
|
, TransparentSpendingKeyDB(..)
|
||||||
)
|
)
|
||||||
import Zenith.Utils
|
import Zenith.Utils
|
||||||
( displayTaz
|
( displayTaz
|
||||||
|
@ -1761,24 +1764,52 @@ appEvent (BT.VtyEvent e) = do
|
||||||
BT.modify $ set dialogBox ViewingKeyMenu
|
BT.modify $ set dialogBox ViewingKeyMenu
|
||||||
ev -> return ()
|
ev -> return ()
|
||||||
--
|
--
|
||||||
|
-- Open viewing key display form
|
||||||
|
--
|
||||||
ViewingKeyMenu -> do
|
ViewingKeyMenu -> do
|
||||||
case e of
|
case e of
|
||||||
|
--
|
||||||
|
-- Full viewing key display
|
||||||
|
--
|
||||||
V.EvKey (V.KChar 'f') [] -> do
|
V.EvKey (V.KChar 'f') [] -> do
|
||||||
BT.modify $ set vkName "Full"
|
selAccount <-
|
||||||
BT.modify $
|
do case L.listSelectedElement $ s ^. accounts of
|
||||||
set
|
Nothing -> do
|
||||||
vkData
|
let fAcc =
|
||||||
"VKFull->ztestsapling1tgjr4zppwk4ne8xy6gdq4z2gwq7dmf5jq8z2ctpn8nlmtse0a74fa5z0m8z383gmpgqz6q6duu4"
|
L.listSelectedElement $ L.listMoveToBeginning $ s ^. accounts
|
||||||
BT.modify $ set dialogBox ViewingKeyShow
|
case fAcc of
|
||||||
|
Nothing -> throw $ userError "Failed to select account"
|
||||||
|
Just (_j, w1) -> return w1
|
||||||
|
Just (_k, w) -> return w
|
||||||
|
let osk = getOrchSK $ zcashAccountOrchSpendKey $ entityVal selAccount
|
||||||
|
let ssk = getSapSK $ zcashAccountSapSpendKey $ entityVal selAccount
|
||||||
|
let tsk = getTranSK $ zcashAccountTPrivateKey $ entityVal selAccount
|
||||||
|
fvk <- liftIO $ deriveUfvk (s ^. network) osk ssk tsk
|
||||||
|
BT.modify $ set vkName "Full"
|
||||||
|
BT.modify $ set vkData fvk
|
||||||
|
BT.modify $ set dialogBox ViewingKeyShow
|
||||||
|
--
|
||||||
|
-- Incoming viewing key display
|
||||||
|
--
|
||||||
V.EvKey (V.KChar 'i') [] -> do
|
V.EvKey (V.KChar 'i') [] -> do
|
||||||
BT.modify $ set vkName "Incomming"
|
selAccount <-
|
||||||
BT.modify $
|
do case L.listSelectedElement $ s ^. accounts of
|
||||||
set
|
Nothing -> do
|
||||||
vkData
|
let fAcc =
|
||||||
"VKIncoming->ztestsapling1tgjr4zppwk4ne8xy6gdq4z2gwq7dmf5jq8z2ctpn8nlmtse0a74fa5z0m8z383gmpgqz6q6duu4"
|
L.listSelectedElement $ L.listMoveToBeginning $ s ^. accounts
|
||||||
BT.modify $ set dialogBox ViewingKeyShow
|
case fAcc of
|
||||||
|
Nothing -> throw $ userError "Failed to select account"
|
||||||
|
Just (_j, w1) -> return w1
|
||||||
|
Just (_k, w) -> return w
|
||||||
|
let osk = getOrchSK $ zcashAccountOrchSpendKey $ entityVal selAccount
|
||||||
|
let ssk = getSapSK $ zcashAccountSapSpendKey $ entityVal selAccount
|
||||||
|
let tsk = getTranSK $ zcashAccountTPrivateKey $ entityVal selAccount
|
||||||
|
ivk <- liftIO $ deriveUivk (s ^. network) osk ssk tsk
|
||||||
|
BT.modify $ set vkName "Incomming"
|
||||||
|
BT.modify $ set vkData ivk
|
||||||
|
BT.modify $ set dialogBox ViewingKeyShow
|
||||||
V.EvKey (V.KChar 'e') [] ->
|
V.EvKey (V.KChar 'e') [] ->
|
||||||
BT.modify $ set dialogBox Blank
|
BT.modify $ set dialogBox Blank
|
||||||
ev -> return ()
|
ev -> return ()
|
||||||
--
|
--
|
||||||
-- Payment URI Form Events
|
-- Payment URI Form Events
|
||||||
|
|
Loading…
Reference in a new issue