Skip to content

feat: Expose all PerpsController methods through messenger#28257

Merged
cryptodev-2s merged 8 commits intomainfrom
feat/perps-controller-expose-all-methods
Apr 2, 2026
Merged

feat: Expose all PerpsController methods through messenger#28257
cryptodev-2s merged 8 commits intomainfrom
feat/perps-controller-expose-all-methods

Conversation

@cryptodev-2s
Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s commented Apr 1, 2026

Description

Mirrors MetaMask/core#8352 for the mobile PerpsController.

  • Expand MESSENGER_EXPOSED_METHODS from 35 to 84 methods (alphabetized)
  • Auto-generate PerpsController-method-action-types.ts using messenger-generate-action-types CLI
  • Export PerpsControllerGetStateAction and all individual action types
  • Add generate-method-action-types check/fix scripts to lint/lint:fix

Changelog

CHANGELOG entry: null

Related issues

Fixes: N/A

Manual testing steps

N/A — type-only changes, no user-facing behavior

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

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.

Note

Medium Risk
Expands the messenger-exposed surface area of PerpsController, which could affect callers and permissions if any method was not intended to be remotely invokable. Also adds a new lint-time codegen check that may introduce CI failures if generation drifts across environments.

Overview
Exposes the full PerpsController API through the messenger by expanding and alphabetizing MESSENGER_EXPOSED_METHODS, and introduces a named PerpsControllerGetStateAction type.

Switches Perps messenger action typing to generated output: PerpsController-method-action-types.ts is regenerated to include JSDoc’d action types for all controller methods and index.ts now re-exports these individual action types.

Build/CI enforcement changes: bumps @metamask/messenger to ^1.1.0 (for the codegen CLI) and wires messenger-generate-action-types into lint/lint:fix via new generate-method-action-types scripts to keep generated types in sync.

Written by Cursor Bugbot for commit 0fe513d. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

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.

@metamaskbot metamaskbot added the team-core-platform Core Platform team label Apr 1, 2026
abretonc7s
abretonc7s previously approved these changes Apr 1, 2026
@cryptodev-2s cryptodev-2s marked this pull request as ready for review April 1, 2026 20:40
@cryptodev-2s cryptodev-2s requested a review from a team as a code owner April 1, 2026 20:40
- Expand MESSENGER_EXPOSED_METHODS from 35 to 84 methods (alphabetized)
- Auto-generate action types via messenger-generate-action-types CLI
- Export PerpsControllerGetStateAction and all action types
- Add generate-action-types scripts to lint and lint:fix
@cryptodev-2s cryptodev-2s force-pushed the feat/perps-controller-expose-all-methods branch from 74a7a22 to 29dfc64 Compare April 1, 2026 20:40
@cryptodev-2s cryptodev-2s self-assigned this Apr 1, 2026
@github-actions github-actions bot added the risk-high Extensive testing required · High bug introduction risk label Apr 1, 2026
@cryptodev-2s cryptodev-2s requested a review from abretonc7s April 1, 2026 20:50
@cryptodev-2s cryptodev-2s enabled auto-merge April 1, 2026 21:10
@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Apr 1, 2026
@cryptodev-2s cryptodev-2s added this pull request to the merge queue Apr 2, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 2, 2026
@cryptodev-2s cryptodev-2s added this pull request to the merge queue Apr 2, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 2, 2026
@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 2, 2026
@github-actions github-actions bot added risk-high Extensive testing required · High bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 2, 2026
@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Apr 2, 2026
"clean": "yarn clean:ios && yarn clean:android && yarn install --immutable",
"lint": "NODE_OPTIONS='--max-old-space-size=8192' eslint '**/*.{js,ts,tsx}' --cache",
"lint:fix": "NODE_OPTIONS='--max-old-space-size=8192' eslint '**/*.{js,ts,tsx}' --fix --cache",
"generate-method-action-types": "messenger-generate-action-types --fix app/controllers/perps && prettier --write 'app/controllers/perps/*-method-action-types.ts'",
Copy link
Copy Markdown
Contributor Author

@cryptodev-2s cryptodev-2s Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: @PerformancePreps
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on the PerpsController domain:

  1. PerpsController.ts: Massively expanded MESSENGER_EXPOSED_METHODS array (~50+ new methods added), including WebSocket subscriptions, provider management, withdrawal flows, market data preloading, and trading operations. Also exports a new PerpsControllerGetStateAction type. These are additive changes expanding the controller's messenger API surface.

  2. PerpsController-method-action-types.ts: Auto-generated file expanded from ~20 to ~70+ action type definitions, adding JSDoc and new types for all newly exposed methods.

  3. index.ts: Exports all new action types.

  4. package.json: Added generate-method-action-types scripts and bumped @metamask/messenger from 1.0.0 to 1.1.0 (minor version, likely adds the CLI tool used in the new scripts).

  5. yarn.lock: Corresponding dependency update.

Impact: Changes are additive and confined to the Perps controller. No Engine initialization changes, no other controller modifications. The expanded messenger API means Perps features now have more capabilities exposed, which could affect Perps UI flows.

Tag selection rationale:

  • SmokePerps: Directly tests Perps functionality (Add Funds, deposits, balance verification) - primary tag for these changes
  • SmokeWalletPlatform: Required per SmokePerps tag description (Perps is a section inside Trending tab)
  • SmokeConfirmations: Required per SmokePerps tag description (Add Funds deposits are on-chain transactions)

The changes don't affect other controller domains, navigation, or shared components, so other tags are not warranted.

Performance Test Selection:
The PerpsController changes include new market data preloading methods (startMarketDataPreload/stopMarketDataPreload), WebSocket subscription methods, and caching mechanisms (getCachedMarketDataForActiveProvider, getCachedUserDataForActiveProvider). These additions could impact perps market loading performance, position management, and the add funds flow. The @PerformancePreps tag covers perps market loading, position management, add funds flow, and order execution - all directly relevant to these controller changes.

View GitHub Actions results

@cryptodev-2s cryptodev-2s enabled auto-merge April 2, 2026 14:21
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

E2E Fixture Validation — Schema is up to date
18 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

@cryptodev-2s cryptodev-2s added this pull request to the merge queue Apr 2, 2026
Merged via the queue into main with commit 65c0a30 Apr 2, 2026
78 of 82 checks passed
@cryptodev-2s cryptodev-2s deleted the feat/perps-controller-expose-all-methods branch April 2, 2026 15:20
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 2026
@metamaskbot metamaskbot added the release-7.73.0 Issue or pull request that will be included in release 7.73.0 label Apr 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-XL team-core-platform Core Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants