chore(runway): cherry-pick fix(perps): geo-restrictions on ui#25392
Merged
joaoloureirop merged 1 commit intorelease/7.63.0from Jan 29, 2026
Merged
chore(runway): cherry-pick fix(perps): geo-restrictions on ui#25392joaoloureirop merged 1 commit intorelease/7.63.0from
joaoloureirop merged 1 commit intorelease/7.63.0from
Conversation
This PR fixes the missing geo-restriction checks in several perpetuals trading flows as reported in #25374. **PerpsOrderBookView.tsx:** - Added geo-restriction check to `handleLongPress` - shows geo-block modal instead of navigating to long order - Added geo-restriction check to `handleShortPress` - shows geo-block modal instead of navigating to short order - Added geo-restriction check to `handleClosePosition` - shows geo-block modal instead of navigating to close position - Added geo-restriction check to `handleModifyPress` - shows geo-block modal instead of opening modify sheet **PerpsMarketDetailsView.tsx:** - Added geo-restriction check to `handleAutoClosePress` - shows geo-block modal instead of navigating to TP/SL screen - Added geo-restriction check to `handleMarginPress` - shows geo-block modal instead of opening adjust margin sheet - Added geo-restriction check to `handleAddMarginFromBanner` - shows geo-block modal instead of navigating to add margin - Added geo-restriction check to `handleSetStopLossFromBanner` - shows geo-block modal instead of setting stop loss **PerpsTabView.tsx:** - Added geo-restriction check to `handleCloseAllPress` - shows geo-block modal instead of navigating to close all positions modal **PerpsHomeView.tsx:** - Added geo-restriction check to `handleCloseAllPress` - shows geo-block modal instead of opening close all positions sheet **eventNames.ts:** - Added new analytics source values for tracking geo-block notifications from each flow **Note:** Cancel all orders is intentionally NOT geo-blocked - users should be able to cancel their existing orders similar to withdrawals. CHANGELOG entry: Fixed geo-restriction enforcement for perpetuals trading flows including order book actions, position management, stop-loss prompts, and close all positions Fixes: #25374 ```gherkin Feature: Geo-restriction on perps trading flows Scenario: User in geo-blocked region cannot trade via order book Given user is in a geo-blocked region (e.g., US) And user has navigated to the perps order book screen When user taps on Long button Then geo-restriction modal should appear And user should not navigate to long order screen When user taps on Short button Then geo-restriction modal should appear And user should not navigate to short order screen When user taps on Close button (with existing position) Then geo-restriction modal should appear And user should not navigate to close position screen When user taps on Modify button (with existing position) Then geo-restriction modal should appear And modify sheet should not open Scenario: User in geo-blocked region cannot manage positions Given user is in a geo-blocked region (e.g., US) And user has an existing perpetuals position When user taps on Auto-close button on position card Then geo-restriction modal should appear And user should not navigate to TP/SL screen When user taps on Margin button on position card Then geo-restriction modal should appear And adjust margin sheet should not open Scenario: User in geo-blocked region cannot use stop-loss prompt actions Given user is in a geo-blocked region (e.g., US) And user has an existing position with stop-loss prompt visible When user taps on Add Margin from stop-loss prompt banner Then geo-restriction modal should appear And user should not navigate to add margin screen When user taps on Set Stop Loss from stop-loss prompt banner Then geo-restriction modal should appear And stop loss should not be set Scenario: User in geo-blocked region cannot close all positions Given user is in a geo-blocked region (e.g., US) And user has existing perpetuals positions When user taps on Close All button in perps tab Then geo-restriction modal should appear And close all positions modal should not open When user taps on Close All button in perps home Then geo-restriction modal should appear And close all positions sheet should not open Scenario: User in geo-blocked region CAN cancel all orders Given user is in a geo-blocked region (e.g., US) And user has existing perpetuals orders When user taps on Cancel All button Then cancel all orders modal should open (NOT geo-blocked) ``` Users in geo-blocked regions could access trading flows without restriction Geo-restriction modal appears for all trading flows when user is not eligible - [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. - [ ] 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] > **Medium Risk** > Medium risk because it changes eligibility gating on core trading/position-management actions and adds new analytics sources, which could block legitimate users if eligibility state is wrong. > > **Overview** > Adds geo-restriction checks (with `PERPS_SCREEN_VIEWED` tracking) to additional Perps entry points so ineligible users are shown the `geo_block` tooltip instead of proceeding. > > This gates actions in `PerpsOrderBookView` (Long/Short/Close/Modify), `PerpsMarketDetailsView` (Auto-close/Adjust margin/Stop-loss prompt actions), and bulk Close All from `PerpsTabView` and `PerpsHomeView` (with a dedicated close-all geo-block modal state). Updates `eventNames.ts` with new `SOURCE` values for these block points and expands/adjusts tests and mocks to cover the new geo-block behaviors. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 3aa982a. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - base branch is not main (base: release/7.63.0) All E2E tests pre-selected. |
|
joaoloureirop
approved these changes
Jan 29, 2026
Collaborator
|
No release label on PR. Adding release label release-7.63.0 on PR, as PR was cherry-picked in branch 7.63.0. |
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.


Description
This PR fixes the missing geo-restriction checks in several perpetuals
trading flows as reported in #25374.
PerpsOrderBookView.tsx:
handleLongPress- shows geo-blockmodal instead of navigating to long order
handleShortPress- shows geo-blockmodal instead of navigating to short order
handleClosePosition- shows geo-blockmodal instead of navigating to close position
handleModifyPress- shows geo-blockmodal instead of opening modify sheet
PerpsMarketDetailsView.tsx:
handleAutoClosePress- showsgeo-block modal instead of navigating to TP/SL screen
handleMarginPress- shows geo-blockmodal instead of opening adjust margin sheet
handleAddMarginFromBanner- showsgeo-block modal instead of navigating to add margin
handleSetStopLossFromBanner- showsgeo-block modal instead of setting stop loss
PerpsTabView.tsx:
handleCloseAllPress- shows geo-blockmodal instead of navigating to close all positions modal
PerpsHomeView.tsx:
handleCloseAllPress- shows geo-blockmodal instead of opening close all positions sheet
eventNames.ts:
from each flow
Note: Cancel all orders is intentionally NOT geo-blocked - users
should be able to cancel their existing orders similar to withdrawals.
Changelog
CHANGELOG entry: Fixed geo-restriction enforcement for perpetuals
trading flows including order book actions, position management,
stop-loss prompts, and close all positions
Related issues
Fixes: #25374
Manual testing steps
Screenshots/Recordings
Before
Users in geo-blocked regions could access trading flows without
restriction
After
Geo-restriction modal appears for all trading flows when user is not
eligible
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Note
Medium Risk
Adds eligibility gating to multiple trading and position-management UI actions; mistakes could wrongly block eligible users or allow restricted actions through. Changes are localized to UI handlers and analytics but touch critical perps flows.
Overview
Enforces geo-restrictions across key Perps UI actions. Order book Long/Short/Close/Modify, market details auto-close (TP/SL), adjust margin, stop-loss prompt actions, and bulk close-all entry points now check
selectPerpsEligibilityand show the geo-block tooltip instead of navigating/opening sheets.Adds analytics attribution for blocked actions. New
PerpsEventValues.SOURCEconstants are introduced to distinguish which UI trigger surfaced the geo-block notification.Updates tests to cover new gating behavior. Mocks are extended and new cases added to assert geo-block modal display and that navigation/sheets are not triggered when ineligible.
Written by Cursor Bugbot for commit 1698d05. This will update automatically on new commits. Configure here.
d87e9ea