From 3f4715ccddba97e69b9191b244bcc04026328b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Tue, 3 Sep 2024 16:42:28 +0200 Subject: [PATCH] Unused hex2Dec, hex2Eth and hex2Gwei removed from shared RootStore --- src/app/global/utils.nim | 14 +------------- storybook/pages/TransactionDetailViewPage.qml | 1 - storybook/stubs/shared/stores/RootStore.qml | 1 - ui/app/AppLayouts/Chat/stores/RootStore.qml | 4 ---- ui/app/AppLayouts/stores/RootStore.qml | 4 ---- ui/imports/shared/stores/RootStore.qml | 12 ------------ 6 files changed, 1 insertion(+), 35 deletions(-) diff --git a/src/app/global/utils.nim b/src/app/global/utils.nim index 23bfd2d1e4..77d4182338 100644 --- a/src/app/global/utils.nim +++ b/src/app/global/utils.nim @@ -1,4 +1,4 @@ -import NimQml, strutils, uri, stew/shims/strformat, strutils, stint, re, httpclient +import NimQml, strutils, uri, stew/shims/strformat, strutils, stint, httpclient import stew/byteutils import ./utils/qrcodegen import ./utils/time_utils @@ -60,21 +60,9 @@ QtObject: add(str, "0") return str - proc hex2Eth*(self: Utils, value: string): string {.slot.} = - return stripTrailingZeroes(conversion.wei2Eth(stint.fromHex(StUint[256], value))) - - proc hex2Gwei*(self: Utils, value: string): string {.slot.} = - return stripTrailingZeroes(conversion.wei2Eth(stint.fromHex(StUint[256], value)*1000000000)) - proc gwei2Hex*(self: Utils, gwei: float): string {.slot.} = return "0x" & conversion.gwei2Wei(gwei).toHex() - proc hex2Dec*(self: Utils, value: string): string {.slot.} = - # somehow this value crashes the app - if value.find(re("0x0+$")) >= 0: - return "0" - return $stint.fromHex(StUint[256], value) - proc readTextFile*(self: Utils, filepath: string): string {.slot.} = try: return readFile(filepath) diff --git a/storybook/pages/TransactionDetailViewPage.qml b/storybook/pages/TransactionDetailViewPage.qml index 729f15bce9..df07be19fb 100644 --- a/storybook/pages/TransactionDetailViewPage.qml +++ b/storybook/pages/TransactionDetailViewPage.qml @@ -27,7 +27,6 @@ SplitView { Component.onCompleted: { RootStore.getFiatValue = (cryptoValue, symbol) => { return (cryptoValue * 1800).toPrecision(2) } RootStore.getLatestBlockNumber = () => { return 4 } - RootStore.hex2Dec = (number) => { return 10 } RootStore.formatCurrencyAmount = (value, symbol) => { return value + " " + symbol } RootStore.getNameForSavedWalletAddress = (address) => { return "Saved Wallet Name" } RootStore.getNameForAddress = (address) => { return "Address Name" } diff --git a/storybook/stubs/shared/stores/RootStore.qml b/storybook/stubs/shared/stores/RootStore.qml index fe14d07556..ad321785ed 100644 --- a/storybook/stubs/shared/stores/RootStore.qml +++ b/storybook/stubs/shared/stores/RootStore.qml @@ -14,7 +14,6 @@ QtObject { property var getFiatValue property var getLatestBlockNumber - property var hex2Dec property var formatCurrencyAmount property var getNameForSavedWalletAddress property var getNameForAddress diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index 622b5f376d..59454f3040 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -625,10 +625,6 @@ QtObject { return profileSectionModule.ensUsernamesModule.getEtherscanLink() } - function hex2Eth(value) { - return globalUtilsInst.hex2Eth(value) - } - function getLoginType() { if(!userProfileInst) return Constants.LoginType.Password diff --git a/ui/app/AppLayouts/stores/RootStore.qml b/ui/app/AppLayouts/stores/RootStore.qml index a0acf36a73..96ca3c2d9b 100644 --- a/ui/app/AppLayouts/stores/RootStore.qml +++ b/ui/app/AppLayouts/stores/RootStore.qml @@ -218,10 +218,6 @@ QtObject { return profileSectionStore.ensUsernamesStore.getGasEthValue(gweiValue, gasLimit) } - function hex2Eth(value) { - return globalUtils.hex2Eth(value) - } - function setCurrentUserStatus(newStatus) { if (userProfileInst && userProfileInst.currentUserStatus !== newStatus) { mainModuleInst.setCurrentUserStatus(newStatus) diff --git a/ui/imports/shared/stores/RootStore.qml b/ui/imports/shared/stores/RootStore.qml index 27516825e1..1a9ff827e9 100644 --- a/ui/imports/shared/stores/RootStore.qml +++ b/ui/imports/shared/stores/RootStore.qml @@ -37,10 +37,6 @@ QtObject { property var flatNetworks: networksModule.flatNetworks - function hex2Dec(value) { - return globalUtils.hex2Dec(value) - } - readonly property var formationChars: (["*", "`", "~"]) function getSelectedTextWithFormationChars(messageInputField) { let i = 1 @@ -131,14 +127,6 @@ QtObject { walletSectionInst.activityController.updateFilter() } - function hex2Eth(value) { - return globalUtils.hex2Eth(value) - } - - function hex2Gwei(value) { - return globalUtils.hex2Gwei(value) - } - function getCurrencyAmount(amount, symbol) { return currencyStore.getCurrencyAmount(amount, symbol) }