diff --git a/src/app/chat/view.nim b/src/app/chat/view.nim index d01706817e..066810522b 100644 --- a/src/app/chat/view.nim +++ b/src/app/chat/view.nim @@ -100,12 +100,6 @@ QtObject: QtProperty[QVariant] stickerPacks: read = getStickerPackList - proc getStickerMarketAddress(self: ChatsView): QVariant {.slot.} = - newQVariant($self.status.stickers.getStickerMarketAddress) - - QtProperty[QVariant] stickerMarketAddress: - read = getStickerMarketAddress - proc buyPackGasEstimate*(self: ChatsView, packId: int, address: string, price: string): int {.slot.} = var success: bool result = self.status.stickers.estimateGas(packId, address, price, success) diff --git a/src/app/utilsView/view.nim b/src/app/utilsView/view.nim index 391db72aa9..3055fc80f9 100644 --- a/src/app/utilsView/view.nim +++ b/src/app/utilsView/view.nim @@ -1,6 +1,10 @@ -import NimQml, os +import NimQml, os, strformat, strutils, parseUtils import ../../status/status +import ../../status/stickers import ../../status/libstatus/accounts/constants as accountConstants +import ../../status/libstatus/tokens +import ../../status/libstatus/wallet as status_wallet +import ../../status/libstatus/utils as status_utils QtObject: type UtilsView* = ref object of QObject @@ -27,3 +31,21 @@ QtObject: proc join3Paths*(self: UtilsView, start: string, middle: string, ending: string): string {.slot.} = result = os.joinPath(start, middle, ending) + proc getSNTAddress*(self: UtilsView): string {.slot.} = + result = getSNTAddress() + + proc getSNTBalance*(self: UtilsView): string {.slot.} = + let currAcct = status_wallet.getWalletAccounts()[0] + result = getSNTBalance($currAcct.address) + + proc eth2Wei*(self: UtilsView, eth: string, decimals: int): string {.slot.} = + return $status_utils.eth2Wei(parseFloat(eth), decimals) + + proc wei2Token*(self: UtilsView, wei: string, decimals: int): string {.slot.} = + return status_utils.wei2Token(wei, decimals) + + proc getStickerMarketAddress(self: UtilsView): QVariant {.slot.} = + newQVariant($self.status.stickers.getStickerMarketAddress) + + QtProperty[QVariant] stickerMarketAddress: + read = getStickerMarketAddress diff --git a/src/app/wallet/view.nim b/src/app/wallet/view.nim index c6f15a3e6c..5dbe63ccb3 100644 --- a/src/app/wallet/view.nim +++ b/src/app/wallet/view.nim @@ -487,13 +487,6 @@ QtObject: QtProperty[string] defaultGasLimit: read = defaultGasLimit - proc getSNTAddress*(self: WalletView): string {.slot.} = - result = getSNTAddress() - - proc getSNTBalance*(self: WalletView): string {.slot.} = - let currAcct = status_wallet.getWalletAccounts()[0] - result = getSNTBalance($currAcct.address) - proc getDefaultAddress*(self: WalletView): string {.slot.} = result = $status_wallet.getWalletAccounts()[0].address @@ -546,12 +539,6 @@ QtObject: self.setCurrentTransactions(transactions) self.loadingTrxHistory(false) - proc eth2Wei*(self: WalletView, eth: string, decimals: int): string {.slot.} = - return $status_utils.eth2Wei(parseFloat(eth), decimals) - - proc wei2Token*(self: WalletView, wei: string, decimals: int): string {.slot.} = - return status_utils.wei2Token(wei, decimals) - proc resolveENS*(self: WalletView, ens: string) {.slot.} = spawnAndSend(self, "ensResolved") do: status_ens.owner(ens)