Unused hex2Dec, hex2Eth and hex2Gwei removed from shared RootStore

This commit is contained in:
Michał Cieślak 2024-09-03 16:42:28 +02:00 committed by Michał
parent 61d345d4ad
commit 3f4715ccdd
6 changed files with 1 additions and 35 deletions

View File

@ -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 stew/byteutils
import ./utils/qrcodegen import ./utils/qrcodegen
import ./utils/time_utils import ./utils/time_utils
@ -60,21 +60,9 @@ QtObject:
add(str, "0") add(str, "0")
return str 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.} = proc gwei2Hex*(self: Utils, gwei: float): string {.slot.} =
return "0x" & conversion.gwei2Wei(gwei).toHex() 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.} = proc readTextFile*(self: Utils, filepath: string): string {.slot.} =
try: try:
return readFile(filepath) return readFile(filepath)

View File

@ -27,7 +27,6 @@ SplitView {
Component.onCompleted: { Component.onCompleted: {
RootStore.getFiatValue = (cryptoValue, symbol) => { return (cryptoValue * 1800).toPrecision(2) } RootStore.getFiatValue = (cryptoValue, symbol) => { return (cryptoValue * 1800).toPrecision(2) }
RootStore.getLatestBlockNumber = () => { return 4 } RootStore.getLatestBlockNumber = () => { return 4 }
RootStore.hex2Dec = (number) => { return 10 }
RootStore.formatCurrencyAmount = (value, symbol) => { return value + " " + symbol } RootStore.formatCurrencyAmount = (value, symbol) => { return value + " " + symbol }
RootStore.getNameForSavedWalletAddress = (address) => { return "Saved Wallet Name" } RootStore.getNameForSavedWalletAddress = (address) => { return "Saved Wallet Name" }
RootStore.getNameForAddress = (address) => { return "Address Name" } RootStore.getNameForAddress = (address) => { return "Address Name" }

View File

@ -14,7 +14,6 @@ QtObject {
property var getFiatValue property var getFiatValue
property var getLatestBlockNumber property var getLatestBlockNumber
property var hex2Dec
property var formatCurrencyAmount property var formatCurrencyAmount
property var getNameForSavedWalletAddress property var getNameForSavedWalletAddress
property var getNameForAddress property var getNameForAddress

View File

@ -625,10 +625,6 @@ QtObject {
return profileSectionModule.ensUsernamesModule.getEtherscanLink() return profileSectionModule.ensUsernamesModule.getEtherscanLink()
} }
function hex2Eth(value) {
return globalUtilsInst.hex2Eth(value)
}
function getLoginType() { function getLoginType() {
if(!userProfileInst) if(!userProfileInst)
return Constants.LoginType.Password return Constants.LoginType.Password

View File

@ -218,10 +218,6 @@ QtObject {
return profileSectionStore.ensUsernamesStore.getGasEthValue(gweiValue, gasLimit) return profileSectionStore.ensUsernamesStore.getGasEthValue(gweiValue, gasLimit)
} }
function hex2Eth(value) {
return globalUtils.hex2Eth(value)
}
function setCurrentUserStatus(newStatus) { function setCurrentUserStatus(newStatus) {
if (userProfileInst && userProfileInst.currentUserStatus !== newStatus) { if (userProfileInst && userProfileInst.currentUserStatus !== newStatus) {
mainModuleInst.setCurrentUserStatus(newStatus) mainModuleInst.setCurrentUserStatus(newStatus)

View File

@ -37,10 +37,6 @@ QtObject {
property var flatNetworks: networksModule.flatNetworks property var flatNetworks: networksModule.flatNetworks
function hex2Dec(value) {
return globalUtils.hex2Dec(value)
}
readonly property var formationChars: (["*", "`", "~"]) readonly property var formationChars: (["*", "`", "~"])
function getSelectedTextWithFormationChars(messageInputField) { function getSelectedTextWithFormationChars(messageInputField) {
let i = 1 let i = 1
@ -131,14 +127,6 @@ QtObject {
walletSectionInst.activityController.updateFilter() walletSectionInst.activityController.updateFilter()
} }
function hex2Eth(value) {
return globalUtils.hex2Eth(value)
}
function hex2Gwei(value) {
return globalUtils.hex2Gwei(value)
}
function getCurrencyAmount(amount, symbol) { function getCurrencyAmount(amount, symbol) {
return currencyStore.getCurrencyAmount(amount, symbol) return currencyStore.getCurrencyAmount(amount, symbol)
} }