feat(perps): report margin-mode support and Lighter margin-mode lock - #10415
Merged
abretonc7s merged 2 commits intoSep 24, 2026
Merged
abretonc7s merged 2 commits into
abretonc7s merged 2 commits into
Conversation
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
merged commit Sep 24, 2026
85804e7
into
TAT-3524-perps-asset-margin-mode
31 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Follow-up to #10414 (stacked on it; retarget to
mainonce it merges).supportedMarginModesin order capabilities. Clients decided Cross availability themselves (provider is HyperLiquid, market is not HIP-3, asset is notonlyIsolated/marginMode-restricted). That is venue logic leaking into clients. Ready order capabilities now carry an optionalsupportedMarginModes. HyperLiquid reports['isolated', 'cross']for main-DEX markets and['isolated']for HIP-3 or isolated-only assets, computed by a single#isCrossMarginSupportedpredicate that#validateMarginModealso 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 (UpdateLeveragecarries the wire mode). The existing position-row read was extracted into#readPositionMarginMode(the leverage-update path keeps its current fallback behavior); the new method reportslockedwith the open position's mode (a missing field means cross),unlockedwhen flat, orunavailableon read failure. Only open positions lock the mode here; resting orders are not treated as a lock.References
Checklist