diff --git a/src/app/modules/main/wallet_section/send/gas_fees_item.nim b/src/app/modules/main/wallet_section/send/gas_fees_item.nim index 1370966a94..92c1f1ac50 100644 --- a/src/app/modules/main/wallet_section/send/gas_fees_item.nim +++ b/src/app/modules/main/wallet_section/send/gas_fees_item.nim @@ -8,6 +8,7 @@ QtObject: maxFeePerGasL: float maxFeePerGasM: float maxFeePerGasH: float + l1GasFee: float eip1559Enabled: bool proc setup*(self: GasFeesItem, @@ -17,6 +18,7 @@ QtObject: maxFeePerGasL: float, maxFeePerGasM: float, maxFeePerGasH: float, + l1GasFee: float, eip1559Enabled: bool ) = self.QObject.setup @@ -26,6 +28,7 @@ QtObject: self.maxFeePerGasL = maxFeePerGasL self.maxFeePerGasM = maxFeePerGasM self.maxFeePerGasH = maxFeePerGasH + self.l1GasFee = l1GasFee self.eip1559Enabled = eip1559Enabled proc delete*(self: GasFeesItem) = @@ -38,10 +41,11 @@ QtObject: maxFeePerGasL: float = 0, maxFeePerGasM: float = 0, maxFeePerGasH: float = 0, + l1GasFee: float = 0, eip1559Enabled: bool = false ): GasFeesItem = new(result, delete) - result.setup(gasPrice, baseFee, maxPriorityFeePerGas, maxFeePerGasL, maxFeePerGasM, maxFeePerGasH, eip1559Enabled) + result.setup(gasPrice, baseFee, maxPriorityFeePerGas, maxFeePerGasL, maxFeePerGasM, maxFeePerGasH, l1GasFee, eip1559Enabled) proc `$`*(self: GasFeesItem): string = result = "GasFeesItem(" @@ -51,54 +55,46 @@ QtObject: result = result & "\nmaxFeePerGasL: " & $self.maxFeePerGasL result = result & "\nmaxFeePerGasM: " & $self.maxFeePerGasM result = result & "\nmaxFeePerGasH: " & $self.maxFeePerGasH + result = result & "\nl1GasFee: " & $self.l1GasFee result = result & "\neip1559Enabled: " & $self.eip1559Enabled result = result & ")" - proc gasPriceChanged*(self: GasFeesItem) {.signal.} proc getGasPrice*(self: GasFeesItem): float {.slot.} = return self.gasPrice QtProperty[float] gasPrice: read = getGasPrice - notify = gasPriceChanged - proc baseFeeChanged*(self: GasFeesItem) {.signal.} proc getBaseFee*(self: GasFeesItem): float {.slot.} = return self.baseFee QtProperty[float] baseFee: read = getBaseFee - notify = baseFeeChanged - proc maxPriorityFeePerGasChanged*(self: GasFeesItem) {.signal.} proc getMaxPriorityFeePerGas*(self: GasFeesItem): float {.slot.} = return self.maxPriorityFeePerGas QtProperty[float] maxPriorityFeePerGas: read = getMaxPriorityFeePerGas - notify = maxPriorityFeePerGasChanged - proc maxFeePerGasLChanged*(self: GasFeesItem) {.signal.} proc getMaxFeePerGasL*(self: GasFeesItem): float {.slot.} = return self.maxFeePerGasL QtProperty[float] maxFeePerGasL: read = getMaxFeePerGasL - notify = maxFeePerGasLChanged - proc maxFeePerGasMChanged*(self: GasFeesItem) {.signal.} proc getMaxFeePerGasM*(self: GasFeesItem): float {.slot.} = return self.maxFeePerGasM QtProperty[float] maxFeePerGasM: read = getMaxFeePerGasM - notify = maxFeePerGasMChanged - proc maxFeePerGasHChanged*(self: GasFeesItem) {.signal.} proc getMaxFeePerGasH*(self: GasFeesItem): float {.slot.} = return self.maxFeePerGasH QtProperty[float] maxFeePerGasH: read = getMaxFeePerGasH - notify = maxFeePerGasHChanged - proc eip1559EnabledChanged*(self: GasFeesItem) {.signal.} + proc getL1GasFee*(self: GasFeesItem): float {.slot.} = + return self.l1GasFee + QtProperty[float] l1GasFee: + read = getL1GasFee + proc getEip1559Enabled*(self: GasFeesItem): bool {.slot.} = return self.eip1559Enabled QtProperty[bool] eip1559Enabled: - read = getEip1559Enabled - notify = eip1559EnabledChanged + read = getEip1559Enabled \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/send/module.nim b/src/app/modules/main/wallet_section/send/module.nim index e113c6d542..58149ad623 100644 --- a/src/app/modules/main/wallet_section/send/module.nim +++ b/src/app/modules/main/wallet_section/send/module.nim @@ -138,6 +138,7 @@ proc convertSuggestedFeesDtoToGasFeesItem(self: Module, gasFees: SuggestedFeesDt maxFeePerGasL = gasFees.maxFeePerGasL, maxFeePerGasM = gasFees.maxFeePerGasM, maxFeePerGasH = gasFees.maxFeePerGasH, + l1GasFee = gasFees.l1GasFee, eip1559Enabled = gasFees.eip1559Enabled ) diff --git a/src/app_service/service/transaction/async_tasks.nim b/src/app_service/service/transaction/async_tasks.nim index 9899770106..5378aadd33 100644 --- a/src/app_service/service/transaction/async_tasks.nim +++ b/src/app_service/service/transaction/async_tasks.nim @@ -39,6 +39,7 @@ proc getFeesTotal*(paths: seq[TransactionPathDto]): FeesDto = optimalPrice = path.gasFees.maxFeePerGasM fees.totalFeesInEth += getGasEthValue(optimalPrice, path.gasAmount) + fees.totalFeesInEth += parseFloat(service_conversion.wei2Eth(service_conversion.gwei2Wei(path.gasFees.l1GasFee))) fees.totalTokenFees += path.tokenFees fees.totalTime += path.estimatedTime return fees diff --git a/src/app_service/service/transaction/dto.nim b/src/app_service/service/transaction/dto.nim index e4fd318ec5..fa3ea5a887 100644 --- a/src/app_service/service/transaction/dto.nim +++ b/src/app_service/service/transaction/dto.nim @@ -185,6 +185,7 @@ type maxFeePerGasL*: float64 maxFeePerGasM*: float64 maxFeePerGasH*: float64 + l1GasFee*: float64 eip1559Enabled*: bool proc decodeSuggestedFeesDto*(jsonObj: JsonNode): SuggestedFeesDto = @@ -195,6 +196,7 @@ proc decodeSuggestedFeesDto*(jsonObj: JsonNode): SuggestedFeesDto = result.maxFeePerGasL = jsonObj{"maxFeePerGasL"}.getFloat result.maxFeePerGasM = jsonObj{"maxFeePerGasM"}.getFloat result.maxFeePerGasH = jsonObj{"maxFeePerGasH"}.getFloat + result.l1GasFee = jsonObj{"l1GasFee"}.getFloat result.eip1559Enabled = jsonObj{"eip1559Enabled"}.getbool proc toSuggestedFeesDto*(jsonObj: JsonNode): SuggestedFeesDto = @@ -205,6 +207,7 @@ proc toSuggestedFeesDto*(jsonObj: JsonNode): SuggestedFeesDto = result.maxFeePerGasL = parseFloat(jsonObj{"maxFeePerGasLow"}.getStr) result.maxFeePerGasM = parseFloat(jsonObj{"maxFeePerGasMedium"}.getStr) result.maxFeePerGasH = parseFloat(jsonObj{"maxFeePerGasHigh"}.getStr) + result.l1GasFee = parseFloat(jsonObj{"l1GasFee"}.getStr) result.eip1559Enabled = jsonObj{"eip1559Enabled"}.getbool proc `$`*(self: SuggestedFeesDto): string = @@ -215,6 +218,7 @@ proc `$`*(self: SuggestedFeesDto): string = maxFeePerGasL:{self.maxFeePerGasL}, maxFeePerGasM:{self.maxFeePerGasM}, maxFeePerGasH:{self.maxFeePerGasH}, + l1GasFee:{self.l1GasFee}, eip1559Enabled:{self.eip1559Enabled} )""" @@ -260,6 +264,7 @@ proc `$`*(self: TransactionPathDto): string = approvalGasFees:{self.approvalGasFees}, approvalAmountRequired:{self.approvalAmountRequired}, approvalContractAddress:{self.approvalContractAddress}, + gasFees:{$self.gasFees} )""" proc toTransactionPathDto*(jsonObj: JsonNode): TransactionPathDto = diff --git a/ui/imports/shared/popups/send/controls/GasSelector.qml b/ui/imports/shared/popups/send/controls/GasSelector.qml index f330bb94e5..349ee1bbec 100644 --- a/ui/imports/shared/popups/send/controls/GasSelector.qml +++ b/ui/imports/shared/popups/send/controls/GasSelector.qml @@ -14,7 +14,7 @@ import StatusQ.Core.Theme 0.1 Item { id: root - property string selectedTokenSymbol + property var selectedAsset property string currentCurrency property var bestRoutes @@ -49,13 +49,27 @@ Item { statusListItemIcon.active: true statusListItemIcon.opacity: modelData.isFirstSimpleTx title: qsTr("%1 transaction fee").arg(root.getNetworkName(modelData.fromNetwork)) - subTitle: root.formatCurrencyAmount(totalGasAmountEth, Constants.ethToken) + subTitle: { + let fee = root.formatCurrencyAmount(totalGasAmountEth, Constants.ethToken) + if (modelData.gasFees.eip1559Enabled && modelData.gasFees.l1GasFee > 0) { + fee += "\n(L1 %1)".arg(root.formatCurrencyAmount(totalGasAmountL1Eth, Constants.ethToken)) + } + return fee + } + property double totalGasAmountL1Eth: { + let maxFees = modelData.gasFees.maxFeePerGasM + let gasPrice = modelData.gasFees.eip1559Enabled? maxFees : modelData.gasFees.gasPrice + return root.getGasEthValue(gasPrice , modelData.gasFees.l1GasFee) + } + property double totalGasAmountEth: { let maxFees = modelData.gasFees.maxFeePerGasM let gasPrice = modelData.gasFees.eip1559Enabled ? maxFees : modelData.gasFees.gasPrice return root.getGasEthValue(gasPrice , modelData.gasAmount) } - property double totalGasAmountFiat: root.getFiatValue(totalGasAmountEth, Constants.ethToken) + + property double totalGasAmountFiat: root.getFiatValue(totalGasAmountEth, Constants.ethToken) + root.getFiatValue(totalGasAmountL1Eth, Constants.ethToken) + statusListItemSubTitle.width: listItem.width/2 - Style.current.smallPadding statusListItemSubTitle.elide: Text.ElideMiddle statusListItemSubTitle.wrapMode: Text.NoWrap @@ -81,7 +95,7 @@ Item { asset.color: Theme.palette.directColor1 statusListItemIcon.active: true statusListItemIcon.opacity: modelData.isFirstSimpleTx - title: qsTr("Approve %1 %2 Bridge").arg(root.getNetworkName(modelData.fromNetwork)).arg(root.selectedTokenSymbol) + title: qsTr("Approve %1 %2 Bridge").arg(root.getNetworkName(modelData.fromNetwork)).arg(root.selectedAsset.symbol) property double approvalGasFees: modelData.approvalGasFees property string approvalGasFeesSymbol: Constants.ethToken property double approvalGasFeesFiat: root.getFiatValue(approvalGasFees, approvalGasFeesSymbol) @@ -115,8 +129,8 @@ Item { statusListItemIcon.opacity: modelData.isFirstBridgeTx title: qsTr("%1 -> %2 bridge").arg(root.getNetworkName(modelData.fromNetwork)).arg(root.getNetworkName(modelData.toNetwork)) property double tokenFees: modelData.tokenFees - property double tokenFeesFiat: root.getFiatValue(tokenFees, root.selectedTokenSymbol) - subTitle: root.formatCurrencyAmount(tokenFees, root.selectedTokenSymbol) + property double tokenFeesFiat: root.getFiatValue(tokenFees, root.selectedAsset.symbol) + subTitle: root.formatCurrencyAmount(tokenFees, root.selectedAsset.symbol) visible: modelData.bridgeName !== "Transfer" statusListItemSubTitle.width: 100 statusListItemSubTitle.elide: Text.ElideMiddle diff --git a/ui/imports/shared/popups/send/views/FeesView.qml b/ui/imports/shared/popups/send/views/FeesView.qml index 419094e42f..bca0da11ba 100644 --- a/ui/imports/shared/popups/send/views/FeesView.qml +++ b/ui/imports/shared/popups/send/views/FeesView.qml @@ -19,7 +19,7 @@ Rectangle { property var bestRoutes property var store property var currencyStore: store.currencyStore - property string selectedTokenSymbol + property var selectedAsset property int errorType: Constants.NoError radius: 13 @@ -76,7 +76,7 @@ Rectangle { currentCurrency: root.currencyStore.currentCurrency visible: root.errorType === Constants.NoError && !root.isLoading bestRoutes: root.bestRoutes - selectedTokenSymbol: root.selectedTokenSymbol + selectedAsset: root.selectedAsset getNetworkName: root.store.getNetworkName } GasValidator { diff --git a/ui/imports/shared/popups/send/views/NetworkSelector.qml b/ui/imports/shared/popups/send/views/NetworkSelector.qml index 1a9a4484d6..faaf311954 100644 --- a/ui/imports/shared/popups/send/views/NetworkSelector.qml +++ b/ui/imports/shared/popups/send/views/NetworkSelector.qml @@ -138,7 +138,7 @@ Item { anchors.topMargin: Style.current.bigPadding visible: root.advancedOrCustomMode - selectedTokenSymbol: root.selectedAsset.symbol + selectedAsset: root.selectedAsset isLoading: root.isLoading bestRoutes: root.bestRoutes store: root.store diff --git a/vendor/status-go b/vendor/status-go index 2aa306ef4c..98c3be55b9 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit 2aa306ef4c9d8bcf3d758600b9b8a72c7ae683ed +Subproject commit 98c3be55b937582374e60adb651543c5f1348c29