Commit 0c85998
authored
refactor(perps): rename interface to match core repo (#25245)
## **Description**
This PR prepares the Perps codebase for a future Core monorepo migration
by aligning naming conventions with Core standards.
**Motivation:** A planned migration to the Core monorepo will be cleaner
if naming conventions match Core standards ahead of time. This PR
applies all renames in Mobile first, enabling near-identical code during
migration.
**Changes:**
1. **Interface Renames** - Removed `I` prefix from all interfaces in
`controllers/types/index.ts` (e.g., `IPerpsProvider` → `PerpsProvider`,
`IPerpsPlatformDependencies` → `PerpsPlatformDependencies`) to match
Core conventions
2. **Constant Property Renames** - Changed constant object properties
from SCREAMING_SNAKE to PascalCase (e.g.,
`PERPS_CONSTANTS.WEBSOCKET_TIMEOUT` →
`PERPS_CONSTANTS.WebsocketTimeout`) while keeping top-level constant
names unchanged
3. **Minor Type Safety** - Added `isVersionGatedFeatureFlag` type guard
for proper type narrowing
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: N/A (refactoring/preparation work)
## **Manual testing steps**
```gherkin
Feature: Perps functionality unchanged after refactor
Scenario: User can view perps markets
Given user has perps feature enabled
When user navigates to the Perps tab
Then markets list loads correctly
Scenario: User can place a trade
Given user is on a market detail page with sufficient balance
When user places a market order
Then order is submitted successfully
```
## **Screenshots/Recordings**
Not applicable - this is a refactoring PR with no UI changes.
### **Before**
N/A
### **After**
N/A
## **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]
> Aligns Perps code with Core naming standards; no functional changes
intended.
>
> - Renames `I*` interfaces to non-prefixed types across controllers,
providers, services, aggregation, selectors, adapters, and tests (e.g.,
`IPerpsProvider` → `PerpsProvider`, `IPerpsPlatformDependencies` →
`PerpsPlatformDependencies`)
> - Converts many constant object properties from SCREAMING_SNAKE to
PascalCase and updates all UI usages (e.g.,
`PERPS_CONSTANTS.FALLBACK_PRICE_DISPLAY` →
`PERPS_CONSTANTS.FallbackPriceDisplay`, slippage/limits/sorting configs,
etc.)
> - Mobile infrastructure/mocks extended: add
`authentication.getBearerToken`, `network.getSelectedNetworkClientId`,
`streamManager.clearAllChannels`; adjust rewards accessors; update
builder/referral/HIP-3/testnet config keys
> - Updates logging tags to use `PERPS_CONSTANTS.FeatureName`; refreshes
tests to new names
> - No UI/feature changes; behavior should remain the same
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c6452b4. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 732c3e5 commit 0c85998
File tree
129 files changed
+1028
-1042
lines changed- app
- components
- UI/Perps
- Views
- PerpsAdjustMarginView
- PerpsClosePositionView
- PerpsHomeView
- PerpsMarketDetailsView
- PerpsOrderView
- PerpsPositionsView
- PerpsTPSLView
- __mocks__
- adapters
- components
- LivePriceDisplay
- PerpsAmountDisplay
- PerpsBottomSheetTooltip/content
- PerpsCard
- PerpsFillTag
- PerpsLeverageBottomSheet
- PerpsLimitPriceBottomSheet
- PerpsLoadingSkeleton
- PerpsMarketBalanceActions
- PerpsMarketList
- PerpsMarketRowItem
- PerpsMarketSortDropdowns
- PerpsMarketSortFieldBottomSheet
- PerpsMarketStatisticsCard
- PerpsMarketTradesList
- PerpsOrderHeader
- PerpsPositionCard
- PerpsQuoteExpiredModal
- PerpsRecentActivityList
- PerpsRowSkeleton
- PerpsTransactionItem
- constants
- controllers
- aggregation
- providers
- services
- types
- hooks
- stream
- providers
- channels
- services
- utils
- Views/Wallet
- core
- DeeplinkManager/handlers/legacy
- __tests__
- Engine/controllers/perps-controller
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
129 files changed
+1028
-1042
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
406 | | - | |
| 405 | + | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| |||
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
264 | | - | |
| 263 | + | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
| 299 | + | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
| 310 | + | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
| 319 | + | |
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
| 415 | + | |
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
536 | | - | |
| 536 | + | |
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
539 | | - | |
| 539 | + | |
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
| |||
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
692 | | - | |
| 692 | + | |
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
698 | | - | |
| 698 | + | |
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
707 | | - | |
| 707 | + | |
708 | 708 | | |
709 | 709 | | |
710 | 710 | | |
| |||
849 | 849 | | |
850 | 850 | | |
851 | 851 | | |
852 | | - | |
| 852 | + | |
853 | 853 | | |
854 | 854 | | |
855 | 855 | | |
| |||
893 | 893 | | |
894 | 894 | | |
895 | 895 | | |
896 | | - | |
| 896 | + | |
897 | 897 | | |
898 | 898 | | |
899 | 899 | | |
| |||
Lines changed: 8 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
420 | | - | |
| 419 | + | |
421 | 420 | | |
422 | 421 | | |
423 | 422 | | |
| |||
830 | 829 | | |
831 | 830 | | |
832 | 831 | | |
833 | | - | |
834 | | - | |
| 832 | + | |
| 833 | + | |
835 | 834 | | |
836 | 835 | | |
837 | 836 | | |
| |||
1182 | 1181 | | |
1183 | 1182 | | |
1184 | 1183 | | |
1185 | | - | |
| 1184 | + | |
1186 | 1185 | | |
1187 | 1186 | | |
1188 | 1187 | | |
| |||
1210 | 1209 | | |
1211 | 1210 | | |
1212 | 1211 | | |
1213 | | - | |
| 1212 | + | |
1214 | 1213 | | |
1215 | 1214 | | |
1216 | 1215 | | |
| |||
1234 | 1233 | | |
1235 | 1234 | | |
1236 | 1235 | | |
1237 | | - | |
| 1236 | + | |
1238 | 1237 | | |
1239 | 1238 | | |
1240 | 1239 | | |
| |||
1448 | 1447 | | |
1449 | 1448 | | |
1450 | 1449 | | |
1451 | | - | |
| 1450 | + | |
1452 | 1451 | | |
1453 | 1452 | | |
1454 | 1453 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
Lines changed: 14 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
491 | | - | |
| 491 | + | |
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| |||
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
506 | | - | |
| 506 | + | |
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
534 | | - | |
| 534 | + | |
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
| 577 | + | |
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | | - | |
| 609 | + | |
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
669 | | - | |
| 669 | + | |
670 | 670 | | |
671 | 671 | | |
672 | 672 | | |
| |||
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
704 | | - | |
| 704 | + | |
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
| |||
744 | 744 | | |
745 | 745 | | |
746 | 746 | | |
747 | | - | |
| 747 | + | |
748 | 748 | | |
749 | 749 | | |
750 | 750 | | |
| |||
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
779 | | - | |
| 779 | + | |
780 | 780 | | |
781 | 781 | | |
782 | 782 | | |
| |||
828 | 828 | | |
829 | 829 | | |
830 | 830 | | |
831 | | - | |
| 831 | + | |
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
| |||
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
867 | | - | |
868 | | - | |
| 867 | + | |
| 868 | + | |
869 | 869 | | |
870 | 870 | | |
871 | 871 | | |
| |||
0 commit comments