-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: Navigation behavior from PerpsHomeScreenSearch #22013
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
## **Description** This PR fixes an issue where HIP-3 markets (stocks and commodities) with $0.00 volume were incorrectly displayed in the Market List View and Home View. **What was the problem?** - Markets with zero or invalid volume data were showing up in the Stocks and Commodities tabs - This was inconsistent with how crypto perps markets behave (they correctly hide zero-volume markets) **What is the solution?** - Zero-volume markets are now filtered out consistently across all market types - Filtering logic moved to the data layer for consistency - Both Market List View and Home View now hide markets with $0.00 volume by default ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1957 ## **Manual testing steps** ```gherkin Feature: Hide zero-volume HIP-3 markets Scenario: user views Market List View stocks tab Given app is running and Perps feature is enabled When user navigates to Market List View And user selects the "Stocks" tab Then user should only see stocks with valid volume data And user should NOT see any markets displaying "$0.00" volume Scenario: user views Market List View commodities tab Given app is running and Perps feature is enabled When user navigates to Market List View And user selects the "Commodities" tab Then user should only see commodities with valid volume data And user should NOT see any markets displaying "$0.00" volume Scenario: user views Perps Home View Given app is running and Perps feature is enabled When user navigates to Perps Home View Then user should only see markets with valid volume data in all carousels And user should NOT see any markets displaying "$0.00" volume ``` ## **Screenshots/Recordings** ### **Before** Markets with $0.00 volume were visible in the Stocks tab and other HIP-3 market tabs. ### **After** Only markets with valid volume data are displayed. Zero-volume markets are filtered out consistently. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Overhauls Perps Markets and Home with searchable/sortable tabs, consistent zero‑volume filtering, bulk Close/Cancel All flows, market hours banner/tooltip, refined leverage priority, and extensive hook/test updates. > > - **UI/Navigation**: > - **Home**: New `PerpsHomeView` with positions/orders sections, watchlist, market type sections, navigation card, and bottom sheets for Close All/Cancel All. > - **Market List**: Reworked `PerpsMarketListView` with tabs (All/Crypto/Stocks & Commodities), search header, sorting/filters, and reusable `PerpsMarketList`/row components. > - **Bulk Actions**: Added `PerpsCloseAllPositionsView`/`PerpsCancelAllOrdersView` and modal variants; shared `PerpsCloseSummary`. > - **Market Hours**: Added `PerpsMarketHoursBanner` and bottom-sheet tooltip content. > - **Hooks/Logic**: > - **Data**: New `usePerpsHomeData`, `usePerpsMarketListView`, `usePerpsSearch`, `usePerpsSorting`; consistent zero‑volume filtering moved to `usePerpsMarkets` (opt‑in via `showZeroVolume`). > - **Bulk Ops**: `usePerpsCloseAllCalculations`, `usePerpsCloseAllPositions`, `usePerpsCancelAllOrders` for fees/points and execution. > - **Streams**: `usePerpsLiveFills` now returns `{ fills, isInitialLoading }`. > - **Orders**: Leverage priority: nav param > existing position > saved config > default; validation accepts `existingPositionLeverage`. > - **Routing/Styles/Locale**: > - Wired Home and modal routes; various style tweaks; added i18n for market hours. > - **Tests**: Extensive new unit tests across views, hooks, components, and styles. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c712e48. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Implement 2x fee multiplier for HIP-3 (HyperLiquid Improvement Proposal 3) assets as per HyperLiquid protocol specification. **What changed:** - HIP-3 assets (identified by `dex:SYMBOL` format like `xyz:TSLA`) now have 2x base exchange fees - Regular assets (e.g., `BTC`, `ETH`) are unaffected **Why:** HyperLiquid protocol charges double base fees for builder-deployed perpetuals (HIP-3 assets): - Regular taker: 0.045% -> HIP-3 taker: 0.090% - Regular maker: 0.015% -> HIP-3 maker: 0.030% **How:** Applied 2x multiplier to all three fee rate sources: 1. Base rates (when no user-specific rates available) 2. Cached user rates (from fee cache) 3. API-fetched user rates (from HyperLiquid API) ## **Changelog** CHANGELOG entry: Fixed HIP-3 perpetuals to display correct 2x exchange fees ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1950 ## **Manual testing steps** ```gherkin Feature: HIP-3 Fee Display Scenario: user views fees for HIP-3 asset Given user is on Perps trading screen When user selects a HIP-3 asset (e.g., "xyz:XYZ100") And user enters a trade amount Then fee modal should show provider fee ~0.086% (2x base rate) And total fee should be ~0.186% (provider + 0.1% MetaMask) Scenario: user views fees for regular asset Given user is on Perps trading screen When user selects a regular asset (e.g., "BTC") And user enters a trade amount Then fee modal should show provider fee ~0.043% (base rate) And total fee should be ~0.143% (provider + 0.1% MetaMask) ``` ## **Screenshots/Recordings** ### **Before** HIP-3 assets showed incorrect 0.043% provider fee (missing 2x multiplier) <img width="549" height="1061" alt="image" src="https://github.com/user-attachments/assets/1394476a-e622-4e99-8889-a607cc93a609" /> ### **After** HIP-3 assets correctly show 0.086% provider fee (2x multiplier applied) <img width="554" height="1151" alt="image" src="https://github.com/user-attachments/assets/132e3609-ebd1-4a94-8778-a69783a445c8" /> ## **Pre-merge author checklist** - [x] I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable (225 tests passing, added HIP-3 validation test) - [x] I've documented my code using JSDoc format if applicable - [x] I've applied the right labels on the PR ## **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 --- ## **Technical Details** **Files Modified:** - `app/components/UI/Perps/controllers/types/index.ts` - Added `coin` parameter to `FeeCalculationParams` - `app/components/UI/Perps/controllers/providers/HyperLiquidProvider.ts` - Applied HIP-3 2x multiplier to all rate sources - `app/components/UI/Perps/controllers/PerpsController.ts` - Updated method signature - `app/components/UI/Perps/hooks/usePerpsOrderFees.ts` - Pass `coin` parameter - `app/components/UI/Perps/hooks/usePerpsCloseAllCalculations.ts` - Pass `coin` parameter - Test files - Updated all tests to pass `coin` parameter **Test Coverage:** - All existing tests passing (225/225) - Added `hip3-fee-validation.test.ts` with 8 validation tests - Verified HIP-3 detection logic - Verified 2x multiplier application **Key Implementation:** ```typescript // Detect HIP-3 assets by colon separator const { dex } = parseAssetName(coin); // "xyz:TSLA" -> dex="xyz" const isHip3Asset = dex !== null; // Apply 2x multiplier to all rate sources if (isHip3Asset) { feeRate *= 2; } ``` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Implements a 2× fee multiplier for HIP-3 (`dex:SYMBOL`) assets and updates fee calculation to require `coin`, applying the multiplier across base, cached, and API-fetched rates with comprehensive test updates. > > - **Fees/HIP-3**: > - Add `HIP3_FEE_CONFIG` with `FEE_MULTIPLIER: 2` in `constants/hyperLiquidConfig.ts`. > - Apply 2× multiplier for HIP-3 assets (detected via `parseAssetName(coin)`) in `HyperLiquidProvider.calculateFees()` for: > - Base rates > - Cached user rates > - API-fetched user rates > - **API/Types**: > - Make `coin` required in `FeeCalculationParams` (`controllers/types`). > - Update `PerpsController.calculateFees` signature to accept `FeeCalculationParams` and forward to provider. > - **Hooks/Usage**: > - Pass `coin` to fee calc in `usePerpsOrderFees` and `usePerpsCloseAllCalculations`. > - **Tests**: > - Update all fee tests to include `coin`. > - Add tests verifying 2× HIP-3 fees for taker/maker in `HyperLiquidProvider.test.ts`. > - Minor test cleanups (remove unused placeholders, add `isFeeCacheValid` edge case). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d096fa9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
|
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. |
|
I am not sure if this would be fixed in this branch or not, but I am still seeing the intermittent switching of the filter tabs |
Hmm, this won't be fixed on this branch but ty for flagging. Likely a bugfix to track. Might be worth it to fit in if it's a scoped change |
|
Thanks for catching this. Fixed in: 920460c
|
|






Description
Fixes incorrect search behavior from PerpsHomeView. We were handling two different search behaviors in PerpsHomeScree and PerpsMarketListView. Correct behavior is:
When search icon is pressed on the PerpsHomeView, it need to navigate to the PerpsMarketListView with search enabled.
On cancel, it should go back to the PerpsMarketListView
When search icon is pressed from PerpsMarketListView, we enable search as is currently does
When cancel is pressed it goes back to PerpsMarketListView
This PR removes the multi-dimensional search from the PerpsHomeScreen view and instead navigates to the MarketListView as per the latest designs.
Changelog
CHANGELOG entry: Fixes search behavior in PerpsHomeScreen
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Screen.Recording.2025-10-31.at.10.08.42.AM.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
PerpsHomeView now navigates to PerpsMarketListView with search pre-opened on search tap, with minor header padding tweak, a new navigation param, and updated tests.
PerpsHomeViewwith navigation toPerpsMarketListViewviausePerpsNavigation.navigateToMarketList({ defaultSearchVisible: true, source: 'homescreen_tab', fromHome: true }).PerpsHomeView; callusePerpsHomeData({}).PerpsHomeHeaderis always rendered withisSearchVisible: falseon Home.handleSearchToggleinPerpsMarketListViewtouseCallback; clears query on close and tracks event on open.PerpsMarketListHeader: addPlatform-specific padding for the search bar (py-3iOS,py-1Android); importPlatform. MarkonSearchClearas unused.fromHome?: booleantoPerpsNavigationParamList['PerpsMarketListView'].PerpsHomeView.test.tsx: mocknavigateToMarketListand assert navigation with{ defaultSearchVisible: true, source: 'homescreen_tab', fromHome: true }; remove assertions about HomeView search bar visibility; minor setup/mocks cleanup.Written by Cursor Bugbot for commit 8218306. This will update automatically on new commits. Configure here.