diff --git a/package.json b/package.json index 89984de8634..4edb9c93809 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/core-monorepo", - "version": "1244.0.0", + "version": "1245.0.0", "private": true, "description": "Monorepo for packages shared between MetaMask clients", "repository": { diff --git a/packages/perps-controller/CHANGELOG.md b/packages/perps-controller/CHANGELOG.md index a3907720bf6..1f547673ddf 100644 --- a/packages/perps-controller/CHANGELOG.md +++ b/packages/perps-controller/CHANGELOG.md @@ -7,10 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [16.2.0] + ### Added -- **BREAKING:** Add `ORDER_MARGIN_MODE_INVALID`, `ORDER_MARGIN_MODE_UNSUPPORTED`, `ORDER_MARGIN_MODE_POSITION_OPEN`, and `ORDER_MARGIN_MODE_ORDER_OPEN` to the exported `PerpsErrorCode` union. ([#10136](https://github.com/MetaMask/core/pull/10136)) - - Consumers with exhaustive `Record` maps must add all four entries, including Mobile's `app/components/UI/Perps/utils/translatePerpsError.ts` and Extension's `ui/components/app/perps/utils/translate-perps-error.ts`. Existing callers that omit `marginMode` keep the same runtime behavior. +- Add `ORDER_MARGIN_MODE_INVALID`, `ORDER_MARGIN_MODE_UNSUPPORTED`, `ORDER_MARGIN_MODE_POSITION_OPEN`, and `ORDER_MARGIN_MODE_ORDER_OPEN` to the exported `PerpsErrorCode` union. ([#10136](https://github.com/MetaMask/core/pull/10136)) + - Expanding `PerpsErrorCode` is a minor. Clients should handle unknown codes in a catch-all rather than an exhaustive `Record`. Existing callers that omit `marginMode` keep the same runtime behavior. - Add explicit HyperLiquid `OrderParams.marginMode` selection with market-capability and open-position/order/TWAP guards, and expose the venue's `MarketInfo.marginMode` capability. ([#10136](https://github.com/MetaMask/core/pull/10136)) ### Fixed @@ -892,7 +894,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@16.1.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@16.2.0...HEAD +[16.2.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@16.1.0...@metamask/perps-controller@16.2.0 [16.1.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@16.0.0...@metamask/perps-controller@16.1.0 [16.0.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@15.1.0...@metamask/perps-controller@16.0.0 [15.1.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@15.0.0...@metamask/perps-controller@15.1.0 diff --git a/packages/perps-controller/README.md b/packages/perps-controller/README.md index da370dcbd3a..40d4ff06f34 100644 --- a/packages/perps-controller/README.md +++ b/packages/perps-controller/README.md @@ -49,6 +49,13 @@ The package exports the controller's parameter, result, provider, and messenger types for client integrations. Provider availability and aggregated routing are controlled by client configuration and feature flags. +## Error codes + +`PERPS_ERROR_CODES` / `PerpsErrorCode` are the structured codes returned to +the UI for translation. New codes are additive and ship as a minor. Clients +should keep a catch-all for unrecognized codes instead of an exhaustive map, +so a bump does not fail to compile when a code is added. + ## Explicit HyperLiquid margin mode Pass `marginMode: 'cross'` or `marginMode: 'isolated'` with an integer `leverage` diff --git a/packages/perps-controller/package.json b/packages/perps-controller/package.json index 24280174d13..7e093d45788 100644 --- a/packages/perps-controller/package.json +++ b/packages/perps-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/perps-controller", - "version": "16.1.0", + "version": "16.2.0", "description": "Controller for perpetual trading functionality in MetaMask", "keywords": [ "Ethereum", diff --git a/packages/perps-controller/src/perpsErrorCodes.ts b/packages/perps-controller/src/perpsErrorCodes.ts index a3753c012a0..94a8f3bd889 100644 --- a/packages/perps-controller/src/perpsErrorCodes.ts +++ b/packages/perps-controller/src/perpsErrorCodes.ts @@ -1,7 +1,11 @@ /** - * Error codes for PerpsController - * These codes are returned to the UI layer for translation - * Extracted to separate file to avoid circular dependencies with translatePerpsError + * Error codes for PerpsController. + * These codes are returned to the UI layer for translation. + * Extracted to a separate file to avoid circular dependencies with translatePerpsError. + * + * Adding a code is a minor, not a breaking change. Clients must handle unknown + * codes in a catch-all (else / default / fallback translation) rather than an + * exhaustive `Record`. */ export const PERPS_ERROR_CODES = { CLIENT_NOT_INITIALIZED: 'CLIENT_NOT_INITIALIZED',