@metamask-previews/perps-controller 13.0.0-preview-7fead6160 → 13.0.0-preview-add047418

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 CHANGED
@@ -9,7 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Fixed
11
11
 
12
- - Preserve trigger prices and normalized trigger order types in HyperLiquid historical orders while retaining their lifecycle and execution semantics ([#9982](https://github.com/MetaMask/core/pull/9982)).
13
12
  - Classify `xyz:CBRS` and `xyz:SPCX` as stocks in the Hyperliquid fallback market map ([#9988](https://github.com/MetaMask/core/pull/9988))
14
13
 
15
14
  ## [13.0.0]
@@ -3210,6 +3210,8 @@ class HyperLiquidProvider {
3210
3210
  // Transform HyperLiquid orders to abstract Order type
3211
3211
  const orders = (rawOrders || []).map((rawOrder) => {
3212
3212
  const { order, status, statusTimestamp } = rawOrder;
3213
+ // Normalize side: HyperLiquid uses 'A' (Ask/Sell) and 'B' (Bid/Buy)
3214
+ const normalizedSide = order.side === 'B' ? 'buy' : 'sell';
3213
3215
  // Normalize status
3214
3216
  let normalizedStatus;
3215
3217
  switch (status) {
@@ -3242,21 +3244,28 @@ class HyperLiquidProvider {
3242
3244
  default:
3243
3245
  normalizedStatus = 'queued';
3244
3246
  }
3245
- const adaptedOrder = (0, hyperLiquidAdapter_js_1.adaptOrderFromSDK)(order, undefined);
3246
- // limitPx is also populated as a slippage cap for market orders, so the
3247
- // exchange's detailed type is the reliable execution-mode source.
3248
- const historicalOrderType = order.orderType
3249
- ?.toLowerCase()
3250
- .includes('limit')
3251
- ? 'limit'
3252
- : 'market';
3247
+ // Calculate filled and remaining size
3248
+ const originalSize = parseFloat(order.origSz || order.sz);
3249
+ const currentSize = parseFloat(order.sz);
3250
+ const filledSize = originalSize - currentSize;
3253
3251
  return {
3254
- ...adaptedOrder,
3255
- orderType: historicalOrderType,
3256
- remainingSize: parseFloat(order.sz).toString(),
3252
+ orderId: order.oid?.toString() || '',
3253
+ symbol: order.coin,
3254
+ side: normalizedSide,
3255
+ orderType: order.orderType?.toLowerCase().includes('limit')
3256
+ ? 'limit'
3257
+ : 'market',
3258
+ size: order.sz,
3259
+ originalSize: order.origSz || order.sz,
3260
+ price: order.limitPx || '0',
3261
+ filledSize: filledSize.toString(),
3262
+ remainingSize: currentSize.toString(),
3257
3263
  status: normalizedStatus,
3258
3264
  timestamp: statusTimestamp,
3259
3265
  lastUpdated: statusTimestamp,
3266
+ detailedOrderType: order.orderType, // Full order type from exchange (e.g., 'Take Profit Limit', 'Stop Market')
3267
+ isTrigger: order.isTrigger,
3268
+ reduceOnly: order.reduceOnly,
3260
3269
  };
3261
3270
  });
3262
3271
  return orders;