Skip to content

fix: fix on-ramp buy navigation on token details#25709

Merged
sahar-fehri merged 5 commits intomainfrom
fix/fix-buy-with-cash-redirection
Feb 5, 2026
Merged

fix: fix on-ramp buy navigation on token details#25709
sahar-fehri merged 5 commits intomainfrom
fix/fix-buy-with-cash-redirection

Conversation

@sahar-fehri
Copy link
Copy Markdown
Contributor

@sahar-fehri sahar-fehri commented Feb 5, 2026

Description

PR to fix navigation to buy crypto with cash on the sticky buy button by passing the assetId

Changelog

CHANGELOG entry: Pass assetID to the on ramp buy screen.

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

Low Risk
Small navigation change limited to the token-details Buy fallback path; risk is mainly incorrect assetId formatting causing the on-ramp screen to open without preselecting the intended asset.

Overview
Fixes the token-details sticky Buy flow so that when no eligible swap/bridge source token exists, the app navigates to on-ramp via goToBuy({ assetId }) instead of calling goToBuy() with no context.

assetId is derived by using the token’s CAIP address directly for non-EVM assets, or generating an EVM CAIP asset id via formatAddressToAssetId(address, chainId) (with a safe fallback to undefined on errors). Tests are expanded to cover EVM vs non-EVM/trending tokens and error cases for assetId generation.

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

@sahar-fehri sahar-fehri requested a review from a team as a code owner February 5, 2026 14:07
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 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.

bergarces
bergarces previously approved these changes Feb 5, 2026
salimtb
salimtb previously approved these changes Feb 5, 2026
bergarces
bergarces previously approved these changes Feb 5, 2026
Copy link
Copy Markdown

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

auto-merge was automatically disabled February 5, 2026 19:12

Pull Request is not mergeable

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 5, 2026

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes modify the useTokenActions.ts hook to pass an assetId parameter to goToBuy() when routing to the on-ramp flow from the Token Details view. Previously, goToBuy() was called without parameters; now it generates and passes an assetId based on the token type (CAIP format for Solana tokens, converted format for EVM tokens).

This is a focused change that:

  1. Affects the "Buy" button flow in Token Details when no eligible swap tokens exist
  2. Uses formatAddressToAssetId from @metamask/bridge-controller for EVM tokens
  3. Uses isCaipAssetType from @metamask/utils to detect Solana tokens
  4. Includes comprehensive unit tests covering all scenarios (Solana tokens, EVM tokens, error handling)

The change is directly related to the Ramps feature (on-ramp/buy crypto flow), so SmokeRamps is the appropriate tag. The change is low-risk because:

  • It's a minor enhancement to pass additional context to the on-ramp navigation
  • The core functionality (routing to on-ramp) remains unchanged
  • Comprehensive unit tests were added
  • Error handling ensures graceful fallback to undefined assetId if conversion fails

While the change handles Solana tokens, it doesn't modify core Solana functionality - it just properly formats the asset ID for the on-ramp. SmokeNetworkExpansion tests Solana wallet standard compliance and transaction flows, which aren't directly affected by this navigation parameter change.

Performance Test Selection:
This change modifies a callback function to pass an additional parameter when navigating to the on-ramp. There are no UI rendering changes, no data loading changes, no state management changes, and no changes to critical user flows that would impact performance. The change is purely about passing context (assetId) to the navigation function.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Feb 5, 2026

@sahar-fehri sahar-fehri enabled auto-merge February 5, 2026 23:19
@sahar-fehri sahar-fehri added this pull request to the merge queue Feb 5, 2026
Merged via the queue into main with commit af8fe0d Feb 5, 2026
170 of 175 checks passed
@sahar-fehri sahar-fehri deleted the fix/fix-buy-with-cash-redirection branch February 5, 2026 23:42
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2026
@metamaskbot metamaskbot added the release-7.66.0 Issue or pull request that will be included in release 7.66.0 label Feb 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.66.0 Issue or pull request that will be included in release 7.66.0 size-M team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants