feat: enable MM Pay provider fallback routing and Across strategy support on mobile#27751
feat: enable MM Pay provider fallback routing and Across strategy support on mobile#27751pedronfigueiredo wants to merge 5 commits intomainfrom
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. |
8ec189d to
aecc4b4
Compare
...mponents/Views/confirmations/components/activity/transaction-details/transaction-details.tsx
Outdated
Show resolved
Hide resolved
aecc4b4 to
f19f99c
Compare
f19f99c to
a70e59e
Compare
...iews/confirmations/components/activity/transaction-details-hero/transaction-details-hero.tsx
Outdated
Show resolved
Hide resolved
a70e59e to
fde5817
Compare
fde5817 to
488f6a4
Compare
5fcd8f2 to
4df801b
Compare
| }; | ||
| } | ||
|
|
||
| export function resolveMetaMaskPayStrategies( |
There was a problem hiding this comment.
If this is generic based on transactionType, why is all this exposed to the client and not handled in the controller?
There was a problem hiding this comment.
The idea was to based this off the original transaction pay controller API, in which TransactionPayController only knows about strategies and exposes getStrategies (previously getStrategy) specifically so the embedding client can decide the configuration. The transactionType usage is entirely optional, for defining transactionType level overrides.
Is there a chance we might want to configure the strategy selection and ordering on a client basis in the future? Or would you prefer we move the configuration to the controller?
There was a problem hiding this comment.
I think we should support the clients overriding with custom logic.
But if we're just using our generic feature flags in our own confirmations_pay flag, that can all be standardised in the controller?
| transactionMeta.type === TransactionType.perpsDeposit || | ||
| transactionMeta.type === TransactionType.perpsDepositAndOrder | ||
| ) { | ||
| if (hasPerpsDepositTransactionType(transactionMeta)) { |
There was a problem hiding this comment.
Ideally we avoid any code-owner changes in the initial PR, plus this is specific to the top level intent types, and not the nested deposit types.
| TransactionType.predictDeposit, | ||
| TransactionType.predictWithdraw, | ||
| ]; | ||
| const NEW_TRANSACTION_DETAILS_TYPES = [...MM_PAY_DETAIL_TRANSACTION_TYPES]; |
There was a problem hiding this comment.
Also here, good to move the constant, but should we defer to a separate PR for smaller code-owner PR?
06f9650 to
b31331a
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The changes are medium risk - they refactor existing logic and add new transaction types for Across strategy support, but the core flows remain the same. The feature flag gating means Across strategy won't activate unless explicitly enabled, reducing regression risk for existing flows. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
|
✅ E2E Fixture Validation — Schema is up to date |
|




Description
This PR enables MM Pay provider fallback routing and Across strategy support on mobile, so MM Pay flows can resolve an ordered provider list from
confirmations_payinstead of being hardwired to Relay. It also updates mobile MM Pay consumers to recognize the new Across child transaction types used by Perps and Predict flows across activity, confirmation, history, notifications, and metrics surfaces.The generic route-based
confirmations_paystrategy resolution has now been standardized upstream in MetaMask/core#8282. On the mobile side, this PR narrows the routing API to MM Pay-specific wrappers that derive route context from transaction metadata and consume the shared routing behavior, while keeping compatibility with the currently published@metamask/transaction-pay-controllerversion until the newer core package is available in mobile.Feature flag consumption remains mobile-driven through
confirmations_payandconfirmations_pay_post_quote. Mobile continues to own the MM Pay route-context derivation, selector wiring, controller-init integration, and the transaction-type grouping needed to support Across-based Perps and Predict deposit flows without broadening unrelated UI behavior.To enable provider fallback,
confirmations_payshould define the global strategy order, per-strategy enablement, and any transaction-specific overrides. The schema looks like this:Changelog
CHANGELOG entry: null
Related issues
Fixes:
Refs: MetaMask/core#8282
Manual testing steps
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Introduces new strategy-routing logic driven by remote feature flags and expands MM Pay transaction-type classification across UI, notifications, and metrics; incorrect routing or type grouping could impact payment flows and analytics attribution.
Overview
Enables MM Pay provider fallback routing on mobile by switching
TransactionPayControllerInitfrom a hardcoded singlegetStrategyto a feature-flag-drivengetStrategies, backed by new route/transaction helpers inutil/transactions/transaction-pay-routing.Unifies MM Pay transaction-type handling via a new
util/transactions/metamask-paymodule (use-case mapping, route type grouping, deposit/positive-transfer/detail type lists), and updates activity/history UI, notifications, gas-update logic, and analytics/metrics to recognize Across variants (e.g.,perpsAcrossDeposit,predictAcrossDeposit) and to avoid misleadingpredictClaimamount display.Adds metrics support for the Across strategy (
mm_pay_strategy: 'across') and records optional execution latency (mm_pay_execution_latency), plus refactors token-transfer decoding into a sharedtransaction-pay-token-transferutility; accompanying unit tests are expanded throughout.Written by Cursor Bugbot for commit 1e212ba. This will update automatically on new commits. Configure here.