Skip to content

[pull] main from MetaMask:main#304

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

[pull] main from MetaMask:main#304
pull[bot] merged 5 commits into
Reality2byte:mainfrom
MetaMask:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Nov 7, 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 : )

smilingkylan and others added 5 commits November 7, 2025 03:50
The purpose of this task is to fix the `yarn audi:ci` issues that popped
up for `react-native-community/cli` packages due to a recent
vulnerability related to bash commands being executed from within that
package

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds `npmAuditIgnoreAdvisories: [1109627]` to `.yarnrc.yml` to
temporarily suppress `@react-native-community/cli` audit failures and
unblock CI.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
65be265. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Luis Taniça <matallui@gmail.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**

- change polymarket links to use webview

<!--
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]
> Routes Polymarket Terms and Resolution links to the in-app Webview
using navigation (with InteractionManager), replacing direct Linking
usage, and adds tests.
> 
> - **Predict UI**:
> - `PredictConsentSheet.tsx`: Replace `Linking.openURL` with in-app
Webview navigation via `useNavigation` and
`InteractionManager.runAfterInteractions`; wrap description/`Learn more`
in a `TouchableOpacity`.
> - `PredictMarketDetails.tsx`: Add handler to navigate to Webview for
Polymarket resolution details via
`InteractionManager.runAfterInteractions`.
> - **Tests**:
> - `PredictConsentSheet.test.tsx`: Mock
`InteractionManager.runAfterInteractions`; assert navigation to
`Webview/SimpleWebview` with Polymarket TOS URL and title.
> - `PredictMarketDetails.test.tsx`: Mock
`InteractionManager.runAfterInteractions`; verify About tab "Polymarket"
press navigates to `Webview/SimpleWebview` with resolution docs URL and
title.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9f4e219. 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**

- Various market details chart fixes / improvements 

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


https://github.com/user-attachments/assets/665e3b10-522e-4a1b-ad0b-7d6253a99f43

<!-- [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]
> Refines PredictDetailsChart visuals and behavior (loading indicator,
grid/labels/insets), updates date/percent formatting, and adds
comprehensive utils tests.
> 
> - **UI/Chart UX**:
> - Replace loading placeholder text with `ActivityIndicator`; keep
chart skeleton visible during loading.
> - Tweak layout/spacing: adjust margins (`mb-6`→`mb-4/mb-3`), ensure
axis label row min-height, and legend spacing (`mb-3`→`mb-2`).
> - Update axis label style to `text-[11px]` and use alternative text
color.
> - Refine grid: shift lines (`x1` to `8`), move tick labels up (`y -
4`) and set color to `colors.text.alternative`.
>   - Adjust area gradient fade (`Stop offset` from `100%` to `95%`).
> - **Chart behavior/constants** (`utils.ts`):
> - Change `LINE_CURVE` alpha to `0.2`; update `CHART_CONTENT_INSET` to
`{ top: 8, bottom: 4, left: 8, right: 48 }`.
> - Revise label formatting: `ONE_WEEK` now `weekday AM/PM`; `MAX` uses
2‑digit year; support seconds/milliseconds.
> - Add `formatTickValue` precision rules based on range (<1: 2dp, <10:
1dp, ≥10: 0dp).
> - **Tests**:
>   - Update chart tests to check for `line-chart` during loading.
> - Add comprehensive `utils.test.ts` covering constants, date label
formatting, and tick value formatting edge cases.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2f1e80a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Luis Taniça <matallui@gmail.com>
## **Description**

This PR enables relaying of SELL orders through the MetaMask Predict API
relay, similar to how BUY orders are already relayed. Previously, only
BUY orders were sent through the relay to collect fees, while SELL
orders went directly to the Polymarket CLOB endpoint.

**Reason for change:**
- SELL orders should also be relayed to enable consistent fee collection
and monitoring across all order types
- Provides better control and observability for all trading activity

**Improvements:**
- All orders (BUY and SELL) now route through the `CLOB_RELAYER`
endpoint
- Rate limiting now applies to both BUY and SELL orders based on the
last BUY order timestamp
- Simplified order submission logic by removing conditional endpoint
selection
- Updated `OrderResponse` type fields to be optional for better error
handling
- Renamed `BUY_ORDER_RATE_LIMIT_MS` to `ORDER_RATE_LIMIT_MS` to reflect
that rate limiting applies to all orders

## **Changelog**

CHANGELOG entry: null

## **Related issues**

Fixes: N/A

## **Manual testing steps**

```gherkin
Feature: Polymarket SELL order relaying

  Scenario: user places a SELL order
    Given user has an open position in a Polymarket market
    And user is connected to Polygon mainnet
    And the Predict feature is enabled

    When user navigates to the position details
    And user initiates a SELL order
    And user confirms the transaction
    Then the order should be relayed through the MetaMask API endpoint
    And the order should be successfully submitted to Polymarket
    And fees should be collected appropriately

  Scenario: user is rate limited after placing orders
    Given user has placed a BUY order within the last 5 seconds

    When user attempts to preview a new order (BUY or SELL)
    Then the preview should show rateLimited: true
    And user should be prevented from placing another order too quickly
```

## **Screenshots/Recordings**

N/A - Backend/API changes only, no UI changes

### **Before**

- BUY orders → CLOB_RELAYER endpoint (with fees)
- SELL orders → Direct to Polymarket CLOB endpoint (no fees)
- Rate limiting only applied to BUY order previews

### **After**

- BUY orders → CLOB_RELAYER endpoint (with fees)
- SELL orders → CLOB_RELAYER endpoint (no fees)
- Rate limiting applies to all order previews after a BUY order

## **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]
> Routes both BUY and SELL orders through the MetaMask Predict relayer,
applies unified rate limiting, and updates response handling/types with
corresponding tests.
> 
> - **Order routing (utils/submitClobOrder)**:
> - Always post to `CLOB_RELAYER` (`/order`), removing conditional CLOB
endpoint usage.
> - Send both underscore and dash variants of `POLY_*` headers; include
`feeAuthorization` when provided.
> - **Rate limiting**:
> - Rename `BUY_ORDER_RATE_LIMIT_MS` to `ORDER_RATE_LIMIT_MS` and apply
in `PolymarketProvider.isRateLimited`.
> - `previewOrder` now rate-limits when a `signer` is present (affects
SELL after a recent BUY).
> - **Order handling**:
> - `OrderResponse` fields (`errorMsg`, `makingAmount`, `orderID`,
`status`, `takingAmount`, `transactionsHashes`) made optional.
> - `placeOrder` checks top-level `success` and nested
`response.success`; returns `errorMsg` when present.
> - **Tests**:
> - Update submit order tests to expect relayer URL, dual-format
headers, and serialized `feeAuthorization`.
> - Adjust expectations for `response` shape (includes `success: true`).
> - Update rate limit test to expect SELL previews to be rate-limited
after a BUY.
>   - Remove unused `errorCode` from 403 path expectations.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
33a2d3e. 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**

- cash out changes

<!--
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]
> Updates the Predict cash out preview to show per‑share price with
fallback, localizes copy, refactors layout/styles, adds locale strings,
and adjusts tests accordingly.
> 
> - **Predict Sell Preview (UI/Logic)**:
> - Localizes header/button text and replaces hardcoded labels with
`strings('predict.cash_out')`.
> - Displays per‑share price using `preview.sharePrice ??
position.price` and adds line under current value via
`predict.at_price_per_share`.
> - Shows initial position info (amount, outcome, avg entry price) via
`predict.cashout_info`.
> - Refactors layout to `Box` components, tweaks icon container, and
simplifies details rendering.
> - **State/Computation**:
> - Adds `currentPrice` derived from `preview?.sharePrice ??
position?.price`; leverages `position.avgPrice` for display.
> - **Styles**:
> -
`app/components/UI/Predict/components/PredictPosition/PredictPosition.styles.ts`:
make `positionDetails` `flex: 1`; remove extra width/flex on
`positionPnl`.
> -
`app/components/UI/Predict/views/PredictSellPreview/PredictSellPreview.styles.ts`:
remove unused containers/fields; keep core layout and button styles.
> - **Tests** (`PredictSellPreview.test.tsx`):
> - Update assertions to new copy (“Cash out”, `$50.00 on Yes at 50¢`),
and add test for undefined `preview.sharePrice` using fallback.
> - **Locales** (`locales/languages/en.json`):
> - Add `predict.at_price_per_share` and `predict.cashout_info`; ensure
“Cash out” casing alignment.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
fae7da8. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Luis Taniça <matallui@gmail.com>
@pull pull Bot locked and limited conversation to collaborators Nov 7, 2025
@pull pull Bot added the ⤵️ pull label Nov 7, 2025
@pull pull Bot merged commit 3d1cea8 into Reality2byte:main Nov 7, 2025
3 of 13 checks passed
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