Revert "fix(wallet): displaying L1 gas cost in UI"

This reverts commit e787dce368.
This commit is contained in:
Stefan 2024-04-25 15:32:29 +02:00
parent bda8fed466
commit b51fc86647
8 changed files with 26 additions and 43 deletions

View File

@ -8,7 +8,6 @@ QtObject:
maxFeePerGasL: float
maxFeePerGasM: float
maxFeePerGasH: float
l1GasFee: float
eip1559Enabled: bool
proc setup*(self: GasFeesItem,
@ -18,7 +17,6 @@ QtObject:
maxFeePerGasL: float,
maxFeePerGasM: float,
maxFeePerGasH: float,
l1GasFee: float,
eip1559Enabled: bool
) =
self.QObject.setup
@ -28,7 +26,6 @@ QtObject:
self.maxFeePerGasL = maxFeePerGasL
self.maxFeePerGasM = maxFeePerGasM
self.maxFeePerGasH = maxFeePerGasH
self.l1GasFee = l1GasFee
self.eip1559Enabled = eip1559Enabled
proc delete*(self: GasFeesItem) =
@ -41,11 +38,10 @@ 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, l1GasFee, eip1559Enabled)
result.setup(gasPrice, baseFee, maxPriorityFeePerGas, maxFeePerGasL, maxFeePerGasM, maxFeePerGasH, eip1559Enabled)
proc `$`*(self: GasFeesItem): string =
result = "GasFeesItem("
@ -55,46 +51,54 @@ 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 getL1GasFee*(self: GasFeesItem): float {.slot.} =
return self.l1GasFee
QtProperty[float] l1GasFee:
read = getL1GasFee
proc eip1559EnabledChanged*(self: GasFeesItem) {.signal.}
proc getEip1559Enabled*(self: GasFeesItem): bool {.slot.} =
return self.eip1559Enabled
QtProperty[bool] eip1559Enabled:
read = getEip1559Enabled
read = getEip1559Enabled
notify = eip1559EnabledChanged

View File

@ -138,7 +138,6 @@ proc convertSuggestedFeesDtoToGasFeesItem(self: Module, gasFees: SuggestedFeesDt
maxFeePerGasL = gasFees.maxFeePerGasL,
maxFeePerGasM = gasFees.maxFeePerGasM,
maxFeePerGasH = gasFees.maxFeePerGasH,
l1GasFee = gasFees.l1GasFee,
eip1559Enabled = gasFees.eip1559Enabled
)

View File

@ -39,7 +39,6 @@ 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

View File

@ -185,7 +185,6 @@ type
maxFeePerGasL*: float64
maxFeePerGasM*: float64
maxFeePerGasH*: float64
l1GasFee*: float64
eip1559Enabled*: bool
proc decodeSuggestedFeesDto*(jsonObj: JsonNode): SuggestedFeesDto =
@ -196,7 +195,6 @@ 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 =
@ -207,7 +205,6 @@ 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 =
@ -218,7 +215,6 @@ proc `$`*(self: SuggestedFeesDto): string =
maxFeePerGasL:{self.maxFeePerGasL},
maxFeePerGasM:{self.maxFeePerGasM},
maxFeePerGasH:{self.maxFeePerGasH},
l1GasFee:{self.l1GasFee},
eip1559Enabled:{self.eip1559Enabled}
)"""
@ -264,7 +260,6 @@ proc `$`*(self: TransactionPathDto): string =
approvalGasFees:{self.approvalGasFees},
approvalAmountRequired:{self.approvalAmountRequired},
approvalContractAddress:{self.approvalContractAddress},
gasFees:{$self.gasFees}
)"""
proc toTransactionPathDto*(jsonObj: JsonNode): TransactionPathDto =

View File

@ -14,7 +14,7 @@ import StatusQ.Core.Theme 0.1
Item {
id: root
property var selectedAsset
property string selectedTokenSymbol
property string currentCurrency
property var bestRoutes
@ -49,27 +49,13 @@ Item {
statusListItemIcon.active: true
statusListItemIcon.opacity: modelData.isFirstSimpleTx
title: qsTr("%1 transaction fee").arg(root.getNetworkName(modelData.fromNetwork))
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)
}
subTitle: root.formatCurrencyAmount(totalGasAmountEth, Constants.ethToken)
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) + root.getFiatValue(totalGasAmountL1Eth, Constants.ethToken)
property double totalGasAmountFiat: root.getFiatValue(totalGasAmountEth, Constants.ethToken)
statusListItemSubTitle.width: listItem.width/2 - Style.current.smallPadding
statusListItemSubTitle.elide: Text.ElideMiddle
statusListItemSubTitle.wrapMode: Text.NoWrap
@ -95,7 +81,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.selectedAsset.symbol)
title: qsTr("Approve %1 %2 Bridge").arg(root.getNetworkName(modelData.fromNetwork)).arg(root.selectedTokenSymbol)
property double approvalGasFees: modelData.approvalGasFees
property string approvalGasFeesSymbol: Constants.ethToken
property double approvalGasFeesFiat: root.getFiatValue(approvalGasFees, approvalGasFeesSymbol)
@ -129,8 +115,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.selectedAsset.symbol)
subTitle: root.formatCurrencyAmount(tokenFees, root.selectedAsset.symbol)
property double tokenFeesFiat: root.getFiatValue(tokenFees, root.selectedTokenSymbol)
subTitle: root.formatCurrencyAmount(tokenFees, root.selectedTokenSymbol)
visible: modelData.bridgeName !== "Transfer"
statusListItemSubTitle.width: 100
statusListItemSubTitle.elide: Text.ElideMiddle

View File

@ -19,7 +19,7 @@ Rectangle {
property var bestRoutes
property var store
property var currencyStore: store.currencyStore
property var selectedAsset
property string selectedTokenSymbol
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
selectedAsset: root.selectedAsset
selectedTokenSymbol: root.selectedTokenSymbol
getNetworkName: root.store.getNetworkName
}
GasValidator {

View File

@ -138,7 +138,7 @@ Item {
anchors.topMargin: Style.current.bigPadding
visible: root.advancedOrCustomMode
selectedAsset: root.selectedAsset
selectedTokenSymbol: root.selectedAsset.symbol
isLoading: root.isLoading
bestRoutes: root.bestRoutes
store: root.store

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 765da90061f83b92f63d3bfcc588e00de926f591
Subproject commit 4c4b8fe571fa314c5509eabb638bf7b8a6abd0bd