Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
9 changes: 6 additions & 3 deletions packages/perps-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<PerpsErrorCode, …>` 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<PerpsErrorCode, …>`. 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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions packages/perps-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion packages/perps-controller/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 7 additions & 3 deletions packages/perps-controller/src/perpsErrorCodes.ts
Original file line number Diff line number Diff line change
@@ -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<PerpsErrorCode, …>`.
*/
export const PERPS_ERROR_CODES = {
CLIENT_NOT_INITIALIZED: 'CLIENT_NOT_INITIALIZED',
Expand Down
Loading