From c4b096de44a16dded454136206a9486a559bf739 Mon Sep 17 00:00:00 2001
From: Pedro Figueiredo
Date: Wed, 13 Nov 2024 14:12:18 +0000
Subject: [PATCH] fix: Default to dApp suggested fees only when user selects
the option (#28403)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## **Description**
Previously, some gas fee parameters defaulted to dApp suggested fee
values. This was problematic, because these values are always defined,
even when the user changed to a custom priority.
To fix the issue, we now only show the fees contained in txParams,
trusting they match the user selected priority level in the gas fees
modal.
[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28403?quickstart=1)
## **Related issues**
Fixes:
## **Manual testing steps**
See screen recording below.
## **Screenshots/Recordings**
### **Before**
https://github.com/user-attachments/assets/3874d3b6-ad96-4fd9-9f40-361b38a0253b
### **After**
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
---
.../confirm/info/__snapshots__/info.test.tsx.snap | 4 ++--
.../approve/__snapshots__/approve.test.tsx.snap | 6 +++---
.../confirm/info/hooks/useEIP1559TxFees.ts | 6 ++----
.../confirm/info/hooks/useFeeCalculations.ts | 13 ++++++++-----
.../info/hooks/useTransactionGasFeeEstimate.ts | 14 ++++----------
.../__snapshots__/native-transfer.test.tsx.snap | 2 +-
.../__snapshots__/nft-token-transfer.test.tsx.snap | 2 +-
.../set-approval-for-all-info.test.tsx.snap | 2 +-
.../__snapshots__/token-transfer.test.tsx.snap | 2 +-
9 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/ui/pages/confirmations/components/confirm/info/__snapshots__/info.test.tsx.snap b/ui/pages/confirmations/components/confirm/info/__snapshots__/info.test.tsx.snap
index 38219749e987..f0c3a5183789 100644
--- a/ui/pages/confirmations/components/confirm/info/__snapshots__/info.test.tsx.snap
+++ b/ui/pages/confirmations/components/confirm/info/__snapshots__/info.test.tsx.snap
@@ -102,7 +102,7 @@ exports[`Info renders info section for approve request 1`] = `
class="mm-box mm-text mm-text--body-md mm-box--margin-right-2 mm-box--color-text-alternative"
data-testid="native-currency"
>
- $0.04
+ $0.08