feat(transaction-pay-controller): add route-based strategy resolution#8282
Open
pedronfigueiredo wants to merge 1 commit intomainfrom
Open
feat(transaction-pay-controller): add route-based strategy resolution#8282pedronfigueiredo wants to merge 1 commit intomainfrom
pedronfigueiredo wants to merge 1 commit intomainfrom
Conversation
5a81abc to
b59a521
Compare
7 tasks
5a2400d to
3d3dc21
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.
3d3dc21 to
85b9724
Compare
jpuri
reviewed
Mar 25, 2026
| routingConfig.payStrategies.across.enabled) || | ||
| (strategy === TransactionPayStrategy.Relay && | ||
| routingConfig.payStrategies.relay.enabled), | ||
| ); |
Contributor
There was a problem hiding this comment.
We can probably avoid adding logic to this file and restrict it to code to fetch flag values.
Contributor
Author
There was a problem hiding this comment.
Agree. I will move the route-resolution helper out of feature-flags.ts and keep this file limited to fetching and normalizing raw confirmations_pay values.
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
This change moves the generic
confirmations_paystrategy-order routing logic into@metamask/transaction-pay-controllerso clients no longer need to own the raw feature-flag parsing and ordered strategy resolution themselves. The controller now supports an optionalgetStrategyRouteContextcallback for client-specific route derivation, while the package exposesgetStrategyOrderForRouteFromFeatureFlagsfor non-controller consumers that still need to answer route-based flag questions from the same generic implementation.This keeps the controller flexible for custom client overrides while standardizing the shared
transactionType/chainId/tokenAddressrouting policy in one place. As part of that, the transaction-pay feature-flag utilities now applyRemoteFeatureFlagController.localOverridesbefore resolvingconfirmations_pay, which matches how MetaMask Mobile already consumes those flags.References
pnf/plan-provider-fallback-rolloutChecklist
Note
Medium Risk
Changes how
TransactionPayControllerselects pay strategies by introducing route-context-based feature-flag resolution and by applyinglocalOverridesbefore remote flags, which can alter runtime strategy ordering for transactions and quote refreshes.Overview
Adds route-based pay strategy resolution to
TransactionPayControllervia an optionalgetStrategyRouteContextcallback; when no explicitgetStrategy/getStrategiesis provided (or they return no valid strategies), the controller now derives an ordered strategy list usingtransactionType/chainId/tokenAddressrouting overrides before falling back to the globalstrategyOrder.Introduces
getStrategyOrderForRoute/getStrategyOrderForRouteFromFeatureFlagshelpers that normalize and validate routing configs (case-insensitive hex matching, dedupe/filter invalid entries, and drop disabled strategies), and updates feature-flag parsing to applyRemoteFeatureFlagController.localOverridesoverremoteFeatureFlags. Public exports and tests are updated accordingly.Written by Cursor Bugbot for commit 85b9724. This will update automatically on new commits. Configure here.