feat(perps-controller): persist pro-mode order, chart, and draft preferences - #9922
Open
michalconsensys wants to merge 1 commit into
Open
feat(perps-controller): persist pro-mode order, chart, and draft preferences#9922michalconsensys wants to merge 1 commit into
michalconsensys wants to merge 1 commit into
Conversation
…erences Store a market-agnostic order type, order-book listed-by settings, and a shared visible candle count. Restore pending order drafts for 30 seconds, include reduce-only, and clear drafts after a successful placement without resetting leverage or order type.
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
Perps Pro-mode trade preferences were not fully owned by
@metamask/perps-controller. Clients had to keep order type, order-book listed-by display, visible candle count, and draftreduceOnlylocally, while pending trade drafts lived for five minutes and were not cleared after a successful order.This change persists those preferences on the controller and tightens draft restore:
selectedOrderTypeis stored once for all markets (default'market'). Saving a pending trade configuration with anorderTypeupdates this value as well.orderBookPreferencesstores listed-by display as{ currency: 'usd' | 'base', metric: 'total' | 'size' }(defaults to USD totals). Order-book grouping remains per-market.visibleCandleCountis stored globally, defaults to30, and is clamped to10–250.reduceOnly, and are cleared after a successfulplaceOrder. Leverage and the selected order type are kept.Getters and selectors merge defaults so older persisted state without the new fields still reads correctly. Consumers that construct a full
PerpsControllerStateobject must include the new fields.Last-market landing and market-list category persistence are intentionally out of scope.
References
Checklist
Note
Cursor Bugbot is generating a summary for commit dd7f80d. Configure here.