diff --git a/src/app/modules/main/wallet_section/transactions/controller.nim b/src/app/modules/main/wallet_section/transactions/controller.nim index e0d64557ed..b0b50a9629 100644 --- a/src/app/modules/main/wallet_section/transactions/controller.nim +++ b/src/app/modules/main/wallet_section/transactions/controller.nim @@ -100,12 +100,6 @@ proc getMigratedKeyPairByKeyUid*(self: Controller, keyUid: string): seq[KeyPairD proc loadTransactions*(self: Controller, address: string, toBlock: Uint256, limit: int = 20, loadMore: bool = false) = self.transactionService.loadTransactions(address, toBlock, limit, loadMore) -proc estimateGas*(self: Controller, from_addr: string, to: string, assetSymbol: string, value: string, data: string): string = - try: - result = self.transactionService.estimateGas(from_addr, to, assetSymbol, value, data) - except Exception as e: - result = "0" - proc transfer*(self: Controller, from_addr: string, to_addr: string, tokenSymbol: string, value: string, uuid: string, selectedRoutes: string, password: string) = self.transactionService.transfer(from_addr, to_addr, tokenSymbol, value, uuid, selectedRoutes, password) diff --git a/src/app/modules/main/wallet_section/transactions/io_interface.nim b/src/app/modules/main/wallet_section/transactions/io_interface.nim index 12cddca800..6f71d51b2e 100644 --- a/src/app/modules/main/wallet_section/transactions/io_interface.nim +++ b/src/app/modules/main/wallet_section/transactions/io_interface.nim @@ -37,9 +37,6 @@ method setHistoryFetchState*(self: AccessInterface, addresses: seq[string], isFe method setIsNonArchivalNode*(self: AccessInterface, isNonArchivalNode: bool) {.base.} = raise newException(ValueError, "No implementation available") -method estimateGas*(self: AccessInterface, from_addr: string, to: string, assetSymbol: string, value: string, data: string): string {.base.} = - raise newException(ValueError, "No implementation available") - method onUserAuthenticated*(self: AccessInterface, password: string) {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/wallet_section/transactions/module.nim b/src/app/modules/main/wallet_section/transactions/module.nim index f78a7d8d80..57c9b6502b 100644 --- a/src/app/modules/main/wallet_section/transactions/module.nim +++ b/src/app/modules/main/wallet_section/transactions/module.nim @@ -91,9 +91,6 @@ method setTrxHistoryResult*(self: Module, transactions: seq[TransactionDto], add method setHistoryFetchState*(self: Module, addresses: seq[string], isFetching: bool) = self.view.setHistoryFetchStateForAccounts(addresses, isFetching) -method estimateGas*(self: Module, from_addr: string, to: string, assetSymbol: string, value: string, data: string): string = - result = self.controller.estimateGas(from_addr, to, assetSymbol, value, data) - method setIsNonArchivalNode*(self: Module, isNonArchivalNode: bool) = self.view.setIsNonArchivalNode(isNonArchivalNode) diff --git a/src/app/modules/main/wallet_section/transactions/view.nim b/src/app/modules/main/wallet_section/transactions/view.nim index 0672b2a283..9e8baf9d65 100644 --- a/src/app/modules/main/wallet_section/transactions/view.nim +++ b/src/app/modules/main/wallet_section/transactions/view.nim @@ -105,9 +105,6 @@ QtObject: read = getIsNonArchivalNode notify = isNonArchivalNodeChanged - proc estimateGas*(self: View, from_addr: string, to: string, assetSymbol: string, value: string, data: string): string {.slot.} = - result = self.delegate.estimateGas(from_addr, to, assetSymbol, value, data) - proc transactionSent*(self: View, txResult: string) {.signal.} proc transactionWasSent*(self: View,txResult: string) {.slot} = diff --git a/src/app_service/service/transaction/service.nim b/src/app_service/service/transaction/service.nim index 10df69b1bc..98da30f6fa 100644 --- a/src/app_service/service/transaction/service.nim +++ b/src/app_service/service/transaction/service.nim @@ -224,54 +224,6 @@ QtObject: ) self.threadpool.start(arg) - proc estimateGas*( - self: Service, - from_addr: string, - to: string, - assetSymbol: string, - value: string, - chainId: string, - data: string = "", - ): string {.slot.} = - var response: RpcResponse[JsonNode] - var success: bool - # TODO make this async - let network = self.networkService.getNetwork(parseInt(chainId)) - - if network.nativeCurrencySymbol == assetSymbol: - var tx = ens_utils.buildTransaction( - parseAddress(from_addr), - eth2Wei(parseFloat(value), 18), - data = data - ) - tx.to = parseAddress(to).some - try: - response = eth.estimateGas(parseInt(chainId), %*[%tx]) - let res = fromHex[int](response.result.getStr) - return $(%* { "result": res, "success": true }) - except Exception as e: - error "Error estimating gas", msg = e.msg - return $(%* { "result": "-1", "success": false, "error": { "message": e.msg } }) - - let token = self.tokenService.findTokenBySymbol(network, assetSymbol) - if token == nil: - raise newException(ValueError, fmt"Could not find ERC-20 contract with symbol '{assetSymbol}' for the current network") - - var tx = buildTokenTransaction( - parseAddress(from_addr), - token.address, - ) - - let transfer = Transfer(to: parseAddress(to), value: conversion.eth2Wei(parseFloat(value), token.decimals)) - let transferproc = ERC20_procS.toTable["transfer"] - try: - let gas = transferproc.estimateGas(parseInt(chainId), tx, transfer, success) - let res = fromHex[int](gas) - return $(%* { "result": res, "success": success }) - except Exception as e: - error "Error estimating gas", msg = e.msg - return $(%* { "result": "-1", "success": false, "error": { "message": e.msg } }) - proc transfer*( self: Service, from_addr: string, diff --git a/ui/app/AppLayouts/stores/RootStore.qml b/ui/app/AppLayouts/stores/RootStore.qml index fde7afcafb..4e41f08af7 100644 --- a/ui/app/AppLayouts/stores/RootStore.qml +++ b/ui/app/AppLayouts/stores/RootStore.qml @@ -111,9 +111,6 @@ QtObject { property string currentCurrency: walletSection.currentCurrency property string signingPhrase: walletSection.signingPhrase - function estimateGas(from_addr, to, assetSymbol, value, chainId, data) { - return walletSectionTransactions.estimateGas(from_addr, to, assetSymbol, value, chainId, data) - } function getFiatValue(balance, cryptoSymbol, fiatSymbol) { return profileSectionStore.ensUsernamesStore.getFiatValue(balance, cryptoSymbol, fiatSymbol) } diff --git a/ui/imports/shared/stores/TransactionStore.qml b/ui/imports/shared/stores/TransactionStore.qml index 1b53b93d4c..0aed7342b9 100644 --- a/ui/imports/shared/stores/TransactionStore.qml +++ b/ui/imports/shared/stores/TransactionStore.qml @@ -61,10 +61,6 @@ QtObject { globalUtils.copyToClipboard(text) } - function estimateGas(from_addr, to, assetSymbol, value, chainId, data) { - return walletSectionTransactions.estimateGas(from_addr, to, assetSymbol, value, chainId, data) - } - function getFiatValue(balance, cryptoSymbol, fiatSymbol) { return profileSectionStore.ensUsernamesStore.getFiatValue(balance, cryptoSymbol, fiatSymbol) }