@metamask-previews/perps-controller 10.0.0-preview-e58fe0640 → 10.0.0-preview-8eb2c7f6e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/PerpsController-method-action-types.cjs.map +1 -1
  3. package/dist/PerpsController-method-action-types.d.cts +3 -3
  4. package/dist/PerpsController-method-action-types.d.mts +3 -3
  5. package/dist/PerpsController-method-action-types.mjs.map +1 -1
  6. package/dist/PerpsController.cjs +5 -5
  7. package/dist/PerpsController.cjs.map +1 -1
  8. package/dist/PerpsController.d.cts +4 -4
  9. package/dist/PerpsController.d.mts +4 -4
  10. package/dist/PerpsController.mjs +5 -5
  11. package/dist/PerpsController.mjs.map +1 -1
  12. package/dist/constants/eventNames.cjs +17 -17
  13. package/dist/constants/eventNames.cjs.map +1 -1
  14. package/dist/constants/eventNames.mjs +17 -17
  15. package/dist/constants/eventNames.mjs.map +1 -1
  16. package/dist/perpsErrorCodes.cjs +4 -0
  17. package/dist/perpsErrorCodes.cjs.map +1 -1
  18. package/dist/perpsErrorCodes.d.cts +2 -0
  19. package/dist/perpsErrorCodes.d.cts.map +1 -1
  20. package/dist/perpsErrorCodes.d.mts +2 -0
  21. package/dist/perpsErrorCodes.d.mts.map +1 -1
  22. package/dist/perpsErrorCodes.mjs +4 -0
  23. package/dist/perpsErrorCodes.mjs.map +1 -1
  24. package/dist/providers/HyperLiquidProvider.cjs +76 -25
  25. package/dist/providers/HyperLiquidProvider.cjs.map +1 -1
  26. package/dist/providers/HyperLiquidProvider.d.cts.map +1 -1
  27. package/dist/providers/HyperLiquidProvider.d.mts.map +1 -1
  28. package/dist/providers/HyperLiquidProvider.mjs +76 -25
  29. package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
  30. package/dist/services/HyperLiquidSubscriptionService.cjs +9 -0
  31. package/dist/services/HyperLiquidSubscriptionService.cjs.map +1 -1
  32. package/dist/services/HyperLiquidSubscriptionService.d.cts +7 -0
  33. package/dist/services/HyperLiquidSubscriptionService.d.cts.map +1 -1
  34. package/dist/services/HyperLiquidSubscriptionService.d.mts +7 -0
  35. package/dist/services/HyperLiquidSubscriptionService.d.mts.map +1 -1
  36. package/dist/services/HyperLiquidSubscriptionService.mjs +9 -0
  37. package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -1
  38. package/dist/services/TradingService.cjs +14 -14
  39. package/dist/services/TradingService.cjs.map +1 -1
  40. package/dist/services/TradingService.d.cts +2 -2
  41. package/dist/services/TradingService.d.mts +2 -2
  42. package/dist/services/TradingService.mjs +14 -14
  43. package/dist/services/TradingService.mjs.map +1 -1
  44. package/dist/types/index.cjs +1 -1
  45. package/dist/types/index.cjs.map +1 -1
  46. package/dist/types/index.d.cts +2 -2
  47. package/dist/types/index.d.mts +2 -2
  48. package/dist/types/index.mjs +1 -1
  49. package/dist/types/index.mjs.map +1 -1
  50. package/package.json +1 -1
@@ -126,7 +126,7 @@ class TradingService {
126
126
  hasTP: Boolean(params.takeProfitPrice),
127
127
  hasSL: Boolean(params.stopLossPrice),
128
128
  });
129
- // Emit submitted event before the provider round-trip (TAT-3134)
129
+ // Emit submitted event before the provider round-trip
130
130
  __classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_trackSubmitted).call(this, index_js_1.PerpsAnalyticsEvent.TradeTransaction, {
131
131
  [eventNames_js_1.PERPS_EVENT_PROPERTY.ASSET]: params.symbol,
132
132
  [eventNames_js_1.PERPS_EVENT_PROPERTY.DIRECTION]: params.isBuy
@@ -394,7 +394,7 @@ class TradingService {
394
394
  * @param options.provider - The perps provider instance.
395
395
  * @param options.params - The operation parameters.
396
396
  * @param options.context - The service context for dependencies.
397
- * @param options.bulkActionId - Optional batch correlation id (TAT-3150).
397
+ * @param options.bulkActionId - Optional batch correlation id.
398
398
  * @returns The result of the operation.
399
399
  */
400
400
  async cancelOrder(options) {
@@ -402,7 +402,7 @@ class TradingService {
402
402
  const traceId = (0, uuid_1.v4)();
403
403
  const startTime = __classPrivateFieldGet(this, _TradingService_deps, "f").performance.now();
404
404
  let traceData;
405
- // Shared attribution + bulk correlation props (TAT-3080, TAT-3150)
405
+ // Shared attribution + bulk correlation props
406
406
  const cancelExtraProps = {
407
407
  ...__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_buildAttributionProperties).call(this, params.trackingData),
408
408
  ...(bulkActionId && {
@@ -424,7 +424,7 @@ class TradingService {
424
424
  orderId: params.orderId,
425
425
  },
426
426
  });
427
- // Emit submitted event before the provider round-trip (TAT-3134)
427
+ // Emit submitted event before the provider round-trip
428
428
  __classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_trackSubmitted).call(this, index_js_1.PerpsAnalyticsEvent.OrderCancelTransaction, {
429
429
  [eventNames_js_1.PERPS_EVENT_PROPERTY.ASSET]: params.symbol,
430
430
  ...cancelExtraProps,
@@ -505,7 +505,7 @@ class TradingService {
505
505
  async cancelOrders(options) {
506
506
  const { provider, params, context, withStreamPause } = options;
507
507
  const traceId = (0, uuid_1.v4)();
508
- // Correlation id linking every per-item event to the batch summary (TAT-3150)
508
+ // Correlation id linking every per-item event to the batch summary
509
509
  const bulkActionId = (0, uuid_1.v4)();
510
510
  const startTime = __classPrivateFieldGet(this, _TradingService_deps, "f").performance.now();
511
511
  let operationResult = null;
@@ -649,7 +649,7 @@ class TradingService {
649
649
  * @param options.params - The operation parameters.
650
650
  * @param options.context - The service context for dependencies.
651
651
  * @param options.reportOrderToDataLake - The report order to data lake value.
652
- * @param options.bulkActionId - Optional batch correlation id (TAT-3150).
652
+ * @param options.bulkActionId - Optional batch correlation id.
653
653
  * @returns The result of the operation.
654
654
  */
655
655
  async closePosition(options) {
@@ -676,7 +676,7 @@ class TradingService {
676
676
  symbol: params.symbol,
677
677
  context,
678
678
  });
679
- // Emit submitted event before the provider round-trip (TAT-3134)
679
+ // Emit submitted event before the provider round-trip
680
680
  __classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_trackSubmitted).call(this, index_js_1.PerpsAnalyticsEvent.PositionCloseTransaction, {
681
681
  [eventNames_js_1.PERPS_EVENT_PROPERTY.ASSET]: params.symbol,
682
682
  [eventNames_js_1.PERPS_EVENT_PROPERTY.ORDER_TYPE]: params.orderType ?? eventNames_js_1.PERPS_EVENT_VALUE.ORDER_TYPE.MARKET,
@@ -780,7 +780,7 @@ class TradingService {
780
780
  async closePositions(options) {
781
781
  const { provider, params, context } = options;
782
782
  const traceId = (0, uuid_1.v4)();
783
- // Correlation id linking every per-item event to the batch summary (TAT-3150)
783
+ // Correlation id linking every per-item event to the batch summary
784
784
  const bulkActionId = (0, uuid_1.v4)();
785
785
  const startTime = __classPrivateFieldGet(this, _TradingService_deps, "f").performance.now();
786
786
  let operationResult = null;
@@ -963,7 +963,7 @@ class TradingService {
963
963
  stopLossPrice: params.stopLossPrice ?? '',
964
964
  },
965
965
  });
966
- // Emit submitted event before the provider round-trip (TAT-3134)
966
+ // Emit submitted event before the provider round-trip
967
967
  __classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_trackSubmitted).call(this, index_js_1.PerpsAnalyticsEvent.RiskManagement, {
968
968
  [eventNames_js_1.PERPS_EVENT_PROPERTY.ASSET]: params.symbol,
969
969
  [eventNames_js_1.PERPS_EVENT_PROPERTY.SOURCE]: source,
@@ -1059,7 +1059,7 @@ class TradingService {
1059
1059
  ...(errorMessage && {
1060
1060
  [eventNames_js_1.PERPS_EVENT_PROPERTY.ERROR_MESSAGE]: errorMessage,
1061
1061
  }),
1062
- // Discovery attribution (TAT-3080)
1062
+ // Discovery attribution
1063
1063
  ...__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_buildAttributionProperties).call(this, params.trackingData),
1064
1064
  };
1065
1065
  // Track event once with all properties
@@ -1245,7 +1245,7 @@ class TradingService {
1245
1245
  [eventNames_js_1.PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,
1246
1246
  [eventNames_js_1.PERPS_EVENT_PROPERTY.ACTION]: flipAction,
1247
1247
  [eventNames_js_1.PERPS_EVENT_PROPERTY.ORDER_VALUE]: positionSize * executedPrice,
1248
- // MetaMask fee on flip trades (TAT-3146)
1248
+ // MetaMask fee on flip trades
1249
1249
  ...(trackingData?.metamaskFee !== undefined && {
1250
1250
  [eventNames_js_1.PERPS_EVENT_PROPERTY.METAMASK_FEE]: trackingData.metamaskFee,
1251
1251
  }),
@@ -1458,7 +1458,7 @@ _TradingService_deps = new WeakMap(), _TradingService_controllerDeps = new WeakM
1458
1458
  Object.keys(params.trackingData.abTests).length > 0) {
1459
1459
  properties[eventNames_js_1.PERPS_EVENT_PROPERTY.AB_TESTS] = params.trackingData.abTests;
1460
1460
  }
1461
- // Propagate discovery attribution + hl_fee_rate (TAT-3080, TAT-3149)
1461
+ // Propagate discovery attribution + hl_fee_rate
1462
1462
  Object.assign(properties, __classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_buildAttributionProperties).call(this, params.trackingData));
1463
1463
  // Emit an additional partially filled trade event when the fill is partial,
1464
1464
  // mirroring the close path so the fill's partiality is visible in analytics
@@ -1693,7 +1693,7 @@ async function _TradingService_loadPositionData(options) {
1693
1693
  ...(effectiveLeverage !== undefined && {
1694
1694
  [eventNames_js_1.PERPS_EVENT_PROPERTY.LEVERAGE]: effectiveLeverage,
1695
1695
  }),
1696
- // Discovery attribution + hl_fee_rate (TAT-3080, TAT-3149)
1696
+ // Discovery attribution + hl_fee_rate
1697
1697
  ...__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_buildAttributionProperties).call(this, params.trackingData),
1698
1698
  };
1699
1699
  // Calculate and add order value in USD (size * price)
@@ -1723,7 +1723,7 @@ async function _TradingService_loadPositionData(options) {
1723
1723
  };
1724
1724
  }, _TradingService_trackPositionCloseResult = function _TradingService_trackPositionCloseResult(options) {
1725
1725
  const { position, result, error, params, duration, bulkActionId } = options;
1726
- // Bulk action correlation id for batch close events (TAT-3150)
1726
+ // Bulk action correlation id for batch close events
1727
1727
  const bulkActionProps = bulkActionId
1728
1728
  ? { [eventNames_js_1.PERPS_EVENT_PROPERTY.BULK_ACTION_ID]: bulkActionId }
1729
1729
  : {};