Skip to content

chore(earn): type Earn navigators with feature param lists (Phase 3)#33291

Open
weitingsun wants to merge 2 commits into
mainfrom
chore/navigation-typing-phase-3-earn
Open

chore(earn): type Earn navigators with feature param lists (Phase 3)#33291
weitingsun wants to merge 2 commits into
mainfrom
chore/navigation-typing-phase-3-earn

Conversation

@weitingsun

@weitingsun weitingsun commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

Phase 3 of the incremental React Navigation typing migration — Earn feature.

Earn’s nested navigators (EarnScreens / EarnModals) were loosely typed (EarnScreensParams / NestedNavigationParams), so nested navigate(container, { screen, params }) calls could not be checked against real screen param shapes. This PR introduces feature-level param lists and wires them into the Earn navigators and RootStackParamList, following the same pattern used for Perps / Rewards / Predict / Card.

This is types-only — no intentional runtime navigation behavior change.

What changed

Feature param lists (app/components/UI/Earn/types/navigation.ts)

  • EarnScreensStackParamList — screen stack (EarnScreenStack): lending deposit/withdrawal confirmation, mUSD conversion education, redesigned confirmations
  • EarnModalsNavigationParamList — modal stack (EarnModalStack): lending max withdrawal, lending learn more, redesigned confirmations
  • EarnNavigationParamList — feature union + nested EarnScreens / EarnModals entries
  • RedesignedConfirmations typed as ConfirmationParams | undefined

Navigators (app/components/UI/Earn/routes/index.tsx)

  • createNativeStackNavigator<EarnScreensStackParamList>() for EarnScreenStack
  • createNativeStackNavigator<EarnModalsNavigationParamList>() for EarnModalStack

Root stack (app/core/NavigationService/types.ts)

  • EarnScreensNavigatorScreenParams<EarnScreensStackParamList>
  • EarnModalsNavigatorScreenParams<EarnModalsNavigationParamList>
  • Leaf Earn routes now reference the feature param lists

Cleanup

  • Removed unused loose EarnScreensParams from Earn.types.ts

Changelog

CHANGELOG entry:null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-674

Manual testing steps

N/A

Screenshots/Recordings

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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

Low Risk
Types-only refactor with no runtime navigation changes; risk is limited to possible TypeScript breakage at navigate call sites.

Overview
Phase 3 of the React Navigation typing migration for Earn: nested EarnScreens / EarnModals stacks now use dedicated param lists instead of loose EarnScreensParams and generic nested params.

A new app/components/UI/Earn/types/navigation.ts defines EarnScreensStackParamList, EarnModalsNavigationParamList, and EarnNavigationParamList, wiring lending confirmation, mUSD education, max withdrawal, learn more, and RedesignedConfirmations to their existing param types. EarnScreenStack and EarnModalStack pass these types into createNativeStackNavigator, and RootStackParamList uses NavigatorScreenParams<> for nested entry routes while leaf Earn routes alias the feature lists. Unused EarnScreensParams is removed from Earn.types.ts.

No intentional runtime navigation changes—compile-time safety only, aligned with Perps / Rewards / Predict / Card.

Reviewed by Cursor Bugbot for commit 0e20dec. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown
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.

@metamask-ci metamask-ci Bot added the team-mobile-platform Mobile Platform team label Jul 14, 2026
@weitingsun weitingsun marked this pull request as ready for review July 14, 2026 21:15
@weitingsun weitingsun requested review from a team as code owners July 14, 2026 21:15
@metamask-ci

metamask-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Pre-merge author checklist has unchecked items (e.g. "I've tested on Android"). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@github-actions github-actions Bot added size-S risk:low AI analysis: low risk labels Jul 14, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.37%. Comparing base (6e619fd) to head (10f3801).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #33291   +/-   ##
=======================================
  Coverage   84.36%   84.37%           
=======================================
  Files        6125     6127    +2     
  Lines      163461   163530   +69     
  Branches    39884    39887    +3     
=======================================
+ Hits       137901   137975   +74     
+ Misses      16048    16045    -3     
+ Partials     9512     9510    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeStake, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR contains purely TypeScript type refactoring changes for the Earn (staking/lending) navigation system:

  1. app/components/UI/Earn/types/navigation.ts (new file): Centralizes navigation param list types for Earn screens (EarnScreensStackParamList) and Earn modals (EarnModalsNavigationParamList). No runtime logic.

  2. app/components/UI/Earn/Earn.types.ts: Removes EarnScreensParams interface that was moved/superseded by the new navigation types file.

  3. app/components/UI/Earn/routes/index.tsx: Adds generic type parameters to the stack navigators using the new typed param lists — purely a TypeScript improvement.

  4. app/core/NavigationService/types.ts (critical file): Updates imports to use the new navigation types and refines RootStackParamList to use proper NavigatorScreenParams<> wrappers for Earn routes. Route names remain identical; only the TypeScript types change.

These are zero-runtime-impact TypeScript refactoring changes. No navigation logic, component behavior, or route structure was modified. The risk is that a type mismatch could cause a compile error that breaks the Earn/staking flows at runtime, so running SmokeStake is appropriate. Per SmokeStake's description, SmokeConfirmations should also be selected since staking flows involve transaction confirmations. No performance impact expected from type-only changes.

Performance Test Selection:
These are pure TypeScript type definition changes with no runtime behavior modifications. No performance-sensitive code paths (rendering, data fetching, state management) were altered. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@Cal-L Cal-L left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@weitingsun weitingsun self-assigned this Jul 15, 2026
@weitingsun weitingsun enabled auto-merge July 15, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low AI analysis: low risk size-S team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants