feat(transaction-pay): add ordered strategy fallback orchestration#7868
Open
pedronfigueiredo wants to merge 2 commits intomainfrom
Open
feat(transaction-pay): add ordered strategy fallback orchestration#7868pedronfigueiredo wants to merge 2 commits intomainfrom
pedronfigueiredo wants to merge 2 commits intomainfrom
Conversation
23573ac to
55549a1
Compare
55549a1 to
e2818b3
Compare
packages/transaction-pay-controller/src/helpers/TransactionPayPublishHook.ts
Outdated
Show resolved
Hide resolved
e2818b3 to
5158351
Compare
packages/transaction-pay-controller/src/TransactionPayController.ts
Outdated
Show resolved
Hide resolved
c450bc6 to
782bc16
Compare
matthewwalsh0
requested changes
Feb 11, 2026
packages/transaction-pay-controller/src/helpers/TransactionPayPublishHook.ts
Outdated
Show resolved
Hide resolved
packages/transaction-pay-controller/src/TransactionPayController.ts
Outdated
Show resolved
Hide resolved
9b2de51 to
44ee983
Compare
44ee983 to
eeca0ed
Compare
eeca0ed to
9cd0f37
Compare
9cd0f37 to
a6c9af9
Compare
matthewwalsh0
requested changes
Feb 13, 2026
| (transaction: TransactionMeta): TransactionPayStrategy => { | ||
| const fallbackStrategy = getStrategyOrder(this.messenger)[0]; | ||
| return ( | ||
| this.#getStrategiesWithFallback(transaction)[0] ?? fallbackStrategy |
Member
There was a problem hiding this comment.
Minor, as I assume this isn't used anymore, but do we need the ternary here since the fallback strategies are retrieved within getStrategiesWithFallback?
| max?: number; | ||
| }; | ||
| relayQuoteUrl?: string; | ||
| strategyOrder?: unknown[]; |
| export const DEFAULT_SLIPPAGE = 0.005; | ||
| export const DEFAULT_STRATEGY_ORDER: [ | ||
| TransactionPayStrategy, | ||
| ...TransactionPayStrategy[], |
Member
There was a problem hiding this comment.
As this is a constant, do we need a type, and why is it [X, ...X[]]?
| max?: number; | ||
| }; | ||
| relayQuoteUrl?: string; | ||
| strategyOrder?: unknown[]; |
| .filter((strategy): strategy is TransactionPayStrategy => | ||
| VALID_STRATEGIES.has(strategy as TransactionPayStrategy), | ||
| ) | ||
| .filter( |
| name: strategyName, | ||
| strategy: getStrategyByName(strategyName), | ||
| }; | ||
| } catch { |
Member
There was a problem hiding this comment.
Minor, maybe a getStrategiesByName util?
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
As per preemptive validation on #7806
TransactionPayController:getStrategieswhile preserving existinggetStrategybehavior.supports(...)) during strategy selection.References
Addresses https://github.com/MetaMask/MetaMask-planning/issues/6992
Checklist
Note
Medium Risk
Touches core quote-selection and refresh logic and changes which strategy is executed at publish time; ordering/fallback mistakes could cause missing quotes or incorrect submission paths, though changes are well covered by unit tests.
Overview
TransactionPayControllernow supports an orderedgetStrategiescallback (with fallback to the legacygetStrategyand to a feature-flag-driven default order) and passes this ordered list through quote refresh/update flows.Quote retrieval (
updateQuotes/getQuotes) has been reworked to iterate strategies in order, optionally apply per-strategysupports(...)filtering, skip unknown strategies, and fall back on errors/empty quotes (including batch-transaction failures). The publish hook now executes using the strategy encoded in the stored quote instead of re-resolving it from controller state.Adds a new remote feature flag
confirmations_pay.strategyOrder(with validation/deduping) and updates tests/docs/changelog accordingly.Written by Cursor Bugbot for commit a6c9af9. This will update automatically on new commits. Configure here.