Skip to content

Conversation

bfullam
Copy link
Contributor

@bfullam bfullam commented Sep 29, 2025

Description

Problem
Previously, swap buttons were conditionally enabled based on network-specific feature flags (isSwapsAllowed and selectIsSwapsLive), which could prevent users from accessing swap functionality even when their desired networks were technically supported. This created friction in the user experience where swap buttons would be disabled based on the current network's feature flag status. With the introduction of BIP44 support, this approach became unnecessarily restrictive since all networks are now enabled at all times.

Solution
Removed the isSwapsAllowed and selectIsSwapsLive dependencies from swap button enabling logic, allowing swap buttons to be always enabled when basic functionality requirements are met (user can sign transactions and basic functionality is enabled). Users can now always click the swap button regardless of their current network, and the swap flow will appropriately handle routing them to a supported chain for their desired swap operation. This change leverages the BIP44 implementation where all networks are available, providing a more seamless user experience.

Changelog

CHANGELOG entry: Made swaps button enabled at all times, regardless of network

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

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 network-based gating for swaps, simplifies enablement to basic functionality/signing, drops chainId prop from AssetDetailsActions, and adds ETH mainnet fallback in swap/bridge navigation.

  • Swaps enablement:
    • Simplify selectIsSwapsEnabled to only check selectCanSignTransactions and selectBasicFunctionalityEnabled (no chainId/liveness dependency).
  • UI updates:
    • AssetDetailsActions: remove chainId prop; internal selector updated to selectIsSwapsEnabled(state); all callers (AssetOverview, Wallet) stop passing chainId.
    • Swap button visibility logic simplified across Wallet, Asset, WalletActions, and TradeWalletActions to remove isSwapsAllowed/network checks; now depends on AppConstants.SWAPS.ACTIVE (and per-asset checks where applicable).
    • UrlAutocomplete/Result: remove isSwapsAllowed from swapsEnabled condition.
  • Navigation:
    • useSwapBridgeNavigation: when no sourceToken, fallback to ETH on mainnet instead of returning; minor refactor around sourceToken assignment.
  • Tests/Stories:
    • Update/trim tests and stories to reflect removed network gating and chainId prop; adjust mocks accordingly.

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

@bfullam bfullam requested review from a team as code owners September 29, 2025 15:35
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 Sep 29, 2025
cursor[bot]

This comment was marked as outdated.

@github-actions github-actions bot added size-M and removed size-S labels Sep 30, 2025
cursor[bot]

This comment was marked as outdated.

@bfullam bfullam added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Sep 30, 2025
@bfullam
Copy link
Contributor Author

bfullam commented Sep 30, 2025

Skipping sonar cloud because failures are related to intentional code duplication.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
11.1% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube Cloud

@bfullam bfullam added this pull request to the merge queue Oct 1, 2025
Merged via the queue into main with commit 8eaedc4 Oct 1, 2025
164 of 169 checks passed
@bfullam bfullam deleted the swaps-3011-swaps-CTA-always-enabled branch October 1, 2025 10:37
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2025
@metamaskbot metamaskbot added the release-7.57.0 Issue or pull request that will be included in release 7.57.0 label Oct 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.57.0 Issue or pull request that will be included in release 7.57.0 size-M skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-swaps-and-bridge Swaps and Bridge team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants