Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/perps-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add Auto Close TP/SL RoE sign toggle analytics constants to `PERPS_EVENT_PROPERTY` and `PERPS_EVENT_VALUE` so mobile and extension can import them from `@metamask/perps-controller` instead of local mirrors ([#9322](https://github.com/MetaMask/core/pull/9322))
- New `PERPS_EVENT_PROPERTY` key: `ROE_SIGN` (`roe_sign`)
- New `PERPS_EVENT_VALUE.INTERACTION_TYPE` entry: `TPSL_ROE_SIGN_TOGGLED` (`tpsl_roe_sign_toggled`)
- Add `listedAt` (epoch ms) to `PerpsMarketData` and `TerminalAssetMetadata`, sourced from the Terminal API and normalized from either a numeric epoch value or an ISO 8601 string. Clients can use this field to surface recently added markets (e.g. markets listed within the last 30 days). ([#9308](https://github.com/MetaMask/core/pull/9308))
- Add recently viewed markets tracking to `PerpsController`: ([#9308](https://github.com/MetaMask/core/pull/9308))
- New `recentlyViewedMarkets` persisted state (per-network: `testnet`/`mainnet`), containing `{ symbol, viewedAt }` entries ordered newest-first and capped at 10.
Expand Down
4 changes: 4 additions & 0 deletions packages/perps-controller/src/constants/eventNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ export const PERPS_EVENT_PROPERTY = {
HAS_STOP_LOSS: 'has_stop_loss',
TAKE_PROFIT_PERCENTAGE: 'take_profit_percentage',
STOP_LOSS_PERCENTAGE: 'stop_loss_percentage',
// Auto Close TP/SL RoE sign toggle (`'+'` | `'-'`)
ROE_SIGN: 'roe_sign',
// Watchlist/Favorites properties
FAVORITES_COUNT: 'favorites_count',

Expand Down Expand Up @@ -454,6 +456,8 @@ export const PERPS_EVENT_VALUE = {
SLIPPAGE_CONFIG_OPENED: 'slippage_config_opened',
SLIPPAGE_CONFIG_CHANGED: 'slippage_config_changed',
SLIPPAGE_LIMIT_BLOCKED_ORDER: 'slippage_limit_blocked_order',
// Auto Close TP/SL RoE sign toggle
TPSL_ROE_SIGN_TOGGLED: 'tpsl_roe_sign_toggled',
// Discovery analytics
MARKET_LIST_FILTER: 'market_list_filter',
// Sort / filter interactions (TAT-3142)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ describe('PERPS_EVENT_PROPERTY', () => {
});
});

describe('Auto Close TP/SL RoE sign analytics keys', () => {
it('exports ROE_SIGN property key', () => {
expect(PERPS_EVENT_PROPERTY.ROE_SIGN).toBe('roe_sign');
});
});

describe('consolidated analytics contract property keys (TAT-3463)', () => {
it('exports entry point / discovery attribution keys (TAT-3080)', () => {
expect(PERPS_EVENT_PROPERTY.ENTRY_POINT).toBe('entry_point');
Expand Down Expand Up @@ -348,6 +354,9 @@ describe('PERPS_EVENT_VALUE consolidated contract entries (TAT-3463)', () => {
expect(
PERPS_EVENT_VALUE.INTERACTION_TYPE.PAYMENT_TOKEN_SELECTOR_DISMISSED,
).toBe('payment_token_selector_dismissed');
expect(PERPS_EVENT_VALUE.INTERACTION_TYPE.TPSL_ROE_SIGN_TOGGLED).toBe(
'tpsl_roe_sign_toggled',
);
});

it('exports ACTION.ABANDON_ORDER (TAT-3136)', () => {
Expand Down
Loading