Skip to content

Conversation

@infiniteflower
Copy link
Contributor

@infiniteflower infiniteflower commented Jun 17, 2025

Description

This PR handles Unified Swaps routing, network, and token selection. It's hidden behind an env var and a feature flag, so there is no risk of accidentally exposing this feature before it's ready.

Related issues

Resolves: https://consensyssoftware.atlassian.net/browse/MMS-2341

Manual testing steps

Setup

  1. Add export MM_UNIFIED_SWAPS_ENABLED="true" to .js.env
  2. Terminal: source .js.env
  3. Start the app up

Swaps

  1. Go to Swaps (notice there's no Bridge button anymore)
  2. Request a quote for a source and dest token with the same chain

Bridge

  1. Go to Swaps (notice there's no Bridge button anymore)
  2. Request a quote for a source and dest token with a different chain

Feature flags

  1. Add export MM_UNIFIED_SWAPS_ENABLED="false" to .js.env
  2. Terminal: source .js.env
  3. Start the app up
  4. You should see 2 buttons for Swap and Bridge
  5. Swap btn should take you to Legacy Swaps
  6. Bridge btn should take you to Bridge

Screenshots/Recordings

Before

After

Bridge

Screen.Recording.2025-06-19.at.5.54.00.PM.mov

Swap

Screen.Recording.2025-06-19.at.5.46.23.PM.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@github-actions
Copy link
Contributor

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.

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Jun 17, 2025
@infiniteflower infiniteflower added QA Passed QA testing has been completed and passed Run Smoke E2E labels Jun 18, 2025
@infiniteflower infiniteflower force-pushed the mms-2341-unified-swaps branch from 2417c41 to 0eaa817 Compare June 19, 2025 16:19
@github-actions
Copy link
Contributor

github-actions bot commented Jun 19, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 2c51102
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/1eeca6ff-6b13-4dea-bc57-7837a1c861db

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@github-actions
Copy link
Contributor

github-actions bot commented Jun 19, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: b01cd90
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/fe628443-c6f5-40f8-8c2f-0b1d129c80c3

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions
Copy link
Contributor

github-actions bot commented Jun 20, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: dfd143b
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/2f897550-3f66-4efc-8556-e78125657899

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions
Copy link
Contributor

github-actions bot commented Jun 20, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 6103316
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/356ca19c-9476-4b2c-a9b3-5b6428240236

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions
Copy link
Contributor

github-actions bot commented Jul 10, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 4ab5eac
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/df1d5ad4-33fd-4c4d-afb1-5fbef5443453

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Swap Logic Fails Initial State Check

The isSwap determination logic was changed from bridgeViewMode to sourceToken?.chainId === destToken?.chainId. This new logic incorrectly classifies the initial state (when both tokens are undefined) as a swap, causing the button to display "Confirm swap". Furthermore, it broadly assumes all same-chain operations are swaps, which may not be accurate for all bridge scenarios, leading to incorrect button labels and potential user confusion.

app/components/UI/Bridge/Views/BridgeView/index.tsx#L338-L339

const isSwap = sourceToken?.chainId === destToken?.chainId;

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@sonarqubecloud
Copy link

Copy link
Contributor

@tommasini tommasini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment, but if I'm missing something and we do not need to address it, feel free to resolve it

@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Jul 10, 2025
@bfullam bfullam added this pull request to the merge queue Jul 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 10, 2025
@bfullam bfullam added this pull request to the merge queue Jul 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 10, 2025
@bfullam bfullam added this pull request to the merge queue Jul 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 10, 2025
@bfullam bfullam added this pull request to the merge queue Jul 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 10, 2025
@bfullam bfullam added this pull request to the merge queue Jul 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 10, 2025
@bfullam bfullam added this pull request to the merge queue Jul 10, 2025
Merged via the queue into main with commit e926bf7 Jul 10, 2025
54 of 58 checks passed
@bfullam bfullam deleted the mms-2341-unified-swaps branch July 10, 2025 13:15
@github-project-automation github-project-automation bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Jul 10, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jul 10, 2025
@metamaskbot metamaskbot added the release-7.52.0 Issue or pull request that will be included in release 7.52.0 label Jul 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed QA testing has been completed and passed release-7.52.0 Issue or pull request that will be included in release 7.52.0 team-swaps-and-bridge Swaps and Bridge team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.