@metamask-previews/perps-controller 6.0.1-preview-e5cef32c6 → 6.1.0-preview-6d2aeda

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 (58) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/providers/HyperLiquidProvider.cjs +24 -18
  3. package/dist/providers/HyperLiquidProvider.cjs.map +1 -1
  4. package/dist/providers/HyperLiquidProvider.d.cts.map +1 -1
  5. package/dist/providers/HyperLiquidProvider.d.mts.map +1 -1
  6. package/dist/providers/HyperLiquidProvider.mjs +25 -19
  7. package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
  8. package/dist/services/HyperLiquidWalletService.cjs +4 -1
  9. package/dist/services/HyperLiquidWalletService.cjs.map +1 -1
  10. package/dist/services/HyperLiquidWalletService.d.cts +1 -1
  11. package/dist/services/HyperLiquidWalletService.d.cts.map +1 -1
  12. package/dist/services/HyperLiquidWalletService.d.mts +1 -1
  13. package/dist/services/HyperLiquidWalletService.d.mts.map +1 -1
  14. package/dist/services/HyperLiquidWalletService.mjs +4 -1
  15. package/dist/services/HyperLiquidWalletService.mjs.map +1 -1
  16. package/dist/services/RewardsIntegrationService.cjs +11 -2
  17. package/dist/services/RewardsIntegrationService.cjs.map +1 -1
  18. package/dist/services/RewardsIntegrationService.d.cts.map +1 -1
  19. package/dist/services/RewardsIntegrationService.d.mts.map +1 -1
  20. package/dist/services/RewardsIntegrationService.mjs +11 -2
  21. package/dist/services/RewardsIntegrationService.mjs.map +1 -1
  22. package/dist/services/TradingReadinessCache.cjs +2 -1
  23. package/dist/services/TradingReadinessCache.cjs.map +1 -1
  24. package/dist/services/TradingReadinessCache.d.cts +2 -1
  25. package/dist/services/TradingReadinessCache.d.cts.map +1 -1
  26. package/dist/services/TradingReadinessCache.d.mts +2 -1
  27. package/dist/services/TradingReadinessCache.d.mts.map +1 -1
  28. package/dist/services/TradingReadinessCache.mjs +2 -1
  29. package/dist/services/TradingReadinessCache.mjs.map +1 -1
  30. package/dist/services/TradingService.cjs +41 -0
  31. package/dist/services/TradingService.cjs.map +1 -1
  32. package/dist/services/TradingService.d.cts.map +1 -1
  33. package/dist/services/TradingService.d.mts.map +1 -1
  34. package/dist/services/TradingService.mjs +41 -0
  35. package/dist/services/TradingService.mjs.map +1 -1
  36. package/dist/types/index.cjs.map +1 -1
  37. package/dist/types/index.d.cts +7 -2
  38. package/dist/types/index.d.cts.map +1 -1
  39. package/dist/types/index.d.mts +7 -2
  40. package/dist/types/index.d.mts.map +1 -1
  41. package/dist/types/index.mjs.map +1 -1
  42. package/dist/utils/errorUtils.cjs +24 -3
  43. package/dist/utils/errorUtils.cjs.map +1 -1
  44. package/dist/utils/errorUtils.d.cts +8 -0
  45. package/dist/utils/errorUtils.d.cts.map +1 -1
  46. package/dist/utils/errorUtils.d.mts +8 -0
  47. package/dist/utils/errorUtils.d.mts.map +1 -1
  48. package/dist/utils/errorUtils.mjs +22 -2
  49. package/dist/utils/errorUtils.mjs.map +1 -1
  50. package/dist/utils/hyperLiquidAbstraction.cjs +23 -0
  51. package/dist/utils/hyperLiquidAbstraction.cjs.map +1 -0
  52. package/dist/utils/hyperLiquidAbstraction.d.cts +11 -0
  53. package/dist/utils/hyperLiquidAbstraction.d.cts.map +1 -0
  54. package/dist/utils/hyperLiquidAbstraction.d.mts +11 -0
  55. package/dist/utils/hyperLiquidAbstraction.d.mts.map +1 -0
  56. package/dist/utils/hyperLiquidAbstraction.mjs +19 -0
  57. package/dist/utils/hyperLiquidAbstraction.mjs.map +1 -0
  58. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"errorUtils.d.mts","sourceRoot":"","sources":["../../src/utils/errorUtils.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CASpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAkBnE"}
1
+ {"version":3,"file":"errorUtils.d.mts","sourceRoot":"","sources":["../../src/utils/errorUtils.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CASpD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAe5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAkBnE"}
@@ -1,8 +1,9 @@
1
1
  /**
2
- * Utility functions for error handling across the application.
3
- * These are general-purpose utilities, not domain-specific.
2
+ * Utility functions for error handling across Perps controller code.
3
+ * Includes generic error helpers and Perps error classification helpers.
4
4
  */
5
5
  import { hasProperty } from "@metamask/utils";
6
+ import { PERPS_ERROR_CODES } from "../perpsErrorCodes.mjs";
6
7
  /**
7
8
  * Detects expected cancellation/abort errors that should not be reported to Sentry.
8
9
  * These occur during normal navigation or view teardown when in-flight fetch requests
@@ -19,6 +20,25 @@ export function isAbortError(error) {
19
20
  }
20
21
  return false;
21
22
  }
23
+ /**
24
+ * Detects keyring-locked errors, including SDK-wrapped errors that preserve the
25
+ * original error in `cause`.
26
+ *
27
+ * @param error - The error to check.
28
+ * @returns True if any error in the cause chain is KEYRING_LOCKED.
29
+ */
30
+ export function isKeyringLockedError(error) {
31
+ let current = error;
32
+ const seen = new Set();
33
+ while (current instanceof Error && !seen.has(current)) {
34
+ seen.add(current);
35
+ if (current.message === PERPS_ERROR_CODES.KEYRING_LOCKED) {
36
+ return true;
37
+ }
38
+ current = current.cause;
39
+ }
40
+ return false;
41
+ }
22
42
  /**
23
43
  * Ensures we have a proper Error object for logging.
24
44
  * Converts unknown/string errors to proper Error instances.
@@ -1 +1 @@
1
- {"version":3,"file":"errorUtils.mjs","sourceRoot":"","sources":["../../src/utils/errorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,wBAAwB;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,YAAY;YAC3B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC;YAC3C,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc,EAAE,OAAgB;IAC1D,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,8DAA8D;IAC9D,oFAAoF;IACpF,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,MAAM,WAAW,GAAG,qCAAqC,CAAC;QAC1D,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,KAAK,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1E,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,IAAI,KAAK,CACd,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;QAC1E,CAAC,CAAC,MAAM,CAAE,KAA8B,CAAC,OAAO,CAAC;QACjD,CAAC,CAAC,eAAe,CACpB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Utility functions for error handling across the application.\n * These are general-purpose utilities, not domain-specific.\n */\nimport { hasProperty } from '@metamask/utils';\n\n/**\n * Detects expected cancellation/abort errors that should not be reported to Sentry.\n * These occur during normal navigation or view teardown when in-flight fetch requests\n * are cancelled via AbortController.\n *\n * @param error - The error to check.\n * @returns True if the error is an expected abort/cancellation.\n */\nexport function isAbortError(error: unknown): boolean {\n if (error instanceof Error) {\n return (\n error.name === 'AbortError' ||\n error.message.includes('signal is aborted') ||\n error.message.includes('The operation was aborted')\n );\n }\n return false;\n}\n\n/**\n * Ensures we have a proper Error object for logging.\n * Converts unknown/string errors to proper Error instances.\n * Handles undefined/null specially for better Sentry context.\n *\n * @param error - The caught error (could be Error, string, or unknown)\n * @param context - Optional context string to help identify the source of the error\n * @returns A proper Error instance\n */\nexport function ensureError(error: unknown, context?: string): Error {\n if (error instanceof Error) {\n return error;\n }\n // Handle undefined/null specifically for better error context\n // e.g. Hyperliquid SDK may reject with undefined when AbortSignal.reason is not set\n if (error === undefined || error === null) {\n const baseMessage = 'Unknown error (no details provided)';\n return new Error(context ? `${baseMessage} [${context}]` : baseMessage);\n }\n if (typeof error === 'string') {\n return new Error(error);\n }\n return new Error(\n typeof error === 'object' && error !== null && hasProperty(error, 'message')\n ? String((error as { message: unknown }).message)\n : 'Unknown error',\n );\n}\n"]}
1
+ {"version":3,"file":"errorUtils.mjs","sourceRoot":"","sources":["../../src/utils/errorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,wBAAwB;AAE9C,OAAO,EAAE,iBAAiB,EAAE,+BAA2B;AAEvD;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,YAAY;YAC3B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC;YAC3C,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,IAAI,OAAO,GAAY,KAAK,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAW,CAAC;IAEhC,OAAO,OAAO,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACtD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAElB,IAAI,OAAO,CAAC,OAAO,KAAK,iBAAiB,CAAC,cAAc,EAAE,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,GAAI,OAA+B,CAAC,KAAK,CAAC;IACnD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc,EAAE,OAAgB;IAC1D,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,8DAA8D;IAC9D,oFAAoF;IACpF,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,MAAM,WAAW,GAAG,qCAAqC,CAAC;QAC1D,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,KAAK,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1E,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,IAAI,KAAK,CACd,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;QAC1E,CAAC,CAAC,MAAM,CAAE,KAA8B,CAAC,OAAO,CAAC;QACjD,CAAC,CAAC,eAAe,CACpB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Utility functions for error handling across Perps controller code.\n * Includes generic error helpers and Perps error classification helpers.\n */\nimport { hasProperty } from '@metamask/utils';\n\nimport { PERPS_ERROR_CODES } from '../perpsErrorCodes';\n\n/**\n * Detects expected cancellation/abort errors that should not be reported to Sentry.\n * These occur during normal navigation or view teardown when in-flight fetch requests\n * are cancelled via AbortController.\n *\n * @param error - The error to check.\n * @returns True if the error is an expected abort/cancellation.\n */\nexport function isAbortError(error: unknown): boolean {\n if (error instanceof Error) {\n return (\n error.name === 'AbortError' ||\n error.message.includes('signal is aborted') ||\n error.message.includes('The operation was aborted')\n );\n }\n return false;\n}\n\n/**\n * Detects keyring-locked errors, including SDK-wrapped errors that preserve the\n * original error in `cause`.\n *\n * @param error - The error to check.\n * @returns True if any error in the cause chain is KEYRING_LOCKED.\n */\nexport function isKeyringLockedError(error: unknown): boolean {\n let current: unknown = error;\n const seen = new Set<unknown>();\n\n while (current instanceof Error && !seen.has(current)) {\n seen.add(current);\n\n if (current.message === PERPS_ERROR_CODES.KEYRING_LOCKED) {\n return true;\n }\n\n current = (current as { cause?: unknown }).cause;\n }\n\n return false;\n}\n\n/**\n * Ensures we have a proper Error object for logging.\n * Converts unknown/string errors to proper Error instances.\n * Handles undefined/null specially for better Sentry context.\n *\n * @param error - The caught error (could be Error, string, or unknown)\n * @param context - Optional context string to help identify the source of the error\n * @returns A proper Error instance\n */\nexport function ensureError(error: unknown, context?: string): Error {\n if (error instanceof Error) {\n return error;\n }\n // Handle undefined/null specifically for better error context\n // e.g. Hyperliquid SDK may reject with undefined when AbortSignal.reason is not set\n if (error === undefined || error === null) {\n const baseMessage = 'Unknown error (no details provided)';\n return new Error(context ? `${baseMessage} [${context}]` : baseMessage);\n }\n if (typeof error === 'string') {\n return new Error(error);\n }\n return new Error(\n typeof error === 'object' && error !== null && hasProperty(error, 'message')\n ? String((error as { message: unknown }).message)\n : 'Unknown error',\n );\n}\n"]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldDeferUnifiedAccountSetup = void 0;
4
+ const MIGRATABLE_ABSTRACTION_MODES = new Set([
5
+ 'dexAbstraction',
6
+ 'default',
7
+ 'disabled',
8
+ ]);
9
+ /**
10
+ * Determine whether unified-account setup should be deferred until a user
11
+ * explicitly starts a trading or withdrawal action.
12
+ *
13
+ * @param currentMode - The user's current HyperLiquid abstraction mode.
14
+ * @param allowUserSigning - Whether the caller is allowed to trigger wallet signing.
15
+ * @returns True when migration would require a signing-backed mutation that should be deferred.
16
+ */
17
+ function shouldDeferUnifiedAccountSetup(currentMode, allowUserSigning) {
18
+ return (!allowUserSigning &&
19
+ currentMode !== undefined &&
20
+ MIGRATABLE_ABSTRACTION_MODES.has(currentMode));
21
+ }
22
+ exports.shouldDeferUnifiedAccountSetup = shouldDeferUnifiedAccountSetup;
23
+ //# sourceMappingURL=hyperLiquidAbstraction.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hyperLiquidAbstraction.cjs","sourceRoot":"","sources":["../../src/utils/hyperLiquidAbstraction.ts"],"names":[],"mappings":";;;AAEA,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAA6B;IACvE,gBAAgB;IAChB,SAAS;IACT,UAAU;CACX,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,SAAgB,8BAA8B,CAC5C,WAAmD,EACnD,gBAAyB;IAEzB,OAAO,CACL,CAAC,gBAAgB;QACjB,WAAW,KAAK,SAAS;QACzB,4BAA4B,CAAC,GAAG,CAAC,WAAW,CAAC,CAC9C,CAAC;AACJ,CAAC;AATD,wEASC","sourcesContent":["import type { HyperLiquidAbstractionMode } from '../types/hyperliquid-types';\n\nconst MIGRATABLE_ABSTRACTION_MODES = new Set<HyperLiquidAbstractionMode>([\n 'dexAbstraction',\n 'default',\n 'disabled',\n]);\n\n/**\n * Determine whether unified-account setup should be deferred until a user\n * explicitly starts a trading or withdrawal action.\n *\n * @param currentMode - The user's current HyperLiquid abstraction mode.\n * @param allowUserSigning - Whether the caller is allowed to trigger wallet signing.\n * @returns True when migration would require a signing-backed mutation that should be deferred.\n */\nexport function shouldDeferUnifiedAccountSetup(\n currentMode: HyperLiquidAbstractionMode | undefined,\n allowUserSigning: boolean,\n): boolean {\n return (\n !allowUserSigning &&\n currentMode !== undefined &&\n MIGRATABLE_ABSTRACTION_MODES.has(currentMode)\n );\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { HyperLiquidAbstractionMode } from "../types/hyperliquid-types.cjs";
2
+ /**
3
+ * Determine whether unified-account setup should be deferred until a user
4
+ * explicitly starts a trading or withdrawal action.
5
+ *
6
+ * @param currentMode - The user's current HyperLiquid abstraction mode.
7
+ * @param allowUserSigning - Whether the caller is allowed to trigger wallet signing.
8
+ * @returns True when migration would require a signing-backed mutation that should be deferred.
9
+ */
10
+ export declare function shouldDeferUnifiedAccountSetup(currentMode: HyperLiquidAbstractionMode | undefined, allowUserSigning: boolean): boolean;
11
+ //# sourceMappingURL=hyperLiquidAbstraction.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hyperLiquidAbstraction.d.cts","sourceRoot":"","sources":["../../src/utils/hyperLiquidAbstraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,uCAAmC;AAQ7E;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,0BAA0B,GAAG,SAAS,EACnD,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAMT"}
@@ -0,0 +1,11 @@
1
+ import type { HyperLiquidAbstractionMode } from "../types/hyperliquid-types.mjs";
2
+ /**
3
+ * Determine whether unified-account setup should be deferred until a user
4
+ * explicitly starts a trading or withdrawal action.
5
+ *
6
+ * @param currentMode - The user's current HyperLiquid abstraction mode.
7
+ * @param allowUserSigning - Whether the caller is allowed to trigger wallet signing.
8
+ * @returns True when migration would require a signing-backed mutation that should be deferred.
9
+ */
10
+ export declare function shouldDeferUnifiedAccountSetup(currentMode: HyperLiquidAbstractionMode | undefined, allowUserSigning: boolean): boolean;
11
+ //# sourceMappingURL=hyperLiquidAbstraction.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hyperLiquidAbstraction.d.mts","sourceRoot":"","sources":["../../src/utils/hyperLiquidAbstraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,uCAAmC;AAQ7E;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,0BAA0B,GAAG,SAAS,EACnD,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAMT"}
@@ -0,0 +1,19 @@
1
+ const MIGRATABLE_ABSTRACTION_MODES = new Set([
2
+ 'dexAbstraction',
3
+ 'default',
4
+ 'disabled',
5
+ ]);
6
+ /**
7
+ * Determine whether unified-account setup should be deferred until a user
8
+ * explicitly starts a trading or withdrawal action.
9
+ *
10
+ * @param currentMode - The user's current HyperLiquid abstraction mode.
11
+ * @param allowUserSigning - Whether the caller is allowed to trigger wallet signing.
12
+ * @returns True when migration would require a signing-backed mutation that should be deferred.
13
+ */
14
+ export function shouldDeferUnifiedAccountSetup(currentMode, allowUserSigning) {
15
+ return (!allowUserSigning &&
16
+ currentMode !== undefined &&
17
+ MIGRATABLE_ABSTRACTION_MODES.has(currentMode));
18
+ }
19
+ //# sourceMappingURL=hyperLiquidAbstraction.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hyperLiquidAbstraction.mjs","sourceRoot":"","sources":["../../src/utils/hyperLiquidAbstraction.ts"],"names":[],"mappings":"AAEA,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAA6B;IACvE,gBAAgB;IAChB,SAAS;IACT,UAAU;CACX,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAC5C,WAAmD,EACnD,gBAAyB;IAEzB,OAAO,CACL,CAAC,gBAAgB;QACjB,WAAW,KAAK,SAAS;QACzB,4BAA4B,CAAC,GAAG,CAAC,WAAW,CAAC,CAC9C,CAAC;AACJ,CAAC","sourcesContent":["import type { HyperLiquidAbstractionMode } from '../types/hyperliquid-types';\n\nconst MIGRATABLE_ABSTRACTION_MODES = new Set<HyperLiquidAbstractionMode>([\n 'dexAbstraction',\n 'default',\n 'disabled',\n]);\n\n/**\n * Determine whether unified-account setup should be deferred until a user\n * explicitly starts a trading or withdrawal action.\n *\n * @param currentMode - The user's current HyperLiquid abstraction mode.\n * @param allowUserSigning - Whether the caller is allowed to trigger wallet signing.\n * @returns True when migration would require a signing-backed mutation that should be deferred.\n */\nexport function shouldDeferUnifiedAccountSetup(\n currentMode: HyperLiquidAbstractionMode | undefined,\n allowUserSigning: boolean,\n): boolean {\n return (\n !allowUserSigning &&\n currentMode !== undefined &&\n MIGRATABLE_ABSTRACTION_MODES.has(currentMode)\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/perps-controller",
3
- "version": "6.0.1-preview-e5cef32c6",
3
+ "version": "6.1.0-preview-6d2aeda",
4
4
  "description": "Controller for perpetual trading functionality in MetaMask",
5
5
  "keywords": [
6
6
  "Ethereum",