fix(perps-controller): map Terminal v1 category onto client marketType - #9907
Open
geositta wants to merge 3 commits into
Open
fix(perps-controller): map Terminal v1 category onto client marketType#9907geositta wants to merge 3 commits into
geositta wants to merge 3 commits into
Conversation
geositta
marked this pull request as ready for review
August 19, 2026 13:35
geositta
force-pushed
the
fix/perps-unitree-pre-ipo
branch
from
August 19, 2026 13:45
ea05173 to
1c30c50
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1c30c50. Configure here.
michalconsensys
previously approved these changes
Aug 19, 2026
geositta
force-pushed
the
fix/perps-unitree-pre-ipo
branch
from
August 20, 2026 05:51
f96a3c9 to
6d1b7ca
Compare
abretonc7s
requested changes
Aug 20, 2026
abretonc7s
left a comment
Contributor
There was a problem hiding this comment.
We should be using v2 now and deprecate the v1 endpoint.
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
What is the current state of things and why does it need to change?
Mobile's Pre-IPO chip filters on
marketType === "pre-ipo". Production Terminal v1 already sends Unitree, CXMT, and SKHY ascategory: "pre_ipo", but v1#extractMetadataonly copiedmarketType/categoriesand droppedcategory. Those markets leftmarketTypeunset and did not appear under Pre-IPO.Cerebras (
xyz:CBRS) and SpaceX (xyz:SPCX) are public. Terminal already classifies them asstocks, butHIP3_ASSET_MARKET_TYPESstill tags thempre-ipofrom an older client override, so they stay on the Pre-IPO chip when Terminal does not setmarketType.What is the solution your changes offer and how does it work?
#categoryToMarketTypeis the single Terminal → client alias table (pre_ipo→pre-ipo,stocks→stock, plus passthrough of values already inMarketCategory). v2#marketTypeForand v1#extractMetadataboth use it. Explicit v1marketTypestill wins.When Terminal is on, Unitree / CXMT / SKHY get
pre-ipofromcategory, and CBRS / SPCX getstock.HIP3_ASSET_MARKET_TYPESmoves CBRS and SPCX tostockso the HyperLiquid-direct fallback matches.xyz:IPOP(Quantinuum) stays Pre-IPO.Are there any changes whose purpose might not obvious to those unfamiliar with the domain?
This is not a typo in the mobile filter and not an old-app shim. Terminal and the client use different field names and spellings today (
category: "pre_ipo"vsmarketType: "pre-ipo"). The controller is the adapter; changing the chip to compare"pre_ipo"would still miss Unitree (marketTypeis unset) and would drop markets that already use"pre-ipo".We do not map only
pre_ipoand leavestocksalone. That was protecting the stale CBRS/SPCX Pre-IPO override.If your primary goal was to update one package but you found you had to update another one along the way, why did you do so?
Only
@metamask/perps-controllerchanged. No other package in this repo.If you had to upgrade a dependency, why did you do so?
No dependency upgrades.
References
Checklist
Note
Low Risk
Localized market classification and filter-bucket behavior in perps-controller; no auth, trading, or payment paths.
Overview
Fixes Pre-IPO and stock category filters when Mobile uses Terminal v1 metadata: markets like Unitree were sent as
category: "pre_ipo"but never gotmarketType, so they did not matchpre-ipo.Terminal → client mapping: Adds shared
#categoryToMarketType(pre_ipo→pre-ipo,stocks→stock, plus validMarketCategorypassthrough). v1#extractMetadatanow readscategoryon the schema and uses this whenmarketTypeis missing; explicitmarketTypestill wins. v2#marketTypeFordelegates to the same helper.Enrichment parity: When v1 Terminal metadata applies a
marketType,MarketDataServiceclearsisNewMarketso categorized HIP-3 markets are not also in thenewfilter (aligned with the v2 snapshot path).Static fallback: Moves
xyz:CBRSandxyz:SPCXfrompre-ipotostockinHIP3_ASSET_MARKET_TYPESwhen Terminal/HyperLiquid fallback is used;xyz:IPOPstays Pre-IPO.Reviewed by Cursor Bugbot for commit 6d1b7ca. Bugbot is set up for automated code reviews on this repo. Configure here.