-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: Swaps metrics provider not set #25010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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. |
a541798 to
4233c7f
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThe changes affect two key areas:
SmokeTrade is selected because:
SmokeWalletPlatform is selected because:
The changes are additive (new condition for unified swaps, fallback lookup) and include unit tests, making this a medium-risk change. The unit test file adds comprehensive coverage for the new actionId lookup functionality. |
|
…TX where it fails before submission (#7696) ## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> This PR changes the way that `BridgeStatusController`'s history items are keyed for non-STX to improve status tracking and addressing some gaps in analytics. 1. Generate a custom `actionId`, key `historyItem` by `actionId` and add to state BEFORE submitting tx. Previously we would not even have a `historyItem`, if the the tx failed before being submitted on chain. 2. Pass `actionId` to `TransactionController.addTransaction()` as a part of the request 3. For txs that actually get submitted on chain, rekey their `actionId` to their `txMeta.id` 4. On `transactionFailed` use `txMeta.actionId` to identify txs that failed before actually being submitted on chain and handle metrics You can test this by using a Smart Account on Polygon and attempting to do a USDT > POL swap that requires an approval. You should see error `In flight transaction limit reached for delegate accounts` in the logs. When you check Mixpanel, the `provider` field should be properly filled out. A video of the whole process in in MetaMask/metamask-mobile#25010. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3591 Related to MetaMask/metamask-mobile#25010 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [x] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Improves robustness of transaction tracking and analytics around pre-submission failures. > > - Use `actionId` as a temporary history key for non-batch EVM submissions; store `actionId` in `BridgeHistoryItem` and rekey to `txMeta.id` after successful submission (updating `txMetaId` and `srcTxHash`) > - On `TransactionController:transactionFailed`, look up history by `txMeta.id` then `actionId` to mark failed and track metrics; skip tracking for `rejected` status > - Enforce `bridgeTxMeta.id` requirement in `startPollingForBridgeTxStatus`; exclude items without `txMetaId` from restart polling > - Add `getHistoryKey` and `getIntentFromQuote` utils; make `BridgeHistoryItem.txMetaId` optional and `StartPollingForBridgeTxStatusArgs.bridgeTxMeta` optional; expand tests and snapshots accordingly > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 385b6d8. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->



Description
This PR attempts to look up historyItems by
actionIdwhere possible in order to set theproviderfield properly in analytics on failed txs.It also fixes an issue where swaps were not being picked up properly on the tx activity list. Also if you notice, there is no more flash of
Swaps Transactionanymore before turning intoSwap X to Y, this is because we now always have thehistoryItemdata for non-STX txs.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3591
Related to MetaMask/core#7696
Manual testing steps
Screenshots/Recordings
Before
After
Screen.Recording.2026-01-22.at.1.21.27.PM.mov
Pre-merge author checklist
Pre-merge reviewer checklist