fix: re-parse required tokens when token rates load after transaction added#8714
Merged
matthewwalsh0 merged 14 commits intomainfrom May 7, 2026
Merged
Conversation
2811afd to
5425164
Compare
…ges changes - Rename pollTransactionChanges to subscribeTransactionChanges - Rename subscribeTokenChanges to subscribeAssetChanges - Add selectors to limit subscribe fires to relevant state slices - Revert structural changes to the transaction subscription - Shorten log messages and JSDoc
c91352a to
f45643e
Compare
f45643e to
60779ac
Compare
Member
Author
|
@metamaskbot publish-preview |
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 60779ac. Configure here.
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Member
Author
|
@metamaskbot publish-preview |
1 similar comment
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
OGPoyraz
approved these changes
May 7, 2026
Merged
7 tasks
chloeYue
pushed a commit
to MetaMask/metamask-extension
that referenced
this pull request
May 7, 2026
…2511) ## **Description** Cherry-pick of #42430 onto `release/13.30.0`. The pay controller change (added in #42430 via a `^22.0.0` bump) is shipped here as a `yarn patch` against `20.1.0` instead, so the release branch picks up no transitive package bumps. See MetaMask/core#8714 for the upstream core fix. ## **Changelog** CHANGELOG entry: null ## **Manual testing steps** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes confirmation UX and transaction-pay controller event subscriptions; regressions could block confirmations or mis-handle pay token parsing when asset state updates occur. > > **Overview** > Ensures confirmation flows treat Transaction Pay required-token data as an *async dependency*: the `CustomAmountInfo` panel now renders a skeleton until `useTransactionPayPrimaryRequiredToken` resolves (when Pay is enabled), and `SingleActionFooter` shows a disabled loading state until the required token is available (taking precedence over blocking-alert text). > > Updates token-amount editing to **avoid defaulting decimals**: `useUpdateTokenAmount` now no-ops unless the primary required token provides `decimals`, preventing potentially incorrect ERC-20 amount encoding. > > Adds a Yarn patch for `@metamask/transaction-pay-controller@20.1.0` so in-flight transactions with unresolved required tokens re-parse on asset-related `stateChange` events (Assets unified-state or legacy Tokens/TokenRates/CurrencyRate), and wires the extra events into the TransactionPay controller messenger delegation. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 76539e9. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
TransactionPayController.parseRequiredTokensreturns an empty array when token info or fiat rates are unavailable. Previously the only retry trigger was atxParams.datachange, leaving in-flight transactions deadlocked when clients gate calldata edits on having a resolved required token.This change subscribes to asset state changes (or
AssetsControllerwhen the unify flag is enabled) and re-parses required tokens for in-flight transactions whose tokens are still empty.References
Changelog
Checklist
Note
Medium Risk
Introduces new messenger event subscriptions (and expands
AllowedEvents), which is a breaking integration change for consumers and can affect runtime behavior via additional state-change handling.Overview
Ensures in-flight transactions retry
parseRequiredTokenswhen asset data becomes available by addingsubscribeAssetChangesand wiring it intoTransactionPayControllerto re-run token parsing on rate/token state updates (orAssetsControllerupdates when unify-state is enabled).Renames
pollTransactionChangestosubscribeTransactionChanges, updates controller/tests accordingly, and expandsAllowedEventswith the required asset/rate state-change events (BREAKING: consumers must grant these events). Adds extra diagnostics inrequired-tokenswhen calldata decoding or token metadata/rates are missing.Reviewed by Cursor Bugbot for commit a25d13a. Bugbot is set up for automated code reviews on this repo. Configure here.