Skip to content

refactor: remove unused testnet config for swaps#24244

Merged
GeorgeGkas merged 4 commits intomainfrom
swaps-3594-remove-testnets
Jan 7, 2026
Merged

refactor: remove unused testnet config for swaps#24244
GeorgeGkas merged 4 commits intomainfrom
swaps-3594-remove-testnets

Conversation

@GeorgeGkas
Copy link
Copy Markdown
Contributor

@GeorgeGkas GeorgeGkas commented Jan 5, 2026

Description

In MM mobile, we define an array of allowed testnets for swaps. This is consumed only on DEV env and is used by some utilities like isSwapsAllowed. To complete the legacy migration we will have to take care of those utilities (either remove or migrate) but before that, this PR removes the dependency to testnets and reduce the tech debt of the swaps module.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3594

Manual testing steps

This PR does not introduce any business logic change, just run a basic regression test to ensure swaps functionality is not affected.

Screenshots/Recordings

Before

After

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.

Note

Removes testnet-specific swaps configuration and dev-only paths, simplifying chain gating and feature flag handling for Swaps.

  • Drops SWAPS_TESTNET_CHAIN_ID and allowedTestnetChainIds; removes __DEV__ and ONLY_MAINNET branching in isSwapsAllowed
  • Updates allowed chain lists in UI/Swaps/utils and Engine/constants to include only supported mainnets and multichain scopes
  • Simplifies getFeatureFlagChainId to identity and adjusts liveness/feature flag mapping in reducers/swaps
  • Cleans up imports and removes unused constants
  • Updates unit tests to reflect removal of testnet logic and identity getFeatureFlagChainId

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

@GeorgeGkas GeorgeGkas requested a review from a team as a code owner January 5, 2026 17:00
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 5, 2026

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 Jan 5, 2026
@github-actions github-actions bot added the size-M label Jan 5, 2026
@GeorgeGkas GeorgeGkas added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Jan 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 7, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeSwaps, SmokeTrade
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

This PR removes testnet chain support from the swaps functionality by:

  1. Removing SWAPS_TESTNET_CHAIN_ID constant from bridge.ts
  2. Removing the testnet chain ID from swapsSupportedChainIds in Engine constants (critical file)
  3. Simplifying isSwapsAllowed function to no longer include testnet chains
  4. Converting getFeatureFlagChainId to an identity function (no longer maps testnet to mainnet)
  5. Removing allowedTestnetChainIds export

The changes are focused on removing testnet support, which should not affect production users. However, since:

  • The Engine constants file is marked as critical
  • The swapsSupportedChainIds array is used by SwapsController and TokenSearchDiscoveryDataController initialization
  • The isSwapsAllowed function is used in multiple places (SendFlow, Asset views, Card components)

Running SmokeSwaps and SmokeTrade tests will verify that production swaps functionality remains intact after removing testnet support. The risk is medium because while the changes are well-scoped to testnet removal, they touch core swaps infrastructure.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Jan 7, 2026

@GeorgeGkas GeorgeGkas added this pull request to the merge queue Jan 7, 2026
Merged via the queue into main with commit 2bee8b4 Jan 7, 2026
158 of 163 checks passed
@GeorgeGkas GeorgeGkas deleted the swaps-3594-remove-testnets branch January 7, 2026 11:24
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2026
@metamaskbot metamaskbot added the release-7.62.0 Issue or pull request that will be included in release 7.62.0 label Jan 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.62.0 Issue or pull request that will be included in release 7.62.0 size-M team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants