Skip to content

fix: Send/receive asset selection should handle unsupported assets (#3311) - #12526

Open
joan-bisbal wants to merge 3 commits into
shapeshift:developfrom
joan-bisbal:fix/unsupported-asset-selection
Open

fix: Send/receive asset selection should handle unsupported assets (#3311)#12526
joan-bisbal wants to merge 3 commits into
shapeshift:developfrom
joan-bisbal:fix/unsupported-asset-selection

Conversation

@joan-bisbal

@joan-bisbal joan-bisbal commented Aug 4, 2026

Copy link
Copy Markdown

Fixes #3311

When navigating within an asset view, opening the send/receive modal, and clicking back, the full list of all supported assets is displayed—including assets unsupported by the user's connected wallet.

This PR fixes the issue by ensuring that the fallback \portfolioAssetsSortedByBalance\ is properly filtered against \walletConnectedChainIds\ when \�llowWalletUnsupportedAssets\ is falsy (which is the case for Send/Receive modals).

Summary by CodeRabbit

  • Bug Fixes
    • Portfolio asset search now filters out assets on chains unsupported by the connected wallet.
    • Unsupported assets can no longer be selected when wallet restrictions apply.

@joan-bisbal
joan-bisbal requested a review from a team as a code owner August 4, 2026 22:28
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@joan-bisbal, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b76490bf-628e-467d-b78a-54d0e5bcac9e

📥 Commits

Reviewing files that changed from the base of the PR and between 0230ab5 and bd25464.

📒 Files selected for processing (3)
  • src/components/TradeAssetSearch/TradeAssetSearch.tsx
  • src/components/TradeAssetSearch/helpers/filterAssetsByChain/filterAssetsByChain.test.ts
  • src/components/TradeAssetSearch/helpers/filterAssetsByChain/filterAssetsByChain.ts
📝 Walkthrough

Walkthrough

Trade asset search now excludes portfolio assets from chains unsupported by the connected wallet when unsupported assets are disallowed. The memoized filter tracks wallet state, supported chains, and the configuration setting.

Changes

Asset search filtering

Layer / File(s) Summary
Apply wallet chain filtering
src/components/TradeAssetSearch/TradeAssetSearch.tsx
Portfolio assets use the existing predicate and exclude assets from unsupported chains when wallet restrictions apply. Memoization dependencies include wallet state, supported chains, and the unsupported-asset setting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit checks the wallet’s chain,
Unsupported assets leave the pane.
The filter tracks each change,
Across every supported range,
While valid choices remain.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the fix for unsupported assets in Send/receive asset selection.
Linked Issues check ✅ Passed The change filters fallback asset lists by connected-wallet chain support, satisfying the requirements in [#3311].
Out of Scope Changes check ✅ Passed The changes are limited to filtering unsupported assets in the Send/receive asset selection flow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/components/TradeAssetSearch/TradeAssetSearch.tsx (2)

218-222: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for wallet-supported portfolio filtering.

Please add or verify tests for these cases:

  • A connected wallet with allowWalletUnsupportedAssets === false excludes unsupported chains.
  • A connected wallet with allowWalletUnsupportedAssets === true retains those assets.
  • No connected wallet does not filter by walletConnectedChainIds.

Use assets with both supported and unsupported asset.chainId values. This directly covers the back-navigation regression.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/TradeAssetSearch/TradeAssetSearch.tsx` around lines 218 - 222,
Add regression tests for the portfolio filtering logic in TradeAssetSearch,
covering supported and unsupported asset.chainId values. Verify that a connected
wallet excludes unsupported chains when allowWalletUnsupportedAssets is false,
retains them when true, and that no connected wallet leaves all assets
unfiltered by walletConnectedChainIds.

215-215: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add explicit types to the new filter callbacks.

The callbacks at Line 215 and Line 220 rely on contextual inference. Add (asset: Asset): boolean to both callbacks.

As per coding guidelines, TypeScript function parameters and return values must be explicit.

Proposed change
-      asset => assetFilterPredicate?.(asset.assetId) ?? true,
+      (asset: Asset): boolean => assetFilterPredicate?.(asset.assetId) ?? true,
...
-        asset => walletConnectedChainIds.includes(asset.chainId),
+        (asset: Asset): boolean => walletConnectedChainIds.includes(asset.chainId),

Run pnpm run lint --fix and pnpm run type-check after the change.

Also applies to: 220-220

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/TradeAssetSearch/TradeAssetSearch.tsx` at line 215, Update
both filter callbacks in the TradeAssetSearch filtering logic (the callbacks at
the referenced lines) to explicitly declare the parameter as Asset and the
return type as boolean, including the callback using assetFilterPredicate?.
Preserve their existing filtering behavior, then run pnpm run lint --fix and
pnpm run type-check.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/components/TradeAssetSearch/TradeAssetSearch.tsx`:
- Around line 218-222: Add regression tests for the portfolio filtering logic in
TradeAssetSearch, covering supported and unsupported asset.chainId values.
Verify that a connected wallet excludes unsupported chains when
allowWalletUnsupportedAssets is false, retains them when true, and that no
connected wallet leaves all assets unfiltered by walletConnectedChainIds.
- Line 215: Update both filter callbacks in the TradeAssetSearch filtering logic
(the callbacks at the referenced lines) to explicitly declare the parameter as
Asset and the return type as boolean, including the callback using
assetFilterPredicate?. Preserve their existing filtering behavior, then run pnpm
run lint --fix and pnpm run type-check.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ecde0be5-9c79-4ece-88e6-919cd8a87601

📥 Commits

Reviewing files that changed from the base of the PR and between 90f7ef1 and fd043c8.

📒 Files selected for processing (1)
  • src/components/TradeAssetSearch/TradeAssetSearch.tsx

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Send/receive asset selection should handle unsupported assets

1 participant