Skip to content

feat(perps): report margin-mode support and Lighter margin-mode lock - #10415

Merged
abretonc7s merged 2 commits into
TAT-3524-perps-asset-margin-modefrom
TAT-3524-perps-margin-mode-capabilities
Sep 24, 2026
Merged

abretonc7s merged 2 commits into
TAT-3524-perps-asset-margin-modefrom
TAT-3524-perps-margin-mode-capabilities

Conversation

@abretonc7s

Copy link
Copy Markdown
Contributor

Explanation

Follow-up to #10414 (stacked on it; retarget to main once it merges).

  • supportedMarginModes in order capabilities. Clients decided Cross availability themselves (provider is HyperLiquid, market is not HIP-3, asset is not onlyIsolated/marginMode-restricted). That is venue logic leaking into clients. Ready order capabilities now carry an optional supportedMarginModes. HyperLiquid reports ['isolated', 'cross'] for main-DEX markets and ['isolated'] for HIP-3 or isolated-only assets, computed by a single #isCrossMarginSupported predicate that #validateMarginMode also uses, so the advertised modes and placement validation cannot drift. The field is optional: omitted means the provider does not report it and clients should not offer an explicit mode.
  • LighterProvider.getMarginModeLock. Lighter also binds the margin mode per market (UpdateLeverage carries the wire mode). The existing position-row read was extracted into #readPositionMarginMode (the leverage-update path keeps its current fallback behavior); the new method reports locked with the open position's mode (a missing field means cross), unlocked when flat, or unavailable on read failure. Only open positions lock the mode here; resting orders are not treated as a lock.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Add optional supportedMarginModes to ready order capabilities so clients
stop inferring margin-mode support from the provider. HyperLiquid derives
it from the same Cross rule order validation uses. Implement
getMarginModeLock for Lighter from the open position's mode.
@abretonc7s
abretonc7s merged commit 85804e7 into TAT-3524-perps-asset-margin-mode Sep 24, 2026
31 checks passed
@abretonc7s
abretonc7s deleted the TAT-3524-perps-margin-mode-capabilities branch September 24, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant