feat: persist pay strategy in TransactionController metamaskPay metadata - #9733
Merged
Conversation
OGPoyraz
force-pushed
the
ogp/persist-pay-strategy
branch
from
July 31, 2026 10:16
bd4f72e to
8764cb8
Compare
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ay metadata Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
OGPoyraz
force-pushed
the
ogp/persist-pay-strategy
branch
from
July 31, 2026 10:16
8764cb8 to
71afa7e
Compare
strategy in TransactionController metamaskPay metadata
OGPoyraz
marked this pull request as ready for review
July 31, 2026 10:17
pedronfigueiredo
approved these changes
Jul 31, 2026
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.transactionData(including quotes and their strategy) is not persisted, buttransactionMeta.metamaskPayis. When a MetaMask Pay transaction finalizes after the transaction data is gone (e.g. the app restarted mid-flight), clients cannot report which pay strategy funded the transaction — mobile currently has to assumerelayfor all non-fiat backfills in its metrics builder (see MetaMask/metamask-mobile#34111).This PR persists the strategy at the same point the rest of the pay metadata is synced:
@metamask/transaction-controller: adds an optionalstrategy?: stringfield toMetamaskPayMetadata.@metamask/transaction-pay-controller:syncTransaction(called fromupdateQuotes) now writes the first executable quote's strategy totx.metamaskPay.strategy. No-op quotes are already filtered out, so a direct route persists no strategy (consistent withmm_pay_strategymetrics semantics, which only count real quotes).Non-breaking: the field is optional and additive.
References
relayassumption in themm_pay_strategymetrics backfill once adopted)Checklist
Note
Low Risk
Additive optional metadata and quote-sync wiring only; no auth, signing, or transaction lifecycle changes.
Overview
Adds an optional
strategyfield on persistedmetamaskPaymetadata so clients can tell which MetaMask Pay funding route was used after in-memory pay quote data is gone (e.g. after restart).@metamask/transaction-controllerextendsMetamaskPayMetadatawithstrategy?: string.@metamask/transaction-pay-controllerpasses the first executable quote’s strategy fromupdateQuotesintosyncTransaction, which writes it alongside existing fiat totals when pay metadata is synced. Direct / no-op routes (TransactionPayStrategy.None) still count as no executable quotes, sostrategystays unset, matching existing pay-metrics semantics. Tests cover successful persistence and the no-quote case.Reviewed by Cursor Bugbot for commit 71afa7e. Bugbot is set up for automated code reviews on this repo. Configure here.