Skip to content

[pull] main from MetaMask:main#321

Merged
pull[bot] merged 6 commits into
Reality2byte:mainfrom
MetaMask:main
Nov 13, 2025
Merged

[pull] main from MetaMask:main#321
pull[bot] merged 6 commits into
Reality2byte:mainfrom
MetaMask:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Nov 13, 2025

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 : )

caieu and others added 6 commits November 13, 2025 00:04
)

<!--
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**

- Add calculateNetAmount utility function to format.ts
- Calculate net amount as totalFiat - bridgeFeeFiat - networkFeeFiat
- Add comprehensive test coverage with 17 test cases covering:
  - Happy path calculations with high precision decimals
  - Edge cases (zero fees, missing parameters)
  - Error conditions (invalid inputs, NaN values)
  - Negative amount protection
- Update usePredictDepositToasts to display net amount instead of total
- Ensure missing fees are treated as zero (practical approach)
- Return "0" for invalid or missing totalFiat

<!--
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:

## **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 `calculateNetAmount` and updates deposit toast to show net fiat
after fees, with comprehensive tests.
> 
> - **Utils**:
> - Add `calculateNetAmount` in
`app/components/UI/Predict/utils/format.ts` to compute net fiat
(`totalFiat - bridgeFeeFiat - networkFeeFiat`) with validation and
non-negative guard.
> - **UI**:
> - Update `usePredictDepositToasts` to display net amount in confirmed
toast using `calculateNetAmount` + `formatPrice`.
> - **Tests**:
> - Expand `format.test.ts` with extensive cases for
`calculateNetAmount` (valid, precision, missing/invalid inputs,
zero/large values).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b3d56a6. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!--
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**

<!--
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?
-->

### What is the reason for the change?

There was a bug in the Polymarket provider's optimistic position update
system where:

1. When viewing a specific market, optimistic positions from ALL other
markets would incorrectly appear in the UI

### What is the improvement/solution?

Fixed `applyOptimisticPositionUpdates()` to properly handle query
filters:

- Added `marketId` and `outcomeId` parameters to respect the position
query context
- Restructured the update processing logic to always check ALL updates
for cleanup (timeout and confirmation), while only applying updates to
results when they match the current query filters

The key insight is that cleanup logic must run globally (checking all
updates regardless of filters), while the application logic should be
scoped (only applying matching updates to results).

## **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: [Issue number if applicable]

## **Manual testing steps**

```gherkin
Feature: Predict optimistic position updates with query filters

  Scenario: user views a specific market after placing orders on multiple markets
    Given user has placed buy orders on Market A and Market B
    And optimistic positions exist for both markets

    When user opens Market A detail view
    Then user should only see optimistic positions for Market A
    And user should not see optimistic positions for Market B

  Scenario: user sells/claims a position and optimistic update is cleaned up
    Given user has an open position on Market A
    And user navigates to Market A detail view

    When user sells the entire position
    Then user should immediately see the position removed (optimistic removal)

    When user navigates to all positions view
    And the API confirms the position is removed
    Then the optimistic update should be cleaned up from memory

  Scenario: user has optimistic updates that get cleaned up across different views
    Given user has placed an order on Market A
    And an optimistic position exists for Market A

    When user navigates to Market B detail view (filtered query)
    And the API for Market A confirms the position update
    And user navigates back to all positions view
    Then the optimistic update should be properly cleaned up
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

- When viewing a specific market, optimistic positions from all other
markets would appear
- Optimistic REMOVE updates would never get cleaned up when viewing
filtered queries
- Stale optimistic updates would persist until timeout (1 minute)

### **After**

- Only optimistic positions relevant to the current view are shown
- Optimistic REMOVE updates are properly cleaned up when API confirms
deletion
- Updates are checked for cleanup regardless of current query filters

## **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]
> Scopes optimistic position updates by `marketId`/`outcomeId` to
prevent positions from appearing in unrelated markets while retaining
global cleanup.
> 
> - **PolymarketProvider**
(`app/components/UI/Predict/providers/polymarket/PolymarketProvider.ts`):
> - Add `marketId` and `outcomeId` parameters to
`applyOptimisticPositionUpdates()` and propagate from `getPositions()`.
> - Apply optimistic updates only when they match the current query
filters (`marketId`/`outcomeId`), preventing cross-market leakage.
> - Keep global cleanup logic (timeout and API-confirmation) while
filtering application of optimistic positions.
> - Guard against applying optimistic positions when `claimable` is true
remains enforced during filtered updates.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
cd20921. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description**

We need a modal to display when a user's eligibility for ramps cannot be
determined based on their region. This is part of the larger ramps
eligibility checking feature.

**What is the improvement/solution?**
Created a new `EligibilityFailedModal` component that displays when
eligibility checks fail. The modal:
- Is registered at the root level (not nested in Ramp flow) so it can be
shown before users enter any ramp flow
- Displays a clear error message: "We couldn't confirm access based on
your region. Please try again. If the issue continues, contact support."
- Includes a "Got It" button that closes the modal and navigates back

**Note:** This PR sets up the infrastructure and routing. The actual
eligibility checking logic will be integrated in a separate PR.

## **Changelog**

CHANGELOG entry: null

_(Internal infrastructure change - not user-facing until eligibility
logic is integrated)_

## **Related issues**

Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-2833

## **Manual testing steps**

```gherkin
Feature: Ramps Eligibility Failed Modal

  Scenario: Modal displays with correct content
    Given the EligibilityFailedModal is triggered via navigation
    
    When the modal opens
    Then user sees the title "Eligibility Check Failed"
    And user sees the description "We couldn't confirm access based on your region. Please try again. If the issue continues, contact support."
    And user sees a "Got It" button

  Scenario: User dismisses the modal
    Given the EligibilityFailedModal is open
    
    When user taps the "Got It" button
    Then the modal closes
    And user navigates back to the previous screen

  Scenario: User closes modal with close button
    Given the EligibilityFailedModal is open
    
    When user taps the X close button in the header
    Then the modal closes
    And user navigates back to the previous screen
```

## **Files Changed**

### New Files
-
`app/components/UI/Ramp/components/EligibilityFailedModal/EligibilityFailedModal.tsx`
-
`app/components/UI/Ramp/components/EligibilityFailedModal/EligibilityFailedModal.styles.ts`
-
`app/components/UI/Ramp/components/EligibilityFailedModal/EligibilityFailedModal.test.tsx`
- `app/components/UI/Ramp/components/EligibilityFailedModal/index.ts`

### Modified Files
- `app/constants/navigation/Routes.ts` - Added
`ELIGIBILITY_FAILED_MODAL` to `Routes.SHEET`
- `app/components/Nav/App/App.tsx` - Registered modal in `RootModalFlow`
- `locales/languages/en.json` - Added translations under
`fiat_on_ramp_aggregator.eligibility_failed_modal`

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**



https://github.com/user-attachments/assets/84ed7a02-eb22-47a9-bd8d-e2c1be1f9e39



## **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
- [ ] 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]
> Adds an `EligibilityFailedModal` bottom sheet for ramps, registers its
route in `RootModalFlow`, and includes tests and translations.
> 
> - **UI (Ramps)**:
> - Add `EligibilityFailedModal` component
(`app/components/UI/Ramp/components/EligibilityFailedModal/EligibilityFailedModal.tsx`)
with styles and actions (open support link, close sheet).
> - **Navigation**:
> - Register `Routes.SHEET.ELIGIBILITY_FAILED_MODAL` in `App.tsx` under
`RootModalFlow` and define route in
`app/constants/navigation/Routes.ts`.
> - **Tests**:
> - Add component tests with snapshot and behavior
(`EligibilityFailedModal.test.tsx`).
> - Extend `App.test.tsx` to verify route registration and rendering via
initial nav state.
> - **i18n**:
> - Add strings under `fiat_on_ramp_aggregator.eligibility_failed_modal`
in `locales/languages/en.json`.
> - **Exports**:
>   - Add index export for `EligibilityFailedModal`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
029d772. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!--
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**

- Fixes an issue wherein Yes | No (vs the outcome titles) were hardcoded
on both the single market cards and market details action button

<!--
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: NA

## **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**

<img width="420" alt="image"
src="https://github.com/user-attachments/assets/ccd1866f-c93a-48e9-9484-64f6e484331a"
/>

<img width="420" alt="image"
src="https://github.com/user-attachments/assets/7a06c75c-a07f-47ce-b0e5-09949146c982"
/>


## **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]
> Replace hardcoded Yes/No with outcome token titles on single market
cards and market details action buttons; update tests and helpers
accordingly.
> 
> - **UI (Predict)**:
> - **Single Market Card (`PredictMarketSingle.tsx`)**: Button labels
now use `outcome.tokens[0].title` and `outcome.tokens[1].title` instead
of localized Yes/No.
> - **Market Details (`PredictMarketDetails.tsx`)**: Action button
labels now display `firstOpenOutcome?.tokens[0|1].title` alongside price
(e.g., `• XX¢`).
> - **Tests (`PredictMarketDetails.test.tsx`)**:
>   - Enhanced `createMockMarket` to include/normalize token `title`s.
> - Added utilities to extract button text and find action buttons by
price.
> - Updated assertions and interactions to use token titles and `•XX¢`
labels; expanded edge-case coverage (undefined price,
eligibility/balance flows).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e486973. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!--
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**

- Guard against NaN showing up in predict market single card if empty
data

<!--
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: NA

## **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**

<img width="420" alt="image"
src="https://github.com/user-attachments/assets/73daf198-335d-4c2d-8692-966b15b50622"
/>

### **After**

<img width="420" alt="image"
src="https://github.com/user-attachments/assets/e7031188-935d-4d23-8afd-95c7fff579a8"
/>

## **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]
> Harden yes-percentage calculation in PredictMarketSingle to return 0
for empty or non-finite prices, preventing NaN display.
> 
> - **UI (Predict)**
> - In
`app/components/UI/Predict/components/PredictMarketSingle/PredictMarketSingle.tsx`:
> - Update `getYesPercentage` to handle empty price arrays and
non-finite values using `Number(...)` and `Number.isFinite`, returning
`0` instead of producing `NaN`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e5980aa. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…22594)

<!--
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**

- Resolves issue with details chart incorrectly hiding 
- Now it only hides in an a hybrid market scenario wherein resolved
outcomes are attempted to be rendered to the chart that an incomplete
time series relative to the selected timeframe

<!--
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:
[PRED-296](https://consensyssoftware.atlassian.net/browse/PRED-296)

## **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**


https://github.com/user-attachments/assets/45cce31c-b7cb-4ff6-8cfc-bd9848d052ad




https://github.com/user-attachments/assets/84dd5823-48ff-4ce0-b7b0-8354436c314b



<!-- [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.


[PRED-296]:
https://consensyssoftware.atlassian.net/browse/PRED-296?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds timeframe-aware series filtering to PredictDetailsChart, hides it
only when no eligible data exists, introduces timeframe duration
utility, and always renders the chart in market details with updated
tests.
> 
> - **PredictDetailsChart**:
> - Timeframe-aware filtering: compute `seriesWithinTimeframe` using
`getTimeframeDurationMs`, require `>= 2` points and `>= 50%` coverage;
drop series not spanning selected timeframe.
> - Visibility: return `null` only when not loading and no eligible
data; previously shown empty label now hidden in such cases.
> - Data processing updated to use filtered series; maintains bounds,
legend, tooltip logic.
> - **Utils**:
> - Add `getTimeframeDurationMs(interval)` for `1H/6H/1D/1W/1M`, `null`
for `MAX`/unknown.
> - **PredictMarketDetails**:
> - Always renders `PredictDetailsChart` (removes conditional hide for
partially resolved outcomes).
> - **Tests**:
> - Expand unit tests for timeframe coverage, visibility, collision
cases, colors, overlays; add utility tests for timeframe durations;
adjust expectations to new hide/show behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
55153b2. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@pull pull Bot locked and limited conversation to collaborators Nov 13, 2025
@pull pull Bot added the ⤵️ pull label Nov 13, 2025
@pull pull Bot merged commit adcd668 into Reality2byte:main Nov 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants