Commit b54b8e2
feat(perps-controller): add TP/SL RoE sign analytics constants (MetaMask#9322)
## Explanation
Mobile ships Auto Close TP/SL RoE sign toggle analytics using interim
local constants in `perpsEventsLocal.ts` (`tpsl_roe_sign_toggled`,
`roe_sign`) because these keys were not yet in the published
`@metamask/perps-controller` contract. After MetaMask#9311 consolidated the
analytics contract in core, this small gap remained for the RoE sign
toggle interaction.
This PR adds the missing shared constants to
`@metamask/perps-controller` so clients can import typed values instead
of maintaining local mirrors:
- `PERPS_EVENT_PROPERTY.ROE_SIGN` → `roe_sign` (the toggled sign: `'+'`
| `'-'`)
- `PERPS_EVENT_VALUE.INTERACTION_TYPE.TPSL_ROE_SIGN_TOGGLED` →
`tpsl_roe_sign_toggled`
No controller or runtime behavior changes — event emission stays
client-side (`Perp UI Interaction`). Only the contract/constants surface
is extended.
## References
- https://consensyssoftware.atlassian.net/browse/TAT-3429
- Follow-up client wiring:
https://consensyssoftware.atlassian.net/browse/TAT-3430 (Mobile +
Extension replace `perpsEventsLocal.ts` after package release)
- Builds on analytics consolidation: MetaMask#9311
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [x] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them — N/A: additive constants only
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Additive analytics constants only; no runtime, auth, or trading
behavior changes.
>
> **Overview**
> Extends the shared Perps analytics contract in
`@metamask/perps-controller` with constants for **Auto Close TP/SL RoE
sign toggle** events, so mobile and extension can drop local mirrors
(`perpsEventsLocal.ts`) and import typed keys from core.
>
> Adds **`PERPS_EVENT_PROPERTY.ROE_SIGN`** (`roe_sign`) for the toggled
sign (`'+'` | `'-'`) and
**`PERPS_EVENT_VALUE.INTERACTION_TYPE.TPSL_ROE_SIGN_TOGGLED`**
(`tpsl_roe_sign_toggled`). Changelog and `eventNames` tests assert the
new exports; **no controller or emission logic** changes in this
package.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f933d88. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent b3069bf commit b54b8e2
3 files changed
Lines changed: 16 additions & 0 deletions
File tree
- packages/perps-controller
- src/constants
- tests/src/constants
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
| |||
454 | 456 | | |
455 | 457 | | |
456 | 458 | | |
| 459 | + | |
| 460 | + | |
457 | 461 | | |
458 | 462 | | |
459 | 463 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
| |||
348 | 354 | | |
349 | 355 | | |
350 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
351 | 360 | | |
352 | 361 | | |
353 | 362 | | |
| |||
0 commit comments