fix: correct balance calculation for VK

This commit is contained in:
Rene Vergara 2025-02-20 13:15:28 -06:00
parent 84a8b53331
commit 0599ec9040
Signed by: pitmutt
SSH key fingerprint: SHA256:vNa8FIqbBZjV9hOCkXyOzd7gqWCMCfkcfiPH2zaGfQ0
3 changed files with 13 additions and 5 deletions

View file

@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- RPC
- `importvk`
- TUI
- Import viewing keys
- GUI
- Import viewing keys
### Changed

View file

@ -395,8 +395,10 @@ importViewingKey pool name znet vk bh = do
case acc of
Nothing -> return $ Left "Failed to save VK account"
Just acc' -> do
_ <- createWalletAddress "Default" 0 znet External acc'
_ <- createWalletAddress "Change" 0 znet Internal acc'
defAddr <- createWalletAddress "Default" 0 znet External acc'
chgAddr <- createWalletAddress "Change" 0 znet Internal acc'
_ <- saveAddress pool defAddr
_ <- saveAddress pool chgAddr
return $ Right $ fromSqlKey (entityKey acc')
IncomingVk ivk -> do
acc1 <-
@ -414,8 +416,10 @@ importViewingKey pool name znet vk bh = do
case acc1 of
Nothing -> return $ Left "Failed to save VK account"
Just acc1' -> do
_ <- createWalletAddress "Default" 0 znet External acc1'
_ <- createWalletAddress "Change" 0 znet Internal acc1'
defAddr <- createWalletAddress "Default" 0 znet External acc1'
chgAddr <- createWalletAddress "Change" 0 znet Internal acc1'
_ <- saveAddress pool defAddr
_ <- saveAddress pool chgAddr
return $ Right $ fromSqlKey $ entityKey acc1'
else return $ Left "Viewing key is not for the current network"

View file

@ -1,6 +1,6 @@
cabal-version: 3.0
name: zenith
version: 0.8.0.0-beta
version: 0.9.0.0-beta
license: MIT
license-file: LICENSE
author: Rene Vergara