@metamask-previews/perps-controller 22.3.0-preview-13e241f7f → 22.3.0-preview-693aef2bf

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 (56) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/PerpsController-method-action-types.d.ts +14 -1
  3. package/dist/PerpsController-method-action-types.d.ts.map +1 -1
  4. package/dist/PerpsController-method-action-types.js.map +1 -1
  5. package/dist/PerpsController.d.ts +11 -1
  6. package/dist/PerpsController.d.ts.map +1 -1
  7. package/dist/PerpsController.js +24 -0
  8. package/dist/PerpsController.js.map +1 -1
  9. package/dist/constants/perpsConfig.d.ts +16 -0
  10. package/dist/constants/perpsConfig.d.ts.map +1 -1
  11. package/dist/constants/perpsConfig.js +24 -0
  12. package/dist/constants/perpsConfig.js.map +1 -1
  13. package/dist/errors.d.ts +7 -0
  14. package/dist/errors.d.ts.map +1 -1
  15. package/dist/errors.js +9 -0
  16. package/dist/errors.js.map +1 -1
  17. package/dist/index.d.ts +4 -4
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/perpsErrorCodes.d.ts +1 -0
  22. package/dist/perpsErrorCodes.d.ts.map +1 -1
  23. package/dist/perpsErrorCodes.js +1 -0
  24. package/dist/perpsErrorCodes.js.map +1 -1
  25. package/dist/providers/AggregatedPerpsProvider.d.ts +2 -1
  26. package/dist/providers/AggregatedPerpsProvider.d.ts.map +1 -1
  27. package/dist/providers/AggregatedPerpsProvider.js +9 -0
  28. package/dist/providers/AggregatedPerpsProvider.js.map +1 -1
  29. package/dist/providers/HyperLiquidProvider.d.ts +19 -1
  30. package/dist/providers/HyperLiquidProvider.d.ts.map +1 -1
  31. package/dist/providers/HyperLiquidProvider.js +120 -26
  32. package/dist/providers/HyperLiquidProvider.js.map +1 -1
  33. package/dist/providers/LighterProvider.d.ts +10 -1
  34. package/dist/providers/LighterProvider.d.ts.map +1 -1
  35. package/dist/providers/LighterProvider.js +12 -0
  36. package/dist/providers/LighterProvider.js.map +1 -1
  37. package/dist/services/TradingService.d.ts +17 -1
  38. package/dist/services/TradingService.d.ts.map +1 -1
  39. package/dist/services/TradingService.js +60 -4
  40. package/dist/services/TradingService.js.map +1 -1
  41. package/dist/types/index.d.ts +39 -0
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/dist/types/index.js.map +1 -1
  44. package/dist/utils/orderCalculations.d.ts +2 -0
  45. package/dist/utils/orderCalculations.d.ts.map +1 -1
  46. package/dist/utils/orderCalculations.js +3 -1
  47. package/dist/utils/orderCalculations.js.map +1 -1
  48. package/dist/utils/perpsFormatters.d.ts +125 -53
  49. package/dist/utils/perpsFormatters.d.ts.map +1 -1
  50. package/dist/utils/perpsFormatters.js +345 -202
  51. package/dist/utils/perpsFormatters.js.map +1 -1
  52. package/dist/utils/positionProtection.d.ts +10 -1
  53. package/dist/utils/positionProtection.d.ts.map +1 -1
  54. package/dist/utils/positionProtection.js +13 -0
  55. package/dist/utils/positionProtection.js.map +1 -1
  56. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { PerpsProvider, OrderParams, OrderResult, EditOrderParams, CancelOrderParams, CancelOrderResult, CancelOrdersParams, CancelOrdersResult, ClosePositionParams, ClosePositionsParams, ClosePositionsResult, Position, TrackingData, UpdatePositionTPSLParams, PerpsPlatformDependencies } from '../types/index.js';
1
+ import type { PerpsProvider, OrderParams, OrderResult, EditOrderParams, CancelOrderParams, CancelOrderResult, CancelOrdersParams, CancelOrdersResult, ClosePositionParams, ClosePositionsParams, ClosePositionsResult, Position, TrackingData, UpdatePositionTPSLParams, ReplacePositionTPSLLegParams, PerpsPlatformDependencies } from '../types/index.js';
2
2
  import type { RewardsIntegrationService } from './RewardsIntegrationService.js';
3
3
  import type { ServiceContext } from './ServiceContext.js';
4
4
  /**
@@ -162,6 +162,22 @@ export declare class TradingService {
162
162
  params: UpdatePositionTPSLParams;
163
163
  context: ServiceContext;
164
164
  }): Promise<OrderResult>;
165
+ /**
166
+ * Replace one TP/SL leg of an existing position, leaving the other leg as
167
+ * it is. Tracing, fee discounts, state and analytics match
168
+ * {@link updatePositionTPSL}, reported for the replaced leg only.
169
+ *
170
+ * @param options - The configuration options.
171
+ * @param options.provider - The perps provider instance.
172
+ * @param options.params - The leg replacement parameters.
173
+ * @param options.context - The service context for dependencies.
174
+ * @returns The result of the operation.
175
+ */
176
+ replacePositionTPSLLeg(options: {
177
+ provider: PerpsProvider;
178
+ params: ReplacePositionTPSLLegParams;
179
+ context: ServiceContext;
180
+ }): Promise<OrderResult>;
165
181
  /**
166
182
  * Update margin for an existing position (add or remove)
167
183
  *
@@ -1 +1 @@
1
- {"version":3,"file":"TradingService.d.ts","sourceRoot":"","sources":["../../src/services/TradingService.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,aAAa,EAEb,WAAW,EACX,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,wBAAwB,EAExB,yBAAyB,EAG1B,MAAM,mBAAmB,CAAC;AAkB3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,yBAAyB,EAAE,yBAAyB,CAAC;CACtD,CAAC;AAsDF;;;;;;;;;GASG;AACH,qBAAa,cAAc;;IAezB;;;;OAIG;IACH,YAAY,IAAI,EAAE,yBAAyB,EAE1C;IAED;;;;;OAKG;IACH,yBAAyB,CACvB,cAAc,EAAE,4BAA4B,GAC3C,IAAI,CAEN;IA6eD;;;;;;;;;;OAUG;IACG,UAAU,CAAC,OAAO,EAAE;QACxB,QAAQ,EAAE,aAAa,CAAC;QACxB,M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AC,CA0OvB;CACF"}
1
+ {"version":3,"file":"TradingService.d.ts","sourceRoot":"","sources":["../../src/services/TradingService.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,aAAa,EAEb,WAAW,EACX,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,wBAAwB,EACxB,4BAA4B,EAE5B,yBAAyB,EAG1B,MAAM,mBAAmB,CAAC;AAmB3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,yBAAyB,EAAE,yBAAyB,CAAC;CACtD,CAAC;AAsDF;;;;;;;;;GASG;AACH,qBAAa,cAAc;;IAezB;;;;OAIG;IACH,YAAY,IAAI,EAAE,yBAAyB,EAE1C;IAED;;;;;OAKG;IACH,yBAAyB,CACvB,cAAc,EAAE,4BAA4B,GAC3C,IAAI,CAEN;IA6eD;;;;;;;;;;OAUG;IACG,UAAU,CAAC,OAAO,EAAE;QACxB,QAAQ,EAAE,aAAa,CAAC;QACxB,MAAM,EAAE,WAAW,CAAC;QACpB,OAAO,EAAE,cAAc,CAAC;QACxB,qBAAqB,EAAE,CAAC,MAAM,EAAE;YAC9B,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;YACzB,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,KAAK,OAAO,CAAC;YAAE,OAAO,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACrD,GAAG,OAAO,CAAC,WAAW,CAAC,CAqPvB;IA2tBD;;;;;;;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AE;QAC5B,QAAQ,EAAE,aAAa,CAAC;QACxB,MAAM,EAAE,oBAAoB,CAAC;QAC7B,OAAO,EAAE,cAAc,CAAC;KACzB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA2NhC;IAED;;;;;;;;;OASG;IACG,kBAAkB,CAAC,OAAO,EAAE;QAChC,QAAQ,EAAE,aAAa,CAAC;QACxB,MAAM,EAAE,wBAAwB,CAAC;QACjC,OAAO,EAAE,cAAc,CAAC;KACzB,GAAG,OAAO,CAAC,WAAW,CAAC,CAOvB;IAED;;;;;;;;;;OAUG;IACG,sBAAsB,CAAC,OAAO,EAAE;QACpC,QAAQ,EAAE,aAAa,CAAC;QACxB,MAAM,EAAE,4BAA4B,CAAC;QACrC,OAAO,EAAE,cAAc,CAAC;KACzB,GAAG,OAAO,CAAC,WAAW,CAAC,CAsBvB;IAmPD;;;;;;;;;OASG;IACG,YAAY,CAAC,OAAO,EAAE;QAC1B,QAAQ,EAAE,aAAa,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,cAAc,CAAC;KACzB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CA6GhD;IAED;;;;;;;;;OASG;IACG,YAAY,CAAC,OAAO,EAAE;QAC1B,QAAQ,EAAE,aAAa,CAAC;QACxB,QAAQ,EAAE,QAAQ,CAAC;QACnB,YAAY,CAAC,EAAE,YAAY,CAAC;QAC5B,OAAO,EAAE,cAAc,CAAC;KACzB,GAAG,OAAO,CAAC,WAAW,CAAC,CA0OvB;CACF"}
@@ -4,13 +4,14 @@ import { PERPS_EVENT_PROPERTY, PERPS_EVENT_VALUE, } from '../constants/eventName
4
4
  import { isTPSLOrder } from '../constants/orderTypes.js';
5
5
  import { PerpsMeasurementName } from '../constants/performanceMetrics.js';
6
6
  import { PERPS_CONSTANTS } from '../constants/perpsConfig.js';
7
- import { PerpsControllerError } from '../errors.js';
7
+ import { createTpslLegReplaceUnsupportedError, PerpsControllerError, } from '../errors.js';
8
8
  import { PERPS_ERROR_CODES } from '../perpsErrorCodes.js';
9
9
  import { PerpsAnalyticsEvent, PerpsTraceNames, PerpsTraceOperations, } from '../types/index.js';
10
10
  import { PERPS_ERROR_ACTION, PERPS_ERROR_OPERATION, createPerpsErrorContext, wasProviderErrorReported, } from '../utils/errorContext.js';
11
11
  import { ensureError } from '../utils/errorUtils.js';
12
12
  import { captureScaleOrderParams } from '../utils/lighterScaleOrders.js';
13
13
  import { isLimitExecutionOrderType, SCALE_ORDER_COUNT, } from '../utils/orderTypes.js';
14
+ import { toPositionTpslLegPrices } from '../utils/positionProtection.js';
14
15
  import { environmentTypeProperty } from './environmentTypeProperty.js';
15
16
  /**
16
17
  * Whether a write failed because the signer could not sign it (a locked
@@ -1915,7 +1916,61 @@ export class TradingService {
1915
1916
  * @returns The result of the operation.
1916
1917
  */
1917
1918
  async updatePositionTPSL(options) {
1919
+ const { provider, params } = options;
1920
+ return this.#writePositionTpsl({
1921
+ ...options,
1922
+ operationName: 'updatePositionTPSL',
1923
+ operation: () => provider.updatePositionTPSL(params),
1924
+ });
1925
+ }
1926
+ /**
1927
+ * Replace one TP/SL leg of an existing position, leaving the other leg as
1928
+ * it is. Tracing, fee discounts, state and analytics match
1929
+ * {@link updatePositionTPSL}, reported for the replaced leg only.
1930
+ *
1931
+ * @param options - The configuration options.
1932
+ * @param options.provider - The perps provider instance.
1933
+ * @param options.params - The leg replacement parameters.
1934
+ * @param options.context - The service context for dependencies.
1935
+ * @returns The result of the operation.
1936
+ */
1937
+ async replacePositionTPSLLeg(options) {
1918
1938
  const { provider, params, context } = options;
1939
+ const { symbol, leg, triggerPrice, limitPrice, trackingData, providerId } = params;
1940
+ return this.#writePositionTpsl({
1941
+ provider,
1942
+ context,
1943
+ params: {
1944
+ symbol,
1945
+ ...toPositionTpslLegPrices({ leg, triggerPrice }),
1946
+ ...(trackingData && { trackingData }),
1947
+ ...(providerId && { providerId }),
1948
+ },
1949
+ limitPrice,
1950
+ operationName: 'replacePositionTPSLLeg',
1951
+ operation: async () => {
1952
+ if (!provider.replacePositionTPSLLeg) {
1953
+ throw createTpslLegReplaceUnsupportedError();
1954
+ }
1955
+ return provider.replacePositionTPSLLeg(params);
1956
+ },
1957
+ });
1958
+ }
1959
+ /**
1960
+ * Shared orchestration for position TP/SL writes.
1961
+ *
1962
+ * @param options - The configuration options.
1963
+ * @param options.provider - The perps provider instance.
1964
+ * @param options.params - The TP/SL being written, used for fees, tracing and analytics.
1965
+ * @param options.context - The service context for dependencies.
1966
+ * @param options.limitPrice - Fill price of a single replaced leg. The fee
1967
+ * notional uses it instead of the trigger, as the venue fills at it.
1968
+ * @param options.operationName - Method name reported in error context.
1969
+ * @param options.operation - The provider write to run.
1970
+ * @returns The result of the operation.
1971
+ */
1972
+ async #writePositionTpsl(options) {
1973
+ const { provider, params, context, limitPrice, operationName, operation } = options;
1919
1974
  const traceId = uuidv4();
1920
1975
  const startTime = this.#deps.performance.now();
1921
1976
  let traceData;
@@ -1972,7 +2027,8 @@ export class TradingService {
1972
2027
  size: triggerSize === undefined
1973
2028
  ? undefined
1974
2029
  : Math.abs(Number.parseFloat(triggerSize)).toString(),
1975
- price,
2030
+ price: limitPrice,
2031
+ triggerPrice: price,
1976
2032
  });
1977
2033
  }));
1978
2034
  // A known sibling cannot stand in for a trigger whose size is unknown.
@@ -1986,7 +2042,7 @@ export class TradingService {
1986
2042
  result = await this.#withFeeDiscount({
1987
2043
  provider,
1988
2044
  resolveFee: () => this.#calculateFeeDiscountWithMeasurement(tpslNotionalUsd, provider, context, params.providerId),
1989
- operation: () => provider.updatePositionTPSL(params),
2045
+ operation,
1990
2046
  });
1991
2047
  if (result.success) {
1992
2048
  // Update state on success
@@ -2006,7 +2062,7 @@ export class TradingService {
2006
2062
  catch (error) {
2007
2063
  errorMessage = error instanceof Error ? error.message : 'Unknown error';
2008
2064
  traceData = { success: false, error: errorMessage };
2009
- this.#deps.logger.error(ensureError(error, 'TradingService.updatePositionTPSL'), this.#getErrorContext(context, 'updatePositionTPSL', {
2065
+ this.#deps.logger.error(ensureError(error, `TradingService.${operationName}`), this.#getErrorContext(context, operationName, {
2010
2066
  operation: PERPS_ERROR_OPERATION.PositionManagement,
2011
2067
  action: PERPS_ERROR_ACTION.PositionTpslUpdate,
2012
2068
  }, {