remove most references to libstatus wallet

This commit is contained in:
Iuri Matias 2021-06-08 11:20:54 -04:00
parent e8de7e0c99
commit ceb7f85e4e
6 changed files with 26 additions and 15 deletions

View File

@ -5,10 +5,8 @@ import # vendor libs
chronicles, NimQml chronicles, NimQml
import # status-desktop libs import # status-desktop libs
../../../status/[status, stickers], ../../../status/libstatus/[types, utils], ../../../status/[status, stickers, wallet], ../../../status/libstatus/[types, utils],
../../../status/libstatus/stickers as status_stickers, ../../../status/libstatus/stickers as status_stickers, sticker_pack_list, sticker_list, chat_item, ../../../status/tasks/[qt, task_runner_impl]
../../../status/libstatus/wallet as status_wallet, sticker_pack_list,
sticker_list, chat_item, ../../../status/tasks/[qt, task_runner_impl]
logScope: logScope:
topics = "stickers-view" topics = "stickers-view"
@ -143,7 +141,7 @@ QtObject:
proc setAvailableStickerPacks*(self: StickersView, availableStickersJSON: string) {.slot.} = proc setAvailableStickerPacks*(self: StickersView, availableStickersJSON: string) {.slot.} =
let let
accounts = status_wallet.getWalletAccounts() # TODO: make generic accounts = self.status.wallet.getWalletAccounts() # TODO: make generic
installedStickerPacks = self.status.stickers.getInstalledStickerPacks() installedStickerPacks = self.status.stickers.getInstalledStickerPacks()
var var
purchasedStickerPacks: seq[int] purchasedStickerPacks: seq[int]
@ -152,7 +150,7 @@ QtObject:
purchasedStickerPacks = self.status.stickers.getPurchasedStickerPacks(address) purchasedStickerPacks = self.status.stickers.getPurchasedStickerPacks(address)
let availableStickers = JSON.decode($availableStickersJSON, seq[StickerPack]) let availableStickers = JSON.decode($availableStickersJSON, seq[StickerPack])
let pendingTransactions = status_wallet.getPendingTransactions() let pendingTransactions = self.status.wallet.getPendingTransactions()
var pendingStickerPacks = initHashSet[int]() var pendingStickerPacks = initHashSet[int]()
if (pendingTransactions != ""): if (pendingTransactions != ""):
for trx in pendingTransactions.parseJson{"result"}.getElems(): for trx in pendingTransactions.parseJson{"result"}.getElems():

View File

@ -8,7 +8,7 @@ import ../../../status/ens as status_ens
import ../../../status/libstatus/wallet as status_wallet import ../../../status/libstatus/wallet as status_wallet
import ../../../status/libstatus/settings as status_settings import ../../../status/libstatus/settings as status_settings
import ../../../status/libstatus/utils as libstatus_utils import ../../../status/libstatus/utils as libstatus_utils
import ../../../status/[status, settings] import ../../../status/[status, settings, wallet]
import ../../../status/wallet import ../../../status/wallet
import sets import sets
import web3/ethtypes import web3/ethtypes
@ -108,7 +108,7 @@ QtObject:
self.usernames = getSetting[seq[string]](self.status.settings, Setting.Usernames, @[]) self.usernames = getSetting[seq[string]](self.status.settings, Setting.Usernames, @[])
# Get pending ens names # Get pending ens names
let pendingTransactions = status_wallet.getPendingTransactions() let pendingTransactions = self.status.wallet.getPendingTransactions()
if (pendingTransactions == ""): if (pendingTransactions == ""):
return return
for trx in pendingTransactions.parseJson{"result"}.getElems(): for trx in pendingTransactions.parseJson{"result"}.getElems():

View File

@ -1,13 +1,12 @@
import NimQml, os, strformat, strutils, parseUtils, chronicles import NimQml, os, strformat, strutils, parseUtils, chronicles
import stint import stint
import ../../status/status import ../../status/[status, wallet]
import ../../status/accounts as status_accounts import ../../status/accounts as status_accounts
import ../../status/stickers import ../../status/stickers
import ../../status/libstatus/accounts/constants as accountConstants import ../../status/libstatus/accounts/constants as accountConstants
import ../../status/libstatus/tokens import ../../status/libstatus/tokens
import ../../status/libstatus/types import ../../status/libstatus/types
import ../../status/libstatus/settings import ../../status/libstatus/settings
import ../../status/libstatus/wallet as status_wallet
import ../../status/libstatus/utils as status_utils import ../../status/libstatus/utils as status_utils
import ../../status/ens as status_ens import ../../status/ens as status_ens
import ../utils/image_utils import ../utils/image_utils
@ -49,7 +48,7 @@ QtObject:
result = getSNTAddress() result = getSNTAddress()
proc getSNTBalance*(self: UtilsView): string {.slot.} = proc getSNTBalance*(self: UtilsView): string {.slot.} =
let currAcct = status_wallet.getWalletAccounts()[0] let currAcct = self.status.wallet.getWalletAccounts()[0]
result = getSNTBalance($currAcct.address) result = getSNTBalance($currAcct.address)
proc eth2Wei*(self: UtilsView, eth: string, decimals: int): string {.slot.} = proc eth2Wei*(self: UtilsView, eth: string, decimals: int): string {.slot.} =

View File

@ -2,7 +2,6 @@ import NimQml, strformat, strutils, chronicles, sugar, sequtils
import view import view
import views/[asset_list, account_list, account_item] import views/[asset_list, account_list, account_item]
import ../../status/libstatus/wallet as status_wallet
import ../../status/libstatus/types as status_types import ../../status/libstatus/types as status_types
import ../../status/signals/types import ../../status/signals/types
import ../../status/[status, wallet, settings] import ../../status/[status, wallet, settings]

View File

@ -554,7 +554,7 @@ QtObject:
var addresses:seq[string] = @[] var addresses:seq[string] = @[]
for acc in self.status.wallet.accounts: for acc in self.status.wallet.accounts:
addresses.add(acc.address) addresses.add(acc.address)
discard status_wallet.checkRecentHistory(addresses) discard self.status.wallet.checkRecentHistory(addresses)
proc transactionWatchResultReceived(self: WalletView, watchResult: string) {.slot.} = proc transactionWatchResultReceived(self: WalletView, watchResult: string) {.slot.} =
let wTxRes = watchResult.parseJSON()["result"].getStr().parseJson(){"result"} let wTxRes = watchResult.parseJSON()["result"].getStr().parseJson(){"result"}
@ -675,7 +675,7 @@ QtObject:
read = defaultGasLimit read = defaultGasLimit
proc getDefaultAddress*(self: WalletView): string {.slot.} = proc getDefaultAddress*(self: WalletView): string {.slot.} =
result = $status_wallet.getWalletAccounts()[0].address result = $self.status.wallet.getWalletAccounts()[0].address
proc getDefaultTokenList(self: WalletView): QVariant {.slot.} = proc getDefaultTokenList(self: WalletView): QVariant {.slot.} =
self.defaultTokenList.loadDefaultTokens() self.defaultTokenList.loadDefaultTokens()
@ -816,4 +816,4 @@ QtObject:
notify = dappBrowserAccountChanged notify = dappBrowserAccountChanged
proc setInitialRange*(self: WalletView) {.slot.} = proc setInitialRange*(self: WalletView) {.slot.} =
discard status_wallet.setInitialBlocksRange() discard self.status.wallet.setInitialBlocksRange()

View File

@ -359,3 +359,18 @@ proc getGasPricePredictions*(): GasPricePrediction =
except Exception as e: except Exception as e:
echo "error getting gas price predictions" echo "error getting gas price predictions"
echo e.msg echo e.msg
proc checkRecentHistory*(self: WalletModel, addresses: seq[string]): string =
result = status_wallet.checkRecentHistory(addresses)
proc setInitialBlocksRange*(self: WalletModel): string =
result = status_wallet.setInitialBlocksRange()
proc getWalletAccounts*(self: WalletModel): seq[WalletAccount] =
result = status_wallet.getWalletAccounts()
proc watchTransaction*(self: WalletModel, transactionHash: string): string =
result = status_wallet.watchTransaction(transactionHash)
proc getPendingTransactions*(self: WalletModel): string =
result = status_wallet.getPendingTransactions()