[pull] main from MetaMask:main#339
Merged
Merged
Conversation
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
remove crypto compare fallback
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **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: remove crypto compare fallback
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
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**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] 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]
> Adds `NetworkController:getState` delegation to
`CurrencyRateController` messenger and updates MetaMask controller
dependencies.
>
> - **Engine**:
> -
`app/core/Engine/messengers/currency-rate-controller-messenger/currency-rate-controller-messenger.ts`:
Delegate `NetworkController:getState` in addition to
`NetworkController:getNetworkClientById` for the
`CurrencyRateController` messenger.
> - **Dependencies**:
> - Bump `@metamask/assets-controllers` to `^89.0.1`.
> - Bump `@metamask/bridge-controller` and
`@metamask/bridge-status-controller` to `^61.0.0`.
> - Align related peer deps (e.g., `@metamask/core-backend` `^4.1.0`).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
60d9a61. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description** Replaces blank page with a loader for the Send flow with skeleton loading ## **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: Replaces blank page with a loader for the Send flow with skeleton loading ## **Related issues** Fixes: #19676 #22763 #17838 ## **Manual testing steps** 1. Click Send on the main page 2. Fill in the form, submit it 3. You will see skeleton loading now ## **Screenshots/Recordings** ### **Before** <img width="654" height="1334" alt="image" src="https://github.com/user-attachments/assets/866ddc22-c26f-4e1e-838f-942958fffe56" /> ### **After** <img width="637" height="1389" alt="image" src="https://github.com/user-attachments/assets/e0224b0e-5747-45d4-ac05-072aacfd6b42" /> <img width="637" height="1377" alt="image" src="https://github.com/user-attachments/assets/11ab4928-5322-4dc8-b134-fbe8c27480e7" /> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] 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] > Adds a Transfer-specific skeleton loader (including footer skeleton) to the confirmation screen and routes Send flow to use it, plus skeletons across key info rows. > > - **Confirmations UI** > - Adds `ConfirmationLoader.Transfer` and renders `TransferInfoSkeleton` in `confirm-component.tsx`. > - Extends `InfoLoader` to accept `loader` and shows `FooterSkeleton` when `loader === 'transfer'`. > - Keeps default spinner; retains existing loaders (`customAmount`, `predictClaim`). > - **Footer** > - Introduces `FooterSkeleton` with styles (`footerSkeletonContainer`, `footerButtonSkeleton`). > - Refactors base footer styles for reuse. > - **Transfer Info Skeletons** > - Adds skeleton components for rows: `HeroRowSkeleton`, `FromToRowSkeleton`, `NetworkAndOriginRowSkeleton`, `GasFeesDetailsRowSkeleton`, `AdvancedDetailsRowSkeleton` with corresponding style additions. > - Replaces `react-native-skeleton-placeholder` usage with shared `Skeleton` component in gas fee row. > - **Navigation/Send Flow** > - `useSendActions`: navigates to `RedesignedConfirmations` with `{ loader: 'transfer', params: { maxValueMode } }`. > - **Tests** > - Updates `confirm-component.test.tsx` and `useSendActions.test.ts` to cover new loaders, SafeArea + `ScrollView`, defaults, and navigation params. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2f5656e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR fixes an issue where the user's balance was not being refreshed after successfully claiming winnings from a prediction market. **What is the reason for the change?** After a user claims their winnings, the balance displayed in the UI would not update to reflect the newly claimed funds until the user manually refreshed or navigated away and back. **What is the improvement/solution?** Added a call to `loadBalance()` in the `onConfirmed` callback of `usePredictClaimToasts` to automatically refresh the user's balance after a successful claim transaction is confirmed. This ensures the UI displays the updated balance immediately after claiming. ## **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: Added a predict balance refresh after a successful claim ## **Related issues** Fixes: [PRED-311](https://consensyssoftware.atlassian.net/browse/PRED-311) ## **Manual testing steps** ```gherkin Feature: Balance refresh after claim Scenario: user claims prediction market winnings Given user has won positions available to claim And user's balance is displayed in the UI When user claims their winnings And the claim transaction is confirmed Then user's balance updates automatically to reflect the claimed funds And user does not need to manually refresh the page ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- Balance would not update after claiming until manual refresh --> ### **After** <!-- Balance updates automatically after claim is confirmed --> ## **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] > Refreshes predict balance upon claim confirmation and updates tests to cover the new behavior. > > - **Predict hooks**: > - Update `app/components/UI/Predict/hooks/usePredictClaimToasts.tsx` to use `usePredictBalance` and refresh balance (`loadBalance({ isRefresh: true })`) on claim confirmation via new `handleClaimConfirmed` (`useCallback`). > - Preserve and invoke `PredictController.confirmClaim` and `loadPositions({ isRefresh: true })` in the unified confirmation handler. > - **Tests**: > - Extend `app/components/UI/Predict/hooks/usePredictClaimToasts.test.tsx` to mock `usePredictBalance` and assert `loadBalance` is called on confirmed transactions; verify `loadPositions({ isRefresh: true })` and `PredictController.confirmClaim` calls. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 84d9526. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> [PRED-311]: https://consensyssoftware.atlassian.net/browse/PRED-311?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…22797) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR adds feature flag changing the way accounts list is rendered. When `fullPageAccountList` is enabled, then accounts list is rendered as full page, when disabled as bottom sheet. ### Performance improvement measurements | BottomSheet | Full Page | | -------- | ------- | | 631ms | 648ms | | 814ms | 619ms | | 614ms | 646ms | | 746ms | 623ms | | 729ms | 614ms | | 697ms | 660ms | | 697ms | 642ms | | 847ms | 625ms | | 732ms | 698ms | | 782ms | 639ms | | **Average** | **Average** | | **728.9ms** | **641.4ms** | **Improvement ~12%** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **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: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-174 ## **Manual testing steps** ```gherkin Feature: Open accounts list Scenario: user opens accounts list Given fullPageAccountList is enabled When user clicks accounts selector on the home page Then accounts list opens as full page ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/ab9458a2-ffeb-42da-b95e-b8d1b2adaeaa <!-- [screenshots/recordings] --> ### **After** https://github.com/user-attachments/assets/aa7fd4ed-424a-44fb-b13c-d91cccefb736 <!-- [screenshots/recordings] --> ## **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] > Introduces a feature-flagged full-page AccountSelector with animated presentation/backdrop, centralized headers, updated navigation options, new styles, and comprehensive tests. > > - **UI – `AccountSelector`**: > - Add full-page mode gated by `FeatureFlagNames.fullPageAccountList` using `react-native-reanimated` (slide-in/out, animated backdrop), `KeyboardAvoidingView`, and safe-area padding. > - Centralize headers: render `SheetHeader`/`BottomSheetHeader` within `AccountSelector`; remove inline headers from `MultichainAddWalletActions` and `AddAccountActions`. > - Add `closeModal` to close appropriately (animate + `navigation.goBack()` in full-page; close sheet otherwise). Selection/actions now call `closeModal`. > - Tracing: end `TraceName.ShowAccountList` on animation complete (full-page) or `onOpen` (bottom sheet). > - Styles: add `backdrop`, `keyboardAvoidingView`, `container`; adjust layout accordingly. > - **Navigation**: > - Update `Routes.SHEET.ACCOUNT_SELECTOR` options (transparent `cardStyle`, no overlay fade, `detachPreviousScreen: false`). > - **Feature Flags**: > - Add `fullPageAccountList` to `FeatureFlagNames` and `useFeatureFlag`. > - **Tests**: > - Extend `AccountSelector` tests for full-page vs bottom sheet, navigation/closing behavior, syncing states; refine timer handling. Update snapshots. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b8aee13. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** This PR fixes the claimable positions logic in the Predict feature to ensure we always fetch **ALL** claimable positions and filter them afterward, rather than fetching only positions for a specific market. ### Why this change? 1. The claim operation works at the account level - users can only claim **all** positions at once, never individual market positions 2. We need to keep all claimable positions in the `PredictController` state to support the global claim functionality 3. Previously, when viewing a specific market's details, we would fetch only that market's claimable positions, which caused the controller state to be incomplete ### What was fixed? 1. **Always fetch ALL claimable positions**: Modified `usePredictPositions` to ignore the `marketId` parameter when `claimable=true`, ensuring we always fetch all claimable positions for the account 2. **Filter at display time**: Introduced `filteredClaimablePositions` using `useMemo` to filter positions by `marketId` when displaying them in market-specific screens 3. **State management**: Clarified that `claimablePositions` in the controller should always contain ALL claimable positions, and `positions` state only stores active positions 4. **Fixed display bug**: Market details screens now correctly show only the claimable positions for that specific market, rather than incorrectly showing positions from other markets ## **Changelog** CHANGELOG entry: Fixed claimable positions logic to always fetch all positions and filter correctly by market ## **Related issues** Fixes: [PRED-318](https://consensyssoftware.atlassian.net/browse/PRED-318) ## **Manual testing steps** ```gherkin Feature: Claimable positions management Scenario: user views claimable positions in market details Given user has claimable positions in multiple markets And user is viewing a specific market's details screen When the market details screen loads Then only claimable positions for that specific market should be displayed And all claimable positions should be stored in the PredictController state Scenario: user claims all positions Given user has multiple claimable positions across different markets And user is on any market details screen When user initiates a claim operation Then all claimable positions from all markets should be claimed And the controller state should correctly reflect all claimable positions Scenario: user switches between markets with claimable positions Given user has claimable positions in Market A and Market B And user is viewing Market A details When user navigates to Market B details Then only Market B's claimable positions should be displayed And the controller state should still contain all claimable positions from both markets ``` ## **Screenshots/Recordings** ### **Before** <!-- Market details screen incorrectly showing claimable positions from other markets --> ### **After** <!-- Market details screen correctly showing only positions for the current market --> https://github.com/user-attachments/assets/52255fb4-dcd0-48a9-ac1d-29eca1c09d0e ## **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] > Ensure claimable positions always load globally and are filtered per-market in the hook, with local state storing only active positions. > > - **PredictController**: > - Clarifies `claimablePositions` should always contain ALL claimable positions. > - **Hook `usePredictPositions`**: > - Always fetches all positions when `claimable=true` (ignores `marketId`) and filters by `marketId` via `useMemo`. > - Returns filtered claimable positions; only stores active (non-claimable) positions in local `positions` state. > - Updates option docs; adds `useMemo` import. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2c00940. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> [PRED-318]: https://consensyssoftware.atlassian.net/browse/PRED-318?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…#22882) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR improves the accuracy and clarity of financial display formatting in the Predict feature, with a focus on the cash-out preview flow. ### Key Changes 1. **PnL Calculation in Sell Preview** - Recalculates `cashPnl` and `percentPnl` dynamically based on real-time preview data (`minAmountReceived`) instead of using stale values from the position object - Formula: `cashPnl = currentValue - initialValue` where `currentValue` comes from the latest preview - This ensures users see accurate profit/loss based on the actual cash-out amount 2. **formatPrice Enhancement** - Changed from truncation to proper rounding (fixes issue where small values like $0.001 showed as $0) - Respects `maximumDecimals` parameter for precision control (was previously hardcoded to 2) - Hides `.00` for integer values (e.g., `$50` instead of `$50.00`) for cleaner UI - Properly handles `minimumDecimals` parameter values 3. **formatPercentage Enhancement** - Added `truncate` option (default: false) for more precise percentage display - `truncate: true` - Shows ">99%", "<1%", rounded integers (old behavior) - `truncate: false` - Shows actual decimals up to 2 places (e.g., "5.25%") - Binary outcome displays now use truncated percentages for simplicity 4. **Position Display UX Improvement** - Changed position info format from `$X on Y • Z shares at W¢` to `$X on Y to win $Z` - More intuitive for users to understand potential winnings - Updated localization strings: `cashout_info`, `cashout_info_multiple`, `position_info` - Simplified share price display: "Selling X shares at Y" instead of "At price: Y¢ per share" 5. **Test Updates** - Updated all affected test files to match new formatting behavior - Added proper mocking for `formatPositionSize` and `formatCents` - Fixed assertions to expect new display formats ### Technical Details - The `formatPrice` function now uses dynamic multiplier based on `maximumDecimals`: `Math.pow(10, maximumDecimals)` - Sell preview now properly displays small PnL values (e.g., -$0.0011 instead of $0) - All format changes are backward compatible through optional parameters ### Trade-offs - Existing code relying on `formatPrice` truncation behavior may see slight differences (addressed in tests) - Added complexity to format functions with additional options, but improves flexibility ## Changelog ### Fixed - Fixed cash-out preview showing incorrect PnL by recalculating from real-time preview data - Fixed formatPrice showing $0 for small values under $0.01 - Fixed percentage display truncating to whole numbers when precision needed ### Changed - Changed position display format to show potential winnings instead of share price - Changed formatPrice to round instead of truncate for better accuracy - Changed formatPercentage to support decimal precision with new truncate option <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **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: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/PRED-316 ## **Manual testing steps** ```gherkin 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** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> https://www.loom.com/share/08b302afff9e4553ac445503851f630c ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] 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] > Switches to rounded price formatting and precise percentages, updates position/sell preview displays (with recalculated PnL), and aligns i18n/tests with the new formats. > > - **Utilities (formatting)**: > - `formatPrice`: switch from truncation to rounding; hide `.00` for integers; respect `minimumDecimals`/`maximumDecimals`. > - `formatPercentage`: add `truncate` option; default shows up to 2 decimals; use truncation for market percentages. > - Minor helpers: keep cents/size formatting; expand tests and edge cases. > - **UI/Logic**: > - **Sell Preview** (`PredictSellPreview`): recalc PnL from preview (`minAmountReceived`), show "Selling X shares at Y"; add loading skeletons; update analytics props. > - **Positions** (`PredictPosition`, `PredictPositionDetail`, `Resolved`): change subtitle to `"{{initialValue}} on {{outcome}} to win {{shares}}"`; display precise `% PnL`; rounded values; conditionals for optimistic/closed states. > - **Market cards** (`PredictMarketOutcome`, `PredictMarketMultiple`): use truncated percentage display for outcome prices. > - **Header**: Unrealized P&L shows precise percent (e.g., `3.9%`, `-2.1%`). > - **i18n**: > - Update keys: `position_info`, `cashout_info(_multiple)`, `at_price_per_share` (now "Selling {{size}} shares at {{price}}"), remove leading `$` from `amount_on_outcome` template. > - **Tests**: > - Update expectations across Predict tests for new rounding, percent precision, and revised strings; add mocks for `formatPositionSize`/`formatCents`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 81676c0. 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 : )