Skip to content

Conversation

@infiniteflower
Copy link
Contributor

@infiniteflower infiniteflower commented Jan 21, 2026

Explanation

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

Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3591
Related to MetaMask/metamask-mobile#25010

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

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

Written by Cursor Bugbot for commit 385b6d8. This will update automatically on new commits. Configure here.

@infiniteflower infiniteflower changed the title fix: use txMeta.actionId as a temporary key to capture tx where it fa… fix: use txMeta.actionId as a temporary key to capture tx where it fails before submission Jan 22, 2026
@infiniteflower infiniteflower changed the title fix: use txMeta.actionId as a temporary key to capture tx where it fails before submission fix: use txMeta.actionId as a temporary key to capture data for non-STX where it fails before submission Jan 22, 2026
@infiniteflower infiniteflower added the team-swaps-and-bridge Swaps and Bridge team label Jan 22, 2026
@infiniteflower infiniteflower force-pushed the swaps-3591-provider-not-set branch from ee23916 to ef54173 Compare January 22, 2026 19:31
Extract history key determination logic into a pure function to improve
test coverage. The function validates that either actionId or bridgeTxMetaId
is provided, throwing if neither is available.
Extract intent validation logic into a pure function to improve
test coverage. The function validates that intent data exists in
the quote response, throwing if missing.
@infiniteflower infiniteflower marked this pull request as ready for review January 22, 2026 20:11
@infiniteflower infiniteflower requested review from a team as code owners January 22, 2026 20:11
…istory

Since bridgeTxMeta is now optional, we don't need to pass an empty object
when adding pre-submission history. The actionId is used as the key instead.
@infiniteflower infiniteflower added this pull request to the merge queue Jan 22, 2026
Merged via the queue into main with commit 23e835c Jan 22, 2026
302 checks passed
@infiniteflower infiniteflower deleted the swaps-3591-provider-not-set branch January 22, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants