From d8984d3cf32b77d4fc5411331212b9303d9d1d0b Mon Sep 17 00:00:00 2001 From: David Walsh Date: Fri, 16 Jul 2021 10:00:03 -0500 Subject: [PATCH] EIP-1559 - Provide Updated UI for Dapp-Suggested Gas fees (#11523) --- app/_locales/en/messages.json | 16 +++++++ .../edit-gas-display.component.js | 13 +++--- ui/components/app/edit-gas-display/index.scss | 6 ++- .../edit-gas-popover.component.js | 1 + .../app/transaction-detail-item/index.scss | 5 +++ .../transaction-detail-item.component.js | 22 ++++------ .../actionable-message/actionable-message.js | 18 ++------ .../actionable-message.stories.js | 2 +- ui/components/ui/info-tooltip/index.scss | 14 ++++++- .../ui/info-tooltip/info-tooltip-icon.js | 17 ++++++++ ui/components/ui/info-tooltip/info-tooltip.js | 5 ++- .../confirm-transaction-base.component.js | 42 ++++++++++++++++--- .../__snapshots__/fee-card.test.js.snap | 13 ++++-- .../__snapshots__/sort-list.test.js.snap | 10 +---- .../sort-list/sort-list.test.js | 5 +++ .../__snapshots__/view-quote.test.js.snap | 5 +-- ui/pages/swaps/view-quote/view-quote.test.js | 4 ++ 17 files changed, 137 insertions(+), 61 deletions(-) create mode 100644 ui/components/ui/info-tooltip/info-tooltip-icon.js diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 405faa011..68306c809 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -2442,9 +2442,25 @@ "transactionCreated": { "message": "Transaction created with a value of $1 at $2." }, + "transactionDetailDappGasHeading": { + "message": "$1 suggested gas fee", + "description": "$1 represents a dapp origin" + }, + "transactionDetailDappGasTooltip": { + "message": "This gas fee suggestion is using legacy gas estimation which may be inaccurate." + }, "transactionDetailGasHeading": { "message": "Estimated gas fee" }, + "transactionDetailGasTooltipConversion": { + "message": "Learn more about gas fees" + }, + "transactionDetailGasTooltipExplanation": { + "message": "Gas fees are set by the network and fluctuate based on network traffic and transaction complexity." + }, + "transactionDetailGasTooltipIntro": { + "message": "Gas fees are paid to crypto miners who process transactions on the Ethereum network. MetaMask does not profit from gas fees." + }, "transactionDetailGasTotalSubtitle": { "message": "Amount + gas fee" }, diff --git a/ui/components/app/edit-gas-display/edit-gas-display.component.js b/ui/components/app/edit-gas-display/edit-gas-display.component.js index a51cd8a0d..4e41d565c 100644 --- a/ui/components/app/edit-gas-display/edit-gas-display.component.js +++ b/ui/components/app/edit-gas-display/edit-gas-display.component.js @@ -28,8 +28,7 @@ export default function EditGasDisplay({ alwaysShowForm = false, showEducationButton = false, onEducationClick, - dappSuggestedGasFee = 0, - dappOrigin = '', + transaction, defaultEstimateToUse, maxPriorityFeePerGas, setMaxPriorityFeePerGas, @@ -61,7 +60,7 @@ export default function EditGasDisplay({ const t = useContext(I18nContext); const requireDappAcknowledgement = Boolean( - dappSuggestedGasFee && !dappSuggestedGasFeeAcknowledged, + transaction?.dappSuggestedGasFees && !dappSuggestedGasFeeAcknowledged, ); return ( @@ -79,7 +78,8 @@ export default function EditGasDisplay({
@@ -164,7 +164,7 @@ export default function EditGasDisplay({ onChange={setEstimateToUse} /> )} - {!alwaysShowForm && ( + {!alwaysShowForm && !requireDappAcknowledgement && (