Skip to content

fix: MUSD-225 Update "Get mUSD" CTA to respect network filter when creating mUSD conversion tx#24907

Merged
Matt561 merged 3 commits into
mainfrom
fix/musd-225-buy-get-cta-doesnt-take-network-filter-into-account-when-redirecting
Jan 19, 2026
Merged

fix: MUSD-225 Update "Get mUSD" CTA to respect network filter when creating mUSD conversion tx#24907
Matt561 merged 3 commits into
mainfrom
fix/musd-225-buy-get-cta-doesnt-take-network-filter-into-account-when-redirecting

Conversation

@Matt561
Copy link
Copy Markdown
Contributor

@Matt561 Matt561 commented Jan 19, 2026

Description

Updated "Get mUSD" CTA to respect network filter when creating mUSD conversion tx. If no supported asset exists on the selected network, we fallback to the first available.

Previously, we ignored the network filter and always selected the first eligible token even if it was on another network.

Changelog

CHANGELOG entry: updated get mUSD cta to respect network filter when creating mUSD conversion tx

Related issues

Fixes: MUSD-225: Buy/Get CTA doesn't take selected chain into account when pre-selecting output chain and payment token

Manual testing steps

Feature: mUSD conversion respects selected network filter

  Scenario: user initiates mUSD conversion with a selected network filter
    Given the user has eligible conversion tokens on multiple networks
    And the user has filtered their asset list to a specific network

    When the user taps "Get mUSD"
    Then the app uses a payment token on the selected network when one is available
    And the conversion output network matches the chosen payment token network

  Scenario: user initiates mUSD conversion when selected network has no eligible token
    Given the user has eligible conversion tokens
    And the user has filtered their asset list to a network with no eligible token

    When the user taps "Get mUSD"
    Then the app falls back to the first available eligible token
    And the conversion output network matches the fallback token network

Screenshots/Recordings

Before

First eligible token on any chain was selected

After

First eligible token on selected network selected. Falls back to first eligible on any network if user's selected network doesn't have eligible tokens.

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

Aligns mUSD conversion to the selected network when available, improving token/chain preselection.

  • Updates MusdConversionAssetListCta to pick preferredPaymentToken from selectedChainId (falls back to tokens[0]) and sets outputChainId via getMusdOutputChainId(paymentToken.chainId)
  • Normalizes addresses and chain IDs using toChecksumAddress and toHex
  • Adds tests covering selected-network token usage, fallback behavior, and preserves existing CTA/telemetry behaviors

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

@Matt561 Matt561 added No QA Needed Apply this label when your PR does not need any QA effort. team-earn labels Jan 19, 2026
@Matt561 Matt561 marked this pull request as ready for review January 19, 2026 21:13
@Matt561 Matt561 requested a review from a team as a code owner January 19, 2026 21:13
@github-actions
Copy link
Copy Markdown
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.

@Matt561 Matt561 force-pushed the fix/musd-225-buy-get-cta-doesnt-take-network-filter-into-account-when-redirecting branch from 45884b4 to 038e21a Compare January 19, 2026 21:14
Copy link
Copy Markdown
Contributor

@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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@Matt561 Matt561 force-pushed the fix/musd-225-buy-get-cta-doesnt-take-network-filter-into-account-when-redirecting branch from e110280 to 413ef8e Compare January 19, 2026 21:41
shane-t
shane-t previously approved these changes Jan 19, 2026
@Matt561 Matt561 enabled auto-merge January 19, 2026 22:19
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

The changes are limited to the MusdConversionAssetListCta component in the Earn/Musd feature. The code change improves token selection logic to respect network filters when initiating mUSD conversion - preferring tokens from the selected chain if available, otherwise falling back to the first token.

Key observations:

  1. The changes are isolated to a specific feature component (mUSD conversion CTA)
  2. Two comprehensive unit tests were added to cover the new logic
  3. No E2E tests exist for mUSD or Earn features in the codebase
  4. The component is used in the Tokens list view but the change doesn't affect core wallet functionality
  5. The logic change is straightforward and well-tested at the unit level

Since there are no E2E tests for this feature and the changes are well-covered by unit tests, running E2E tests would not provide additional coverage for these specific changes. The risk is low as this is a localized UI component change with proper test coverage.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@Matt561 Matt561 added this pull request to the merge queue Jan 19, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 19, 2026
@Matt561 Matt561 added this pull request to the merge queue Jan 19, 2026
Merged via the queue into main with commit 406ebb1 Jan 19, 2026
57 checks passed
@Matt561 Matt561 deleted the fix/musd-225-buy-get-cta-doesnt-take-network-filter-into-account-when-redirecting branch January 19, 2026 23:23
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 19, 2026
@metamaskbot metamaskbot added the release-7.63.0 Issue or pull request that will be included in release 7.63.0 label Jan 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. release-7.63.0 Issue or pull request that will be included in release 7.63.0 size-M team-earn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants