Skip to content

feat: use token search endpoint for token import flow#26108

Open
juanmigdr wants to merge 5 commits intomainfrom
feat/use-search-endpoint-for-token-import
Open

feat: use token search endpoint for token import flow#26108
juanmigdr wants to merge 5 commits intomainfrom
feat/use-search-endpoint-for-token-import

Conversation

@juanmigdr
Copy link
Member

@juanmigdr juanmigdr commented Feb 16, 2026

Description

NEEDS UPDATE TO CORE PACKAGE

Changelog

CHANGELOG entry: use token search endpoint for token import flow

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2656

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

Medium Risk
Changes the token import/search behavior and network support detection, which could impact users’ ability to find/import tokens if the probe/search API behaves unexpectedly or errors are mishandled.

Overview
Updates the Add Asset token-import flow to rely on the token search API for populating the search tab, including an upfront “probe” request to determine whether the selected network supports search and showing a loading state while that check runs.

Refactors the Add Asset UI/test surface by removing legacy token/NFT import components and their tests/snapshots (AddCustomToken, AddCustomCollectible, AssetSearch, MultiAssetListItems, SearchTokenAutocomplete) and consolidating selector IDs under ImportAssetView.testIds (plus minor header/title and import-path cleanups).

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

@juanmigdr juanmigdr enabled auto-merge February 16, 2026 13:48
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.

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

// Increment request ID to mark this as the current request
const currentRequestId = ++requestIdRef.current;
setIsLoading(true);
setIsFetching(true);
Copy link

Choose a reason for hiding this comment

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

Stale token results reappear after clearing

Medium Severity

useSearchRequest returns early for an empty debouncedQuery before advancing requestIdRef. If an earlier request resolves afterward, it is still treated as current and can repopulate results with stale tokens even though the search input is cleared.

Fix in Cursor Fix in Web

@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform, SmokeNetworkAbstractions
  • Selected Performance tags: @PerformanceAssetLoading
  • Risk Level: high
  • AI Confidence: 75%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR is a major refactoring of the AddAsset feature (Import Token and Import NFT functionality). The changes include:

  1. Complete restructuring of AddAsset component: Split into TokenView and NFTView, migrated from class-based to functional components with hooks, and adopted Tailwind-based styling.

  2. New components created: TokenView, NFTView, NetworkSelector, SearchTokenAutocomplete (refactored), SearchTokenResults (replacing MultiAssetListItems), AddCustomToken (rewritten), AddCustomCollectible (rewritten).

  3. Deleted components: Old AddCustomToken, AddCustomCollectible, MultiAssetListItems, and AssetSearch components.

  4. Test ID changes: Renamed ImportTokenView.testIds.ts to ImportAssetView.testIds.ts and merged NFT test IDs. E2E page objects (ImportNFTView.ts, ImportTokensView.ts, ConfirmAddAsset.ts) were updated to use new import paths.

  5. Search functionality changes: Now uses useSearchRequest hook with debouncing, removed useTopTokens dependency, added loading states and skeleton loaders.

The regression tests for import tokens and NFTs (import-tokens.spec.ts, import-custom-token.spec.ts, nft-details.spec.ts) use RegressionAssets tag which is not in the available smoke tags. However, the functionality being changed relates to:

  • SmokeWalletPlatform: The AddAsset feature is accessed from the wallet home screen via "Import Tokens" button. Changes to token import affect wallet platform functionality. The Trending tab's search functionality also uses the same useSearchRequest hook that was modified.

  • SmokeNetworkAbstractions: The NetworkSelector component and network selection functionality for importing tokens/NFTs on different networks is part of network management. The changes include network selector UI updates and multi-chain token filtering.

This is marked as high risk because:

  • Core wallet functionality (importing tokens/NFTs) is completely refactored
  • Multiple E2E tests depend on these components and their test IDs
  • Test IDs were renamed/moved which could break existing tests
  • Search functionality was significantly changed with new debouncing behavior

Performance Test Selection:
The changes significantly modify the token search and import functionality, including new debouncing behavior in useSearchRequest hook, new SearchTokenResults component with FlashList rendering, and skeleton loaders for loading states. These changes could impact asset loading and token list rendering performance. The @PerformanceAssetLoading tag is appropriate as it covers token list rendering and balance fetching which are directly affected by these changes.

View GitHub Actions results

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
77.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants