[pull] main from MetaMask:main#422
Merged
Merged
Conversation
## **Description**
This PR removes the `feature-flag-guidelines.mdc` cursor rule that
enforced using the `useFeatureFlag` hook for feature flag access.
**Reason for change:** The team has decided to go back to using Redux
selectors for feature flag access instead of the `useFeatureFlag` hook
pattern. The cursor rule is no longer aligned with the team's preferred
approach and was causing confusion by enforcing a pattern we no longer
want to follow.
**Solution:** Remove the `.cursor/rules/feature-flag-guidelines.mdc`
file to allow developers to use selectors for feature flags again.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: N/A
## **Manual testing steps**
Feature: Cursor Rules
Scenario: Developer no longer sees feature flag guidelines
Given a developer is working on the MetaMask Mobile codebase
When the developer checks the .cursor/rules directory
Then the feature-flag-guidelines.mdc file should not exist
And no cursor AI guidance enforces using useFeatureFlag hook
## **Screenshots/Recordings**
### **Before**
N/A - This is a documentation/tooling change only.
### **After**
N/A - This is a documentation/tooling change only.
## **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.
## **Description** This PR moves the unrealized P&L display from the balance header area to the Positions section header, improving the information hierarchy on the Perps home screen. **Changes:** 1. Extended `PerpsHomeSection` component with optional subtitle support (`subtitle`, `subtitleColor`, `subtitleSuffix`, `subtitleTestID` props) 2. Updated `PerpsHomeView` to calculate and display aggregate P&L below the "Positions" title 3. Removed inline P&L display from `PerpsMarketBalanceActions` component (was showing `"$X available · P&L +$Y (Z%)"`) 4. Cleaned up unused props, imports, and variables from `PerpsMarketBalanceActions` **Result:** - Balance header now shows only: `"$X available"` - Positions section header now shows: `"Positions"` with subtitle where the P&L value is color-coded (`-$18.47 (2.1%)`) and the label (`Unrealized PnL`) is in default color ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2178 ## **Manual testing steps** ```gherkin Feature: Display unrealized P&L below open positions Scenario: User views P&L in Positions section header Given user has open positions with unrealized P&L And user is on the Perps home screen When user views the Positions section Then the unrealized P&L is displayed below the "Positions" title And the P&L is color-coded (green for profit, red for loss) Scenario: User views balance area without P&L Given user has funded their Perps account And user is on the Perps home screen When user views the balance area at the top Then only the available balance is shown (no inline P&L) ``` ## **Screenshots/Recordings** ### **Before** <img width="457" height="883" alt="image" src="https://github.com/user-attachments/assets/0e6e6ce5-88df-4bbf-b072-420098e3079a" /> ### **After** <img width="405" height="816" alt="image" src="https://github.com/user-attachments/assets/4a2ce09a-fa16-44b9-946a-190f60ecf669" /> ## **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 - [ ] 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] > Moves unrealized P&L from the balance header to a color-coded subtitle under the Positions section, adding subtitle support and tests while removing P&L from balance actions. > > - **UI** > - **`PerpsHomeSection`**: Adds optional subtitle support (`subtitle`, `subtitleColor`, `subtitleSuffix`, `subtitleTestID`) and refactors header layout (`headerContainer`/`titleRow`). > - **`PerpsHomeView`**: Computes aggregate unrealized PnL/ROE and sets as `Positions` subtitle with color and suffix; wires testID `PerpsHomeViewSelectorsIDs.POSITIONS_PNL_VALUE`. > - **`PerpsMarketBalanceActions`**: Removes inline P&L display and unused `positions` prop; balance area now shows only available balance; cleans up related imports/logic. > - **Tests** > - **`PerpsHomeSection.test.tsx`**: Adds cases for subtitle rendering, color, suffix, and pressability alongside actions. > - **E2E Selectors** > - Adds `POSITIONS_PNL_VALUE` to `PerpsHomeViewSelectorsIDs`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 7fe59b4. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
#24100) ## **Description** Use the last candle's close price from the candle stream instead of the separate allMids price stream for the chart's current price line. This eliminates the 0.5-2s delay between the live candlestick close and the current price line by ensuring both use the same data source. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Fixed delay between the live candlestick close price and current price line on the Perps TradingView chart ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2209 ## **Manual testing steps** ```gherkin Feature: Perps TradingView Chart Price Synchronization Scenario: user observes current price line syncs with live candle Given user is on the Perps Market Details view with a TradingView chart When user observes the live candlestick updating in real-time Then the current price line (horizontal line on y-axis) should update simultaneously with the candlestick close price And there should be no visible delay between the candlestick close and the price line ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** The prices were not synced https://consensyssoftware.atlassian.net/browse/TAT-2209?atlOrigin=eyJpIjoiMWYwMzJkNzBiNDQ2NDNkN2FlNGQzYTRmYzZjNDE0ZTQiLCJwIjoiaiJ9 ### **After** The prices are synced https://github.com/user-attachments/assets/755e21de-3d98-4837-a569-ab2c0d1fccac ## **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] > Synchronizes current price with the latest candle close across chart and headers, refactoring LivePriceHeader to accept a `currentPrice` prop and updating usages/tests. > > - **Perps Market Details**: > - Compute `chartCurrentPrice` from last candle close (`usePerpsLiveCandles`) and use it for chart TP/SL lines (`tpslLines`). > - Pass `currentPrice={chartCurrentPrice}` to `PerpsMarketHeader` for header price sync. > - **Perps Order Book**: > - Pass `currentPrice={marketPrice ?? 0}` to `PerpsMarketHeader` in both normal and error states. > - **PerpsMarketHeader**: > - Accepts required `currentPrice` prop and forwards it to `LivePriceHeader`. > - **LivePriceHeader**: > - API change: remove `fallbackPrice`; add required `currentPrice` prop. > - Use `currentPrice` for price display; subscribe only for 24h percent change. > - Handle loading/invalid price cases consistently. > - **Tests**: > - Update tests to provide `currentPrice` and remove `fallbackPrice` paths; adjust assertions accordingly. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f95a3a1. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Disable automatic gas fee updates for source transactions generated by Perps and Predict deposits. ## **Changelog** CHANGELOG entry: null ## **Related issues** ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** ## **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] > Refines automatic gas fee update logic, disabling it for transactions with nested relayDeposit and MetaMask-origin token approvals, and updates tests accordingly. > > - **Transaction Controller**: > - **Automatic Gas Fee Updates**: > - Implement `isAutomaticGasFeeUpdateEnabled(transaction)` and wire into `TransactionController` options. > - Disable when transaction has nested `relayDeposit`. > - Disable for `tokenMethodApprove` when `origin === ORIGIN_METAMASK`. > - Maintain behavior: enabled for `REDESIGNED_TRANSACTION_TYPES`, disabled for non-redesigned types. > - Add `hasTransactionType` and `ORIGIN_METAMASK` usage. > - **Tests**: > - Expand `isAutomaticGasFeeUpdateEnabled` test coverage for redesigned/non-redesigned, nested `relayDeposit`, and MetaMask vs external origins. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f664ff6. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )