@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.
- package/CHANGELOG.md +7 -0
- package/dist/PerpsController-method-action-types.cjs.map +1 -1
- package/dist/PerpsController-method-action-types.d.cts +3 -3
- package/dist/PerpsController-method-action-types.d.mts +3 -3
- package/dist/PerpsController-method-action-types.mjs.map +1 -1
- package/dist/PerpsController.cjs +5 -5
- package/dist/PerpsController.cjs.map +1 -1
- package/dist/PerpsController.d.cts +4 -4
- package/dist/PerpsController.d.mts +4 -4
- package/dist/PerpsController.mjs +5 -5
- package/dist/PerpsController.mjs.map +1 -1
- package/dist/constants/eventNames.cjs +17 -17
- package/dist/constants/eventNames.cjs.map +1 -1
- package/dist/constants/eventNames.mjs +17 -17
- package/dist/constants/eventNames.mjs.map +1 -1
- package/dist/perpsErrorCodes.cjs +4 -0
- package/dist/perpsErrorCodes.cjs.map +1 -1
- package/dist/perpsErrorCodes.d.cts +2 -0
- package/dist/perpsErrorCodes.d.cts.map +1 -1
- package/dist/perpsErrorCodes.d.mts +2 -0
- package/dist/perpsErrorCodes.d.mts.map +1 -1
- package/dist/perpsErrorCodes.mjs +4 -0
- package/dist/perpsErrorCodes.mjs.map +1 -1
- package/dist/providers/HyperLiquidProvider.cjs +76 -25
- package/dist/providers/HyperLiquidProvider.cjs.map +1 -1
- package/dist/providers/HyperLiquidProvider.d.cts.map +1 -1
- package/dist/providers/HyperLiquidProvider.d.mts.map +1 -1
- package/dist/providers/HyperLiquidProvider.mjs +76 -25
- package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.cjs +9 -0
- package/dist/services/HyperLiquidSubscriptionService.cjs.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.d.cts +7 -0
- package/dist/services/HyperLiquidSubscriptionService.d.cts.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.d.mts +7 -0
- package/dist/services/HyperLiquidSubscriptionService.d.mts.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.mjs +9 -0
- package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -1
- package/dist/services/TradingService.cjs +14 -14
- package/dist/services/TradingService.cjs.map +1 -1
- package/dist/services/TradingService.d.cts +2 -2
- package/dist/services/TradingService.d.mts +2 -2
- package/dist/services/TradingService.mjs +14 -14
- package/dist/services/TradingService.mjs.map +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -81,7 +81,7 @@ export declare class TradingService {
|
|
|
81
81
|
* @param options.provider - The perps provider instance.
|
|
82
82
|
* @param options.params - The operation parameters.
|
|
83
83
|
* @param options.context - The service context for dependencies.
|
|
84
|
-
* @param options.bulkActionId - Optional batch correlation id
|
|
84
|
+
* @param options.bulkActionId - Optional batch correlation id.
|
|
85
85
|
* @returns The result of the operation.
|
|
86
86
|
*/
|
|
87
87
|
cancelOrder(options: {
|
|
@@ -116,7 +116,7 @@ export declare class TradingService {
|
|
|
116
116
|
* @param options.params - The operation parameters.
|
|
117
117
|
* @param options.context - The service context for dependencies.
|
|
118
118
|
* @param options.reportOrderToDataLake - The report order to data lake value.
|
|
119
|
-
* @param options.bulkActionId - Optional batch correlation id
|
|
119
|
+
* @param options.bulkActionId - Optional batch correlation id.
|
|
120
120
|
* @returns The result of the operation.
|
|
121
121
|
*/
|
|
122
122
|
closePosition(options: {
|
|
@@ -81,7 +81,7 @@ export declare class TradingService {
|
|
|
81
81
|
* @param options.provider - The perps provider instance.
|
|
82
82
|
* @param options.params - The operation parameters.
|
|
83
83
|
* @param options.context - The service context for dependencies.
|
|
84
|
-
* @param options.bulkActionId - Optional batch correlation id
|
|
84
|
+
* @param options.bulkActionId - Optional batch correlation id.
|
|
85
85
|
* @returns The result of the operation.
|
|
86
86
|
*/
|
|
87
87
|
cancelOrder(options: {
|
|
@@ -116,7 +116,7 @@ export declare class TradingService {
|
|
|
116
116
|
* @param options.params - The operation parameters.
|
|
117
117
|
* @param options.context - The service context for dependencies.
|
|
118
118
|
* @param options.reportOrderToDataLake - The report order to data lake value.
|
|
119
|
-
* @param options.bulkActionId - Optional batch correlation id
|
|
119
|
+
* @param options.bulkActionId - Optional batch correlation id.
|
|
120
120
|
* @returns The result of the operation.
|
|
121
121
|
*/
|
|
122
122
|
closePosition(options: {
|
|
@@ -123,7 +123,7 @@ export class TradingService {
|
|
|
123
123
|
hasTP: Boolean(params.takeProfitPrice),
|
|
124
124
|
hasSL: Boolean(params.stopLossPrice),
|
|
125
125
|
});
|
|
126
|
-
// Emit submitted event before the provider round-trip
|
|
126
|
+
// Emit submitted event before the provider round-trip
|
|
127
127
|
__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_trackSubmitted).call(this, PerpsAnalyticsEvent.TradeTransaction, {
|
|
128
128
|
[PERPS_EVENT_PROPERTY.ASSET]: params.symbol,
|
|
129
129
|
[PERPS_EVENT_PROPERTY.DIRECTION]: params.isBuy
|
|
@@ -391,7 +391,7 @@ export class TradingService {
|
|
|
391
391
|
* @param options.provider - The perps provider instance.
|
|
392
392
|
* @param options.params - The operation parameters.
|
|
393
393
|
* @param options.context - The service context for dependencies.
|
|
394
|
-
* @param options.bulkActionId - Optional batch correlation id
|
|
394
|
+
* @param options.bulkActionId - Optional batch correlation id.
|
|
395
395
|
* @returns The result of the operation.
|
|
396
396
|
*/
|
|
397
397
|
async cancelOrder(options) {
|
|
@@ -399,7 +399,7 @@ export class TradingService {
|
|
|
399
399
|
const traceId = uuidv4();
|
|
400
400
|
const startTime = __classPrivateFieldGet(this, _TradingService_deps, "f").performance.now();
|
|
401
401
|
let traceData;
|
|
402
|
-
// Shared attribution + bulk correlation props
|
|
402
|
+
// Shared attribution + bulk correlation props
|
|
403
403
|
const cancelExtraProps = {
|
|
404
404
|
...__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_buildAttributionProperties).call(this, params.trackingData),
|
|
405
405
|
...(bulkActionId && {
|
|
@@ -421,7 +421,7 @@ export class TradingService {
|
|
|
421
421
|
orderId: params.orderId,
|
|
422
422
|
},
|
|
423
423
|
});
|
|
424
|
-
// Emit submitted event before the provider round-trip
|
|
424
|
+
// Emit submitted event before the provider round-trip
|
|
425
425
|
__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_trackSubmitted).call(this, PerpsAnalyticsEvent.OrderCancelTransaction, {
|
|
426
426
|
[PERPS_EVENT_PROPERTY.ASSET]: params.symbol,
|
|
427
427
|
...cancelExtraProps,
|
|
@@ -502,7 +502,7 @@ export class TradingService {
|
|
|
502
502
|
async cancelOrders(options) {
|
|
503
503
|
const { provider, params, context, withStreamPause } = options;
|
|
504
504
|
const traceId = uuidv4();
|
|
505
|
-
// Correlation id linking every per-item event to the batch summary
|
|
505
|
+
// Correlation id linking every per-item event to the batch summary
|
|
506
506
|
const bulkActionId = uuidv4();
|
|
507
507
|
const startTime = __classPrivateFieldGet(this, _TradingService_deps, "f").performance.now();
|
|
508
508
|
let operationResult = null;
|
|
@@ -646,7 +646,7 @@ export class TradingService {
|
|
|
646
646
|
* @param options.params - The operation parameters.
|
|
647
647
|
* @param options.context - The service context for dependencies.
|
|
648
648
|
* @param options.reportOrderToDataLake - The report order to data lake value.
|
|
649
|
-
* @param options.bulkActionId - Optional batch correlation id
|
|
649
|
+
* @param options.bulkActionId - Optional batch correlation id.
|
|
650
650
|
* @returns The result of the operation.
|
|
651
651
|
*/
|
|
652
652
|
async closePosition(options) {
|
|
@@ -673,7 +673,7 @@ export class TradingService {
|
|
|
673
673
|
symbol: params.symbol,
|
|
674
674
|
context,
|
|
675
675
|
});
|
|
676
|
-
// Emit submitted event before the provider round-trip
|
|
676
|
+
// Emit submitted event before the provider round-trip
|
|
677
677
|
__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_trackSubmitted).call(this, PerpsAnalyticsEvent.PositionCloseTransaction, {
|
|
678
678
|
[PERPS_EVENT_PROPERTY.ASSET]: params.symbol,
|
|
679
679
|
[PERPS_EVENT_PROPERTY.ORDER_TYPE]: params.orderType ?? PERPS_EVENT_VALUE.ORDER_TYPE.MARKET,
|
|
@@ -777,7 +777,7 @@ export class TradingService {
|
|
|
777
777
|
async closePositions(options) {
|
|
778
778
|
const { provider, params, context } = options;
|
|
779
779
|
const traceId = uuidv4();
|
|
780
|
-
// Correlation id linking every per-item event to the batch summary
|
|
780
|
+
// Correlation id linking every per-item event to the batch summary
|
|
781
781
|
const bulkActionId = uuidv4();
|
|
782
782
|
const startTime = __classPrivateFieldGet(this, _TradingService_deps, "f").performance.now();
|
|
783
783
|
let operationResult = null;
|
|
@@ -960,7 +960,7 @@ export class TradingService {
|
|
|
960
960
|
stopLossPrice: params.stopLossPrice ?? '',
|
|
961
961
|
},
|
|
962
962
|
});
|
|
963
|
-
// Emit submitted event before the provider round-trip
|
|
963
|
+
// Emit submitted event before the provider round-trip
|
|
964
964
|
__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_trackSubmitted).call(this, PerpsAnalyticsEvent.RiskManagement, {
|
|
965
965
|
[PERPS_EVENT_PROPERTY.ASSET]: params.symbol,
|
|
966
966
|
[PERPS_EVENT_PROPERTY.SOURCE]: source,
|
|
@@ -1056,7 +1056,7 @@ export class TradingService {
|
|
|
1056
1056
|
...(errorMessage && {
|
|
1057
1057
|
[PERPS_EVENT_PROPERTY.ERROR_MESSAGE]: errorMessage,
|
|
1058
1058
|
}),
|
|
1059
|
-
// Discovery attribution
|
|
1059
|
+
// Discovery attribution
|
|
1060
1060
|
...__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_buildAttributionProperties).call(this, params.trackingData),
|
|
1061
1061
|
};
|
|
1062
1062
|
// Track event once with all properties
|
|
@@ -1242,7 +1242,7 @@ export class TradingService {
|
|
|
1242
1242
|
[PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,
|
|
1243
1243
|
[PERPS_EVENT_PROPERTY.ACTION]: flipAction,
|
|
1244
1244
|
[PERPS_EVENT_PROPERTY.ORDER_VALUE]: positionSize * executedPrice,
|
|
1245
|
-
// MetaMask fee on flip trades
|
|
1245
|
+
// MetaMask fee on flip trades
|
|
1246
1246
|
...(trackingData?.metamaskFee !== undefined && {
|
|
1247
1247
|
[PERPS_EVENT_PROPERTY.METAMASK_FEE]: trackingData.metamaskFee,
|
|
1248
1248
|
}),
|
|
@@ -1454,7 +1454,7 @@ _TradingService_deps = new WeakMap(), _TradingService_controllerDeps = new WeakM
|
|
|
1454
1454
|
Object.keys(params.trackingData.abTests).length > 0) {
|
|
1455
1455
|
properties[PERPS_EVENT_PROPERTY.AB_TESTS] = params.trackingData.abTests;
|
|
1456
1456
|
}
|
|
1457
|
-
// Propagate discovery attribution + hl_fee_rate
|
|
1457
|
+
// Propagate discovery attribution + hl_fee_rate
|
|
1458
1458
|
Object.assign(properties, __classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_buildAttributionProperties).call(this, params.trackingData));
|
|
1459
1459
|
// Emit an additional partially filled trade event when the fill is partial,
|
|
1460
1460
|
// mirroring the close path so the fill's partiality is visible in analytics
|
|
@@ -1689,7 +1689,7 @@ async function _TradingService_loadPositionData(options) {
|
|
|
1689
1689
|
...(effectiveLeverage !== undefined && {
|
|
1690
1690
|
[PERPS_EVENT_PROPERTY.LEVERAGE]: effectiveLeverage,
|
|
1691
1691
|
}),
|
|
1692
|
-
// Discovery attribution + hl_fee_rate
|
|
1692
|
+
// Discovery attribution + hl_fee_rate
|
|
1693
1693
|
...__classPrivateFieldGet(this, _TradingService_instances, "m", _TradingService_buildAttributionProperties).call(this, params.trackingData),
|
|
1694
1694
|
};
|
|
1695
1695
|
// Calculate and add order value in USD (size * price)
|
|
@@ -1719,7 +1719,7 @@ async function _TradingService_loadPositionData(options) {
|
|
|
1719
1719
|
};
|
|
1720
1720
|
}, _TradingService_trackPositionCloseResult = function _TradingService_trackPositionCloseResult(options) {
|
|
1721
1721
|
const { position, result, error, params, duration, bulkActionId } = options;
|
|
1722
|
-
// Bulk action correlation id for batch close events
|
|
1722
|
+
// Bulk action correlation id for batch close events
|
|
1723
1723
|
const bulkActionProps = bulkActionId
|
|
1724
1724
|
? { [PERPS_EVENT_PROPERTY.BULK_ACTION_ID]: bulkActionId }
|
|
1725
1725
|
: {};
|