Skip to content

1217.0.0

Choose a tag to compare

@github-actions github-actions released this 29 Aug 13:39
4347fa9

@metamask/perps-controller 14.0.0

Added

  • BREAKING: Add PerpsController.previewPositionModify and PerpsProvider.previewPositionModify so clients can read an isolated-margin post-trade projection without placing an order (#9968)
    • Mobile supplies the live position and proposed order; the HyperLiquid provider fetches the asset's margin table and applies selected leverage to the whole resulting position (matching updateLeverage before placement).
    • The result is a discriminated union (none / unsupported / full_close / open) so a non-modifying preview cannot carry a flip kind and a full close cannot report remaining size. Margin and liquidation availability are independent: a missing live liquidation or missing multi-tier table withholds only liquidation.
    • Isolated increases, leverage changes (up or down), reductions, flips, and full closes are projected for both longs and shorts. price is the expected fill or resting limit; the preview does not distinguish order types. Same-direction reduceOnly and increases/flips without a positive price return { status: 'none' }. resulting.leverage is mark notional / remaining isolated margin. Liquidation uses the projected mark (not average entry) because isolated marginUsed is mark-based equity. A missing margin-table identity withholds liquidation rather than inventing a single-tier schedule. Aggregated providers route by providerId / position.providerId. Cross-margin returns { status: 'unsupported', reason: 'cross_margin' }. MYX returns { status: 'unsupported', reason: 'provider' }.
    • Consumers that implement PerpsProvider must add previewPositionModify. Clients should use resulting.direction (not the order direction) when validating TP/SL against the projected liquidation.

Fixed

  • Prevent transient HyperLiquid WebSocket disconnects from failing the first TP/SL update by checking builder-fee approval over HTTP (#9997)
  • Stop reporting TPSL_UPDATE_FAILED from updatePositionTPSL when HyperLiquid accepts a trigger with waitingForTrigger; accepted triggers without response order IDs are reconciled before mixed-failure cleanup (#9995)