-
Notifications
You must be signed in to change notification settings - Fork 629
[MNY-338] Add filters when fetching chains in chain selection ui #8573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 9c04b3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughAdds query-parameter filtering and testnet option to bridge chains API; introduces option-driven hooks (useBridgeChains, useBridgeChain, useBridgeChainsWithFilters); and threads new filter props (type, selections) through bridge token/chain selection components and stories. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant UI as Swap / SelectToken UI
participant SelectChain as SelectBridgeChain Component
participant Hook as useBridgeChainsWithFilters / useBridgeChain
participant API as chains() Endpoint
User->>UI: Open chain/token selector (provides type & selections)
UI->>SelectChain: Render with props (type, selections)
SelectChain->>Hook: Request chains (map type/selections → chains.Options)
activate Hook
Hook->>API: GET /chains?{testnet?, filter params based on type/origin/destination, originChainId?, destinationChainId?}
activate API
API-->>Hook: Return filtered chains
deactivate API
Hook-->>SelectChain: Deliver data + isPending
deactivate Hook
SelectChain->>UI: Render chain list or skeletons
UI->>User: Display chains and accept selection
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (5)
🧰 Additional context used📓 Path-based instructions (4)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
packages/thirdweb/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{js,jsx,ts,tsx,json}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧬 Code graph analysis (2)packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (10)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8573 +/- ##
==========================================
- Coverage 53.24% 53.19% -0.05%
==========================================
Files 922 922
Lines 61414 61480 +66
Branches 4026 4032 +6
==========================================
+ Hits 32699 32706 +7
- Misses 28617 28676 +59
Partials 98 98
🚀 New features to boost your workflow:
|
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/thirdweb/src/react/web/ui/ConnectWallet/constants.ts (1)
23-23: Verify the timing adjustment resolves the coordination issue.The increased delay from 100ms to 200ms adds an extra 100ms to the modal unmount sequence (total 450ms). While this likely addresses a race condition in the swap widget modal interactions, ensure that:
- The extra delay resolves the intended timing issue.
- The added latency doesn't negatively impact perceived UX during rapid modal transitions.
Consider adding a brief comment explaining why 200ms is needed (e.g., to allow for cleanup after modal fade-out in swap flows), as this would improve maintainability per the SDK coding guidelines.
packages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsx (1)
19-109: Consider adding stories to demonstrate filter variations.All four stories use identical filter props:
type="buy"with bothbuyChainIdandsellChainIdset toundefined. Consider adding additional story variants to showcase:
type="sell"filtering- Scenarios where
buyChainIdorsellChainIdare defined- How the filter state affects the displayed chains
This would provide better documentation of the filtering feature and help catch edge cases.
Example additional story:
export function WithSellTypeAndSelectedBuyChain() { const [selectedChain, setSelectedChain] = useState<BridgeChain | undefined>( undefined, ); return ( <SwapWidgetContainer theme="dark" className="w-full"> <SelectBridgeChain type="sell" selections={{ buyChainId: 1, // Ethereum mainnet selected sellChainId: undefined, }} isMobile={false} client={storyClient} onSelectChain={setSelectedChain} onBack={() => {}} selectedChain={selectedChain} /> </SwapWidgetContainer> ); }packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsx (1)
136-140: Add keys to skeleton components.The skeleton components are rendered without keys, which React will warn about. While the biome-ignore comment suppresses the linter, React's reconciliation can still be inefficient without keys.
Apply this diff to add keys:
{props.isPending && - new Array(20).fill(0).map(() => ( - // biome-ignore lint/correctness/useJsxKeyInIterable: ok + new Array(20).fill(0).map((_, i) => ( - <ChainButtonSkeleton isMobile={props.isMobile} /> + <ChainButtonSkeleton key={i} isMobile={props.isMobile} /> ))}
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (10)
.changeset/dry-wasps-love.md(1 hunks)packages/thirdweb/src/bridge/Chains.ts(3 hunks)packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx(3 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx(1 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsx(4 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx(7 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx(9 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.ts(2 hunks)packages/thirdweb/src/react/web/ui/ConnectWallet/constants.ts(1 hunks)packages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsx(4 hunks)
✅ Files skipped from review due to trivial changes (2)
- .changeset/dry-wasps-love.md
- packages/thirdweb/src/bridge/Chains.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx
- packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
- packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each TypeScript file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes in TypeScript
Avoidanyandunknownin TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial,Pick, etc.) in TypeScript
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity and testability
Re-use shared types from @/types or local types.ts barrel exports
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics whenever possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic in TypeScript files; avoid restating TypeScript types and signatures in prose
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsxpackages/thirdweb/src/react/web/ui/ConnectWallet/constants.tspackages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsxpackages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.tspackages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
packages/thirdweb/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/thirdweb/src/**/*.{ts,tsx}: Comment only ambiguous logic in SDK code; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (e.g.const { jsPDF } = await import("jspdf");)Lazy-load heavy dependencies inside async paths to keep the initial bundle lean (e.g., const { jsPDF } = await import('jspdf');)
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsxpackages/thirdweb/src/react/web/ui/ConnectWallet/constants.tspackages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsxpackages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.tspackages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
**/*.{js,jsx,ts,tsx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Biome governs formatting and linting; its rules live in biome.json. Run
pnpm fix&pnpm lintbefore committing, ensure there are no linting errors
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsxpackages/thirdweb/src/react/web/ui/ConnectWallet/constants.tspackages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsxpackages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.tspackages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Lazy-import optional features; avoid top-level side-effects
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsxpackages/thirdweb/src/react/web/ui/ConnectWallet/constants.tspackages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsxpackages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.tspackages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
**/*.stories.tsx
📄 CodeRabbit inference engine (CLAUDE.md)
Add Storybook stories (
*.stories.tsx) alongside new UI components for documentation
Files:
packages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsx
**/*.stories.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
For new UI components, add Storybook stories (*.stories.tsx) alongside the code
Files:
packages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsx
🧬 Code graph analysis (2)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.ts (2)
packages/thirdweb/src/bridge/Chains.ts (1)
chains(55-100)packages/thirdweb/src/exports/thirdweb.ts (1)
ThirdwebClient(25-25)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.ts (1)
useBridgeChain(33-45)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: Build Packages
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Unit Tests
- GitHub Check: Lint Packages
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Size
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
213-228: Verify the selection state logic for buy flow.The
SelectTokenmodal is invoked withtype="buy"andselections.buyChainIdset to the currently selected token's chain. However, when opening a token selection modal of type"buy", the user is selecting a destination (buy) chain, so the already-selected destination chain shouldn't constrain the available options.Based on the
useBridgeChainsWithFilterslogic:
type="buy"withsellChainId=undefinedmaps to{ type: "destination" }, showing all destination chains ✓- The
buyChainIdvalue is ignored in this caseWhile the current implementation is functionally correct, the state model might be clearer if
selectionswere structured differently or if there were a comment explaining whybuyChainIdis passed but not used for filtering in the buy flow.Consider adding a comment to clarify the selection state:
<SelectToken type="buy" selections={{ + // buyChainId tracks the selected destination but doesn't filter chains in buy flow buyChainId: props.selectedToken?.chainId, sellChainId: undefined, }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx (1)
274-320: Fix typo and address fragile modal timing workaround.Line 303 contains a typo: "unnecessay" should be "unnecessary".
The delayed buyToken assignment (lines 305-310) relies on
onModalUnmount, which uses a hardcoded timeout of 450ms rather than actually detecting modal unmount. This approach is fragile and will break if:
- The modal animation duration (
modalCloseFadeOutDuration) changes- User interactions occur during the delay window
- Multiple token selections happen in rapid succession
Consider tracking modal unmount state explicitly (e.g., via a ref or state flag) or using a proper animation end callback instead of relying on a magic timeout.
🧹 Nitpick comments (2)
.changeset/dry-wasps-love.md (1)
5-5: Minor grammar improvement.The phrasing could be slightly more polished. Consider: "A more reliable list of chains shown in the token selection UI in SwapWidget based on origin and destination chain selections" or "Improved reliability of the chains list shown in the token selection UI in SwapWidget based on origin and destination chain selections."
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.ts (1)
33-45: Consider optimizinguseBridgeChainto conditionally fetch.The hook always fetches all chains even when
chainIdis undefined, which is wasteful. While the result is cached (mitigating repeated fetches), the initial load could be optimized.🔎 Proposed optimization
export function useBridgeChain({ chainId, client, }: { chainId: number | undefined; client: ThirdwebClient; }) { - const chainQuery = useBridgeChains({ client }); + const chainQuery = useBridgeChains({ + client, + enabled: chainId !== undefined + }); return { data: chainQuery.data?.find((chain) => chain.chainId === chainId), isPending: chainQuery.isPending, }; }Note: This assumes
useBridgeChainssupports anenabledoption. If not, you could wrap it in a conditional or updateuseQuerydirectly with an enabled flag.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (10)
.changeset/dry-wasps-love.md(1 hunks)packages/thirdweb/src/bridge/Chains.ts(3 hunks)packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx(3 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx(1 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsx(4 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx(7 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx(9 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.ts(2 hunks)packages/thirdweb/src/react/web/ui/ConnectWallet/constants.ts(1 hunks)packages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsx(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
- packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
- packages/thirdweb/src/bridge/Chains.ts
- packages/thirdweb/src/stories/Bridge/Swap/SelectChain.stories.tsx
- packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
- packages/thirdweb/src/react/web/ui/ConnectWallet/constants.ts
- packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each TypeScript file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes in TypeScript
Avoidanyandunknownin TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial,Pick, etc.) in TypeScript
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity and testability
Re-use shared types from @/types or local types.ts barrel exports
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics whenever possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic in TypeScript files; avoid restating TypeScript types and signatures in prose
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.tspackages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsxpackages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx
packages/thirdweb/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/thirdweb/src/**/*.{ts,tsx}: Comment only ambiguous logic in SDK code; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (e.g.const { jsPDF } = await import("jspdf");)Lazy-load heavy dependencies inside async paths to keep the initial bundle lean (e.g., const { jsPDF } = await import('jspdf');)
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.tspackages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsxpackages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx
**/*.{js,jsx,ts,tsx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Biome governs formatting and linting; its rules live in biome.json. Run
pnpm fix&pnpm lintbefore committing, ensure there are no linting errors
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.tspackages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsxpackages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Lazy-import optional features; avoid top-level side-effects
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.tspackages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsxpackages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx
🧬 Code graph analysis (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.ts (2)
packages/thirdweb/src/bridge/Chains.ts (1)
chains(55-100)packages/thirdweb/src/exports/thirdweb.ts (1)
ThirdwebClient(25-25)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Unit Tests
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Size
- GitHub Check: Lint Packages
- GitHub Check: Build Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-bridge-chains.ts (2)
5-31: LGTM! Hook refactored to accept filter options.The signature change from
clientparameter tooptionsobject properly supports the new filtering capabilities. The queryKey correctly includes the full options object to ensure proper cache separation for different filter combinations.
47-80: LGTM! Filter mapping logic correctly implements the API contract.The conditional logic properly maps buy/sell types to origin/destination filters:
- Buy mode with sellChainId → originChainId (destinations reachable from origin)
- Buy mode without selection → type="destination" (all possible destinations)
- Sell mode with buyChainId → destinationChainId (origins that can reach destination)
- Sell mode without selection → type="origin" (all possible origins)
This matches the API behavior documented in the comments and the relevant code snippets.
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-chain.tsx (2)
18-53: LGTM! Chain selection properly integrated with filtering.The component correctly:
- Switched to
useBridgeChainsWithFiltersfor filtered chain fetching- Accepts and threads through
typeandselectionsprops- Passes buy/sell chain IDs to enable origin/destination filtering
The hook integration aligns with the new filtering architecture introduced across the Bridge UI components.
139-180: LGTM! Skeleton made responsive based on mobile state.The
ChainButtonSkeletonnow correctly adapts icon size, text height, and padding based on theisMobileprop, ensuring consistent responsive behavior with the actual chain buttons.packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx (2)
230-272: LGTM! Buy token modal correctly passes filter props.The buy token modal now receives:
type="buy"to fetch destination chainsselectionswith current buy/sell chain IDs to enable filtered fetchingThis enables the chain selection UI to show only relevant chains based on the current sell chain selection.
689-925: LGTM! TokenSection refactored to use single-chain fetching.The component now:
- Accepts
selectionprop with buy/sell chain IDs for filter coordination- Uses
useBridgeChainto fetch chain data for the selected token- Properly handles undefined chain scenarios
Note: As mentioned in the review of
use-bridge-chains.ts,useBridgeChainfetches all chains even whenchainIdis undefined, which could be optimized. However, caching mitigates the performance impact.
Merge activity
|
<!--
## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"
If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):
## Notes for the reviewer
Anything important to call out? Be sure to also clarify these in your comments.
## How to test
Unit tests, playground, etc.
-->
<!-- start pr-codex -->
---
## PR-Codex overview
This PR enhances the `SwapWidget` and related components by improving the chain selection logic and UI responsiveness, introducing a more reliable token selection process, and adjusting the timeout for modal unmounting.
### Detailed summary
- Updated `setTimeout` duration in `onModalUnmount` to 200ms.
- Changed `useBridgeChains` to `useBridgeChain` for better chain fetching.
- Added `type` and `selections` props to various components for handling buy/sell logic.
- Implemented a new `useBridgeChainsWithFilters` function for filtered chain queries.
- Enhanced UI components to accommodate new selection logic.
- Improved loading states and mobile responsiveness in `SelectBridgeChain` and `SelectToken`.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
- Bridge filtering now supports testnet and mutually exclusive origin/destination filters.
- Token selection accepts operation context (buy/sell) and selected-chain hints.
* **Improvements**
- Filter-driven chain lists yield more relevant token choices.
- Loading skeletons adapt sizing for mobile and desktop.
- Deferred buy-token assignment reduces redundant fetches during modal close.
- Slightly longer modal unmount delay for smoother transitions.
<sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
34f10d2 to
9c04b3f
Compare

PR-Codex overview
This PR focuses on enhancing the
SwapWidgetand related components by improving the handling of chain selections and adding new properties for better functionality and user experience.Detailed summary
onModalUnmountfunction.useBridgeChainstouseBridgeChainfor better chain data retrieval.typeandselectionsproperties in several components for improved token selection.Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.