feat: remove all MYX protocol from core - #10038
Open
abretonc7s wants to merge 4 commits into
Open
Conversation
MYX is no longer a supported perps venue. Removing it drops the optional @myx-trade/sdk dependency, the dynamic-import plus webpackIgnore workaround, and the three !dist/*MYX* packaging exclusions that existed only to keep the provider out of published bundles. Deletes MYXProvider, MYXClientService, MYXWalletService, the MYX adapter, and the MYX config and type modules with their test suites, and de-wires the controller: #isMYXProviderEnabled, the dynamic import, registerMYXProvider, handleMYXImportError, resolveMyxAuthConfig, and every 'myx' routing and cache-key branch. PerpsProviderType narrows to 'hyperliquid' | 'lighter'. BREAKING CHANGE: removes the MYXCredentials type, the providerCredentials.myx option, PROVIDER_CONFIG.MYX_TESTNET_ONLY, and all MYX_* constant, endpoint, converter, and asset-config exports. Setting activeProvider: 'myx' or passing providerId: 'myx' now throws Unsupported provider. PerpsWatchlistMarkets.myx in authenticated-user-storage is made optional and deprecated rather than removed: it is a server-persisted schema, and blobs already stored with a myx watchlist must keep validating. Nothing writes it any more. A regression test pins both shapes. Where MYX served only as a second provider in aggregation, routing, and cache tests, those cases were repointed at Lighter so multi-provider coverage is preserved. HyperLiquid and Lighter behavior is unchanged.
`activeProvider` is persisted, and before this fix a value restored from an
older version whose venue has since been removed — notably 'myx' — fell
through to the `Unsupported provider` throw. That throw happens inside
performInitialization, so it was caught by the retry loop, burned every
attempt with backoff, and ended at InitializationState.Failed without ever
rewriting the persisted value. Perps stayed broken on every launch, not just
the first, until the client cleared state.
Make the fallback the default branch instead: any direct provider that is not
registered falls back to hyperliquid and rewrites the persisted value, which
is how 'myx' behaved before it was removed. The compile-time break is
unaffected — PerpsProviderType still does not admit 'myx'.
Also corrects the changelog, which claimed the controller throws for 'myx':
switchProvider returns { success: false, error: 'Provider myx not available' }
and persisted state now self-heals.
Remove the removed venue's name from the two explanatory comments left by the self-heal fix; the fallback is generic, so the comments describe it generically. The one remaining 'myx' literal is the regression test's input — it reproduces the value real users have in persisted state, so replacing it would stop the test proving upgrade behaviour. Condense the changelog entry from implementation narration to migration instructions, and drop the nested BREAKING prefixes now that the parent entry carries one.
MYX was an unused protocol, so its removal is filed as a plain Removed entry rather than a breaking change. Point both changelog links at the real PR (#10038); they were written against a guessed number before the PR existed.
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
@metamask/perps-controllershipped a full MYX protocol implementation alongside HyperLiquid andLighter. MYX is being dropped as a venue, and keeping it cost real weight: an optional
@myx-trade/sdkdependency, a dynamic-import +webpackIgnoreworkaround plus three!dist/*MYX*filesexclusions so extension bundles could skip the provider, and'myx'branches threaded through the controller, the provider router, and the provider-type unions.
This PR removes MYX from the package. It deletes
MYXProvider,MYXClientService,MYXWalletService, the MYX adapter, and the MYX config and type modules along with their testsuites; drops the
@myx-trade/sdkdependency and the packaging exclusions it required; andde-wires the controller —
#isMYXProviderEnabled, the dynamic-import registration path,registerMYXProvider,handleMYXImportError,resolveMyxAuthConfig, and the'myx'routing andcache-key branches all go. Net: ~8,700 lines removed across 42 files.
Notable API effects, all breaking for consumers that used MYX:
PerpsProviderTypeis now'hyperliquid' | 'lighter'.switchProvider('myx')returns{ success: false, error: 'Provider myx not available' }. A'myx'value restored frompersisted state falls back to
'hyperliquid'and rewrites the persisted value, so existingMYX users self-heal on next launch rather than getting a broken perps tab.
MYXCredentialstype andproviderCredentials.myxoption are gone.MYX_*constants,getMYXChainId/getMYXHttpEndpoint, thefromMYX*/toMYX*converters, and the MYX-only
USDT_BNB_TESTNET/USDT_BNB_MAINNETcollateral addresses are nolonger exported.
PROVIDER_CONFIG.MYX_TESTNET_ONLYis removed;buildProviderCacheKeyno longer special-cases'myx'.perpsMyxProviderEnabledremote flag andMM_PERPS_MYX_PROVIDER_ENABLEDenv override areno longer read, so clients can retire both.
Two changes may not be obvious:
packages/authenticated-user-storageis touched deliberately.PerpsWatchlistMarkets.myxis a server-persisted preference schema, not protocol code, and blobs already stored remotely
contain a
myxkey. Deleting the required field would have failed validation on that existingdata. It is instead made
optional()and@deprecated: nothing writes it any more, storedblobs still validate, and
perps-controlleris left with zero MYX references.filesfield is now plain["dist/"]. With the MYX exclusions gone, everything emittedinto
dist/publishes — so a staledist/from a previous build would ship MYX artifacts. Thevalidation below uses
yarn build:clean(which wipespackages/*/distfirst) and asserts theemitted tree contains no MYX file at all.
HyperLiquid and Lighter behavior is unchanged. Where MYX served only as "a second provider" in
multi-provider aggregation, routing, and cache tests, those cases were repointed at Lighter rather
than deleted, so multi-provider coverage is preserved.
Validation
yarn workspace @metamask/perps-controller run test— 79 suites, 3399 passed, 0 failures,coverage thresholds met (89.4% lines vs 80% required, 81.54% branches vs 69%, 85.58% functions
vs 78%).
yarn workspace @metamask/authenticated-user-storage run jest— 44 passed, 0 failures.yarn build:clean(root ts-bridge) — exit 0, "Project built successfully"; the emittedpackages/perps-controller/distcontains no MYX file, anddist/index.d.cts/dist/index.cjsexport no MYX symbol.
yarn changelog:validate— passes.src//tests/, none in the manifest,none in the built
dist/) and then reads live HyperLiquid testnet positions, orders, andaccount state through the de-wired controller to show the removal caused no regression. The
assertions were confirmed to fail against the pre-change tree, so a revert of this diff breaks
the recipe.
References
Client follow-ups needed before/alongside adoption:
providerCredentials.myx,activeProvider: 'myx', orproviderId: 'myx'usage and remove MYX from provider pickers.perpsMyxProviderEnabledremote feature flag can be retired once clients are updated.myxwatchlist key entirely once nostored blob relies on it.
Checklist
routing, and cache coverage is preserved.
'myx'as a sample provider now use'lighter'; comments in theLighter provider, wallet service, and adapter that referenced MYX as their template were
rewritten to stand alone.
perps-controller(Removed,**BREAKING:**) andauthenticated-user-storage(Changed).clients and consumer packages to resolve them
open. They are listed under References and should land before this is adopted.
Screenshots/Recordings
Note
Medium Risk
Breaking public API and large deletion in perps routing/initialization; mitigated by persisted-provider fallback and optional deprecated AUS
myxkey for stored preferences.Overview
Removes the MYX perpetuals venue from
@metamask/perps-controller: provider, client/wallet services, adapters, config/types, SDK optional dependency, dynamic registration, and all publicMYX_*exports.PerpsProviderTypeis now'hyperliquid' | 'lighter';MYXCredentials/providerCredentials.myx, theperpsMyxProviderEnabledflag, and related env overrides are gone.#assignActiveProviderno longer throws on an unknown persistedactiveProvider—it falls back to HyperLiquid and rewrites state so older'myx'selections self-heal. AUS watchlist writes no longer seed amyxentry; multi-provider tests that used MYX were repointed to Lighter.In
authenticated-user-storage,PerpsWatchlistMarkets.myxis@deprecatedand optional in types and validators so existing server preference blobs still validate; new compat tests cover both shapes.Reviewed by Cursor Bugbot for commit 84496d2. Bugbot is set up for automated code reviews on this repo. Configure here.