Skip to content

[pull] main from MetaMask:main#376

Merged
pull[bot] merged 4 commits into
Reality2byte:mainfrom
MetaMask:main
Dec 3, 2025
Merged

[pull] main from MetaMask:main#376
pull[bot] merged 4 commits into
Reality2byte:mainfrom
MetaMask:main

Conversation

@pull
Copy link
Copy Markdown

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

abretonc7s and others added 4 commits December 3, 2025 09:48
## **Description**

Fix chart price display to match header exactly. This PR addresses two
related issues:

1. **Different values**: Header showed mark price (e.g., `$140.41`)
while chart pill showed candle close price (e.g., `140.73`) - these are
different data sources that can diverge
2. **Different decimals**: Even when values were similar, chart pill
showed more decimals due to zoom-adjusted formatting (e.g., header
`$140.85` vs chart `140.850`)

**Root cause**: TradingView ignores `axisLabelFormatter` on price lines,
so the global Y-axis formatter (which adds decimals when zoomed in) was
applied to the price line label.

**Solution**:
- Use mark price (from WebSocket) for both header and chart price line
instead of candle close price
- Detect the current price value in the global `priceFormatter` and
apply universal formatting to match header

## **Changelog**

CHANGELOG entry: Fixed chart price label showing different value and
more decimals than header

## **Related issues**

Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2112,
https://consensyssoftware.atlassian.net/browse/TAT-2050

## **Manual testing steps**

```gherkin
Feature: Chart price matches header

  Scenario: Price pill shows same value and decimals as header
    Given user opens any market details (BTC, ETH, SOL, etc.)

    When user views the chart
    Then current price pill value matches header exactly
    And current price pill decimals match header exactly

  Scenario: Price formatting is consistent across assets
    Given user opens BTC-USD market
    Then header and chart pill both show same decimals (e.g., 0 for BTC)

    When user switches to ETH-USD market
    Then header and chart pill both show same decimals (e.g., 1 for ETH)

    When user switches to SOL-USD market
    Then header and chart pill both show same decimals (e.g., 2 for SOL)

  Scenario: Y-axis still adjusts decimals when zoomed
    Given user opens SOL-USD market
    When user zooms in on a tight price range
    Then Y-axis tick labels show more decimals (to distinguish values)
    But current price pill still matches header decimals
```

## **Screenshots/Recordings**

### **Before**

- Header: `$140.41` | Chart pill: `140.730` (different value AND more
decimals)
- BTC showing 1 decimal on chart instead of 0
- ETH showing 2 decimals on chart instead of 1

### **After**

- Header and chart pill show identical values and decimals
- BTC: both show 0 decimals
- ETH: both show 1 decimal
- SOL: both show 2 decimals


https://github.com/user-attachments/assets/560726d1-b342-4dcf-afd2-222720ea142b


## **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]
> Use mark price for the chart’s current price line and apply universal
formatting so its value/decimals match the header; always render the
current price line even without a position.
> 
> - **Perps chart price consistency**:
>   - In `PerpsMarketDetailsView.tsx`:
> - `tpslLines` now always includes `currentPrice` (from live mark
price); shows current price line even without a position and updates
memo deps to include `currentPrice`.
>   - In `TradingViewChartTemplate.tsx`:
> - `priceFormatter` detects `window.currentPriceNumeric` and uses
`formatPriceUniversal` for the current price label to match header
decimals.
> - `updateCurrentPriceLine` stores `currentPriceNumeric` and removes
custom `axisLabelFormatter` reliance.
> - Stop updating the current price line from `SET_CANDLESTICK_DATA`;
rely on `ADD_AUXILIARY_LINES` with mark price from React Native.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
65eb0d1. 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**

Staking and unstaking methods connected to the tron-snap:


https://github.com/user-attachments/assets/a7f66644-1a44-4035-9e06-64c2ff71322f

<img width="1323" height="45" alt="Screenshot 2025-11-19 at 17 54 46"
src="https://github.com/user-attachments/assets/9ebe514b-2333-4b0a-ab12-969c48aa22bd"
/>
Example:
https://tronscan.org/address/TGXFnQBLAdbdkupHUGSpeBfbxB72hkMsh2#/transaction/85bfd85b620e6a8fc5966458cbfcf3a9757454917f78c36b675e223b68564499

## **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]
> Integrates TRON staking and unstaking via Snap, updating Earn flows,
lists, and selectors to support TRX with new validation, previews, and
navigation.
> 
> - **TRON staking/unstaking integration**:
> - Add `useTronStake` and `useTronUnstake` hooks for
validation/confirmation via `tron-staking-snap`.
> - New utils: `tron-staking-snap` (Snap RPCs), `tron`
(navigation/result handling, token builder, staked total).
>   - Add `TronStakePreview` UI for fee preview; reuse `ResourceToggle`.
> - **Earn Input/Withdraw flows** (`EarnInputView.tsx`,
`EarnWithdrawInputView.tsx`):
> - Wire TRX validation on keypad input; confirm flows call Snap and
navigate to success/error sheets.
> - Show Tron-specific UI (resource toggle, fee preview) and simplified
button labels; adjust disabled/loading states.
> - Limit gas-cost warning to `isETH` only; debounce validation handler.
> - **Token list and selection**:
> - `EarnTokenList`: include TRX native in deposit list (even with zero
balance when enabled); navigate without EVM network switch; sorting
updated.
> - `EarnTokenSelector`: render output token for withdraw; earn token
for stake.
> - **Selectors and data plumbing**:
> - Support non-EVM (TRX) balances/tokens in earn selectors; default TRX
pooled-staking APR to `0`.
> - Add unified multichain token selector including non-EVM; filter Tron
resource/testnet assets; use `getDecimalChainId`.
> - **Utilities/constants/i18n**:
> - Add `normalizeToDotDecimal`; `TronResourceType` constant; new TRON
strings (fee, success/error copy).
> - **Tests**: Extensive new/updated tests for views, hooks, lists,
buttons, selectors, and utils; snapshot updates.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0989d7f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…king and metrics (#23414)

<!--
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 implements `NETWORK_SWITCHED` Segment event tracking when users
switch networks via the network filter in the Activity view and Tokens
tab. The event is tracked with the correct properties (`chain_id`,
`from_network`, `to_network`, and `source: "Network Filter"`) and
handles both EVM and non-EVM networks correctly.

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

## **Manual testing steps**

```gherkin
Feature: Network Switched Event Tracking

  Scenario: User switches from EVM to EVM network via filter
    Given the user is on the Activity view or Tokens tab
    And the network filter is open
    And the current network is Ethereum Mainnet (0x1)
    When the user selects Base network (0x2105) from the filter
    Then the network should switch to Base
    And a NETWORK_SWITCHED event should be tracked with:
      - chain_id: "8453"
      - from_network: "Ethereum Main Network"
      - to_network: "Base"
      - source: "Network Filter"

  Scenario: User switches from non-EVM to non-EVM network via filter
    Given the user is on the Activity view or Tokens tab
    And the network filter is open
    And the current network is Solana
    When the user selects Bitcoin network from the filter
    Then the network should switch to Bitcoin
    And a NETWORK_SWITCHED event should be tracked with:
      - chain_id: "bip122:000000000019d6689c085ae165831e93"
      - from_network: "Solana"
      - to_network: "Bitcoin"
      - source: "Network Filter"
```

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

- [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]
> Adds metrics-driven NETWORK_SWITCHED tracking to NetworkMultiSelector
for EVM and non‑EVM selections, including “All Networks,” with robust
CAIP parsing and edge-case handling.
> 
> - **NetworkMultiSelector
(`app/components/UI/NetworkMultiSelector/NetworkMultiSelector.tsx`)**:
> - Integrates metrics to emit `MetaMetricsEvents.NETWORK_SWITCHED` with
`chain_id`, `from_network`, `to_network`, `source`.
> - Implements CAIP parsing and current network resolution
(`parseCaipChainId`, `getDecimalChainId`, `toHex`), plus
`getNetworkName` helper.
> - Uses selectors `selectEvmNetworkConfigurationsByChainId`,
`selectNonEvmNetworkConfigurationsByChainId`,
`selectIsEvmNetworkSelected`, `selectSelectedNonEvmNetworkChainId`,
`selectEvmChainId` to derive names/IDs.
> - Updates `onSelectNetwork`/`onSelectAllPopularNetworks` to track
switches (EVM and non‑EVM, and "All Networks"), guard unknown networks,
and log parse errors.
> - **Tests (`NetworkMultiSelector.test.tsx`)**:
> - Adds comprehensive cases covering EVM↔EVM, non‑EVM↔non‑EVM,
non‑EVM↔EVM, switching to/from "All Networks", malformed IDs, and
missing/unknown configs, with shared helpers and mocks.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9dd92de. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
… cp-7.61.0 (#23557)

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

Fixed incorrect data type for the `OPEN_POSITION` analytics property in
the Perps Market Details view. The property was incorrectly sending a
boolean value (`!!existingPosition`) instead of a numeric value, which
is inconsistent with other usages across the codebase and breaks
analytics data type expectations.


## **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 #23592
Slack Conversation:
https://consensys.slack.com/archives/C092T3GPHQD/p1764662917780139

## **Manual testing steps**

```gherkin
Feature: Perps Market Details Analytics

  Scenario: user views market details with existing position
    Given user has an open position in a perps market
    
    When user navigates to the market details view
    Then the OPEN_POSITION analytics property should be sent as number 1

  Scenario: user views market details without existing position
    Given user has no open position in a perps market
    
    When user navigates to the market details view
    Then the OPEN_POSITION analytics property should be sent as number 0
```

## **Screenshots/Recordings**

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

### **Before**

No Visual Changes

### **After**

No Visual Changes

## **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]
> Change OPEN_POSITION analytics property to 1/0 instead of boolean in
Perps Market Details screen event.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8ff0f75. 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 Dec 3, 2025
@pull pull Bot added the ⤵️ pull label Dec 3, 2025
@pull pull Bot merged commit f2f2565 into Reality2byte:main Dec 3, 2025
2 of 36 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