feat: reintroduce saved gas settings#43317
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
0163712 to
3fe8c3e
Compare
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (11 files, +296 -19)
👨🔧 @MetaMask/extension-platform (1 files, +2 -2)
📜 @MetaMask/policy-reviewers (12 files, +172 -8)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. 🧪 @MetaMask/qa (1 files, +2 -2)
|
3fe8c3e to
9cff38d
Compare
Builds ready [9cff38d]
⚡ Performance Benchmarks (Total: 🟢 20 pass · 🟡 4 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
9cff38d to
a8c28c4
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
a8c28c4 to
5fe4823
Compare
5fe4823 to
c8de7e5
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c8de7e5. Configure here.
c8de7e5 to
93e2e73
Compare
93e2e73 to
ddcc6f6
Compare
Builds ready [ddcc6f6] [reused from c8de7e5]
⚡ Performance Benchmarks (Total: 🟢 10 pass · 🟡 9 warn · 🔴 1 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|

Description
Re-introduces saved gas fee preferences for confirmations. Users can save low, medium, high, or custom gas settings from the gas edit modal and reuse that preference for future send or dapp transactions on the same account and chain.
Dapp-proposed fees still take precedence when present, and MM Pay/Swaps flows are excluded.
Related PRs:
Changelog
CHANGELOG entry: Added the ability to save gas fee preferences per account and network.
Related issues
Fixes:
Manual testing steps
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes persisted preference shape and transaction default gas behavior; migration 214 intentionally clears unmappable legacy chain-scoped gas data, which can reset some users’ saved fees.
Overview
Reintroduces saved gas fee preferences scoped by account and chain, so confirmations can default to the user’s last low/medium/high/custom choice for that sender on that network.
Preferences & persistence:
advancedGasFeemoves from chain-only tochainId → account → { userFeeLevel, maxBaseFee, priorityFee, gasPrice }.setAdvancedGasFeerequiresaccount, normalizes addresses, supports per-account clear without wiping other accounts, and uses sharedAdvancedGasFeePreferencestypes. Migration 214 drops legacy chain-scoped blobs that can’t be mapped to an account, keeps valid account-scoped data, and normalizes account keys to lowercase.Transaction wiring:
getSavedGasFeesnow takes fullTransactionMeta, reads prefs bychainId+txParams.from, maps toSavedGasFeeswith a validated level, and returns nothing for MetaMask Pay transactions. The extension pins a preview@metamask/transaction-controllerbuild for this API.Confirmations UI: New
usePersistGasFeePreferencedispatchessetAdvancedGasFeewhen users pick estimate levels or save advanced/custom gas modals.getAdvancedGasFeeValuesreads prefs for the selected account on the current chain.Metrics: Gas transaction metrics add
gas_fee_presented(from default estimates) alongsidegas_fee_selected, withdappSuggestednormalized todapp_proposed.Reviewed by Cursor Bugbot for commit ddcc6f6. Bugbot is set up for automated code reviews on this repo. Configure here.