Skip to content

fix: hide HIP-3 provider prefix and gate Trade to supported xyz markets - #32008

Merged
joaosantos15 merged 4 commits into
mainfrom
TSA-785-leaderboard-bugs
Jun 19, 2026
Merged

fix: hide HIP-3 provider prefix and gate Trade to supported xyz markets#32008
joaosantos15 merged 4 commits into
mainfrom
TSA-785-leaderboard-bugs

Conversation

@joaosantos15

@joaosantos15 joaosantos15 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

HIP-3 perpetual markets were surfacing in the social leaderboard with their raw provider prefix (xyz:, cash:, kv: …), e.g. cash:SPCX, and the perp Trade button always linked straight to the position's symbol — even for HIP-3 providers we don't support trading.

This PR:

  1. Hides the HIP-3 provider prefix everywhere a perp symbol is displayed (position detail header + profile position rows), using the controller's getPerpsDisplaySymbol (strips everything up to and including the first :). Non-HIP-3 symbols pass through unchanged.
  2. Gates the Trade CTA to supported xyz markets. We only support trading xyz HIP-3 markets:
    • xyz: and non-HIP-3 symbols link directly.
    • Other HIP-3 providers are remapped to their xyz equivalent (cash:SPCXxyz:SPCX) and linked only when that market exists in the tradable market set (checked via useTradablePerpsMarketSymbols).
    • When no corresponding xyz market exists, the button is disabled and reads "Unsupported asset".

The xyz resolution and its backing market-data subscription are scoped to a new PerpsTradeButton component (wrapped in its own PerpsStreamProvider), so spot positions never mount the provider and the subscription is limited to perp positions only. PerpsStreamProvider itself only shares the app-wide stream singleton (no connection side effects); the sole effect is subscribing to the public market-data channel, which the homepage already warms.

SCR-20260618-oiuw

Changelog

CHANGELOG entry: Fixed Hyperliquid HIP-3 perp markets showing their provider prefix (e.g. cash:) in the social leaderboard, and disabled the Trade button for assets without a supported xyz market.

Related issues

Fixes: TSA-785

Manual testing steps

Feature: HIP-3 perp markets in the social leaderboard

  Scenario: Provider prefix is hidden
    Given a trader holds a HIP-3 perp position (e.g. "cash:SPCX")
    When I open their profile and the position detail
    Then the asset is shown as "SPCX" without the "cash:" prefix

  Scenario: xyz market links directly
    Given a perp position on an "xyz:" market with a tradable market
    When I tap the Trade button
    Then I land on that market's Perps detail page

  Scenario: Non-xyz HIP-3 with an equivalent xyz market
    Given a "cash:SPCX" perp position and an existing "xyz:SPCX" market
    When I tap the Trade button
    Then I land on the "xyz:SPCX" Perps detail page

  Scenario: Unsupported asset
    Given a HIP-3 perp position whose xyz equivalent does not exist
    Then the Trade button is disabled and reads "Unsupported asset"

Screenshots/Recordings

Before

After

N/A — behavioral change covered by unit tests; UI screenshots to be attached on the PR.

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Social leaderboard UI and perp navigation only; no auth or payment paths, with broad unit test coverage.

Overview
HIP-3 perp symbols in the social leaderboard no longer show provider prefixes (cash:SPCXSPCX) via getPerpsDisplaySymbol on position detail and profile rows.

Perp Trade is replaced by PerpsTradeButton, which maps symbols to tradable xyz HIP-3 markets (getSupportedXyzPerpMarketSymbol), checks the tradable set from useTradablePerpsMarketSymbols, and either navigates to Perps market details or shows a disabled Unsupported market label. Non-xyz HIP-3 positions stay enabled optimistically while the market list is empty or loading.

Unit tests cover display, navigation, gating, and optimistic behavior; copy adds unsupported_market.

Reviewed by Cursor Bugbot for commit 5b3e30b. Bugbot is set up for automated code reviews on this repo. Configure here.

HIP-3 perp markets surfaced in the social leaderboard with their provider
prefix (`xyz:`, `cash:`, `kv:` …). Strip the prefix everywhere the symbol is
displayed via `getPerpsDisplaySymbol`.

We only support trading `xyz` HIP-3 markets. The perp Trade CTA now resolves
the position's symbol: `xyz`/non-HIP-3 symbols link directly; other HIP-3
providers are remapped to their `xyz` equivalent (`cash:SPCX` → `xyz:SPCX`) and
linked only when that market exists in the tradable set (via
`useTradablePerpsMarketSymbols`). When no `xyz` market exists, the button is
disabled and reads "Unsupported asset".

The xyz resolution + market-data subscription is scoped to a new
`PerpsTradeButton` (wrapped in its own `PerpsStreamProvider`) so spot positions
never mount the provider.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Jun 18, 2026
@metamask-ci metamask-ci Bot added the team-social-ai Social & AI team label Jun 18, 2026
@metamask-ci

metamask-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Pre-merge author checklist has only 5 of the required 8 items. Every checklist row must be present and consciously checked — do not delete rows.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

1 similar comment
@metamask-ci

metamask-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Pre-merge author checklist has only 5 of the required 8 items. Every checklist row must be present and consciously checked — do not delete rows.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@joaosantos15 joaosantos15 removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Jun 18, 2026
@joaosantos15
joaosantos15 marked this pull request as ready for review June 18, 2026 15:12
@joaosantos15
joaosantos15 requested a review from a team as a code owner June 18, 2026 15:12
Comment thread locales/languages/en.json Outdated
"trades": "Trades",
"buy": "Buy",
"trade": "Trade",
"unsupported_asset": "Unsupported asset",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

market instead of asset?

@xavier-brochard xavier-brochard Jun 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would hide the CTA completely, otherwise the user might not have enough context to know what the button should do it asset was supported, causing confusion.

"I see this disabled button, but I have no idea what it would do if it was enabled"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xavier-brochard this would only happen if this was the first time you were seeing the page, right? Low probability imo

@xavier-brochard xavier-brochard Jun 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can't just assume the user will remember what is the CTA is supposed to be doing when disabled, at any time. UI in general should be explicit, IMO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. For this PR I'd rather leave it as is to avoid the design rabbit hole of where to put the "unsupported market" message. Happy to follow up on a ticket and see what/where to put it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jun 18, 2026
Comment on lines +76 to +81
* Wrapped in its own {@link PerpsStreamProvider} so the market-data
* subscription that backs the existence check is scoped to perp positions
* only — spot positions never mount it. The provider merely shares the
* app-wide stream singleton (no connection side effects of its own); the only
* effect is subscribing to the public market-data channel, which the homepage
* already warms.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent

usePerpsMarkets can report isLoading:false with an empty market list while a
fetch is still in flight (or when an empty controller cache is treated as
preloaded), so gating on isLoading alone could lock a remapped HIP-3 position
into a false, sticky 'Unsupported market'. Key off the set being empty instead
(per the hook's documented contract) to stay optimistic until the list arrives.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 78%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR modifies the Social Leaderboard's perps-related UI components:

  1. New PerpsTradeButton component: Wraps the trade CTA with HIP-3 market existence checking via PerpsStreamProvider and useTradablePerpsMarketSymbols. The button is now disabled (showing "Unsupported market") when the resolved xyz market doesn't exist in the tradable list.

  2. getSupportedXyzPerpMarketSymbol utility: New function that maps non-xyz HIP-3 provider symbols (e.g., cash:SPCX) to their xyz equivalent (xyz:SPCX) for routing.

  3. Display symbol stripping: getPerpsDisplaySymbol is now used in useTraderPositionData, PositionRow, and TraderPositionView to strip HIP-3 prefixes (e.g., xyz:SPCXSPCX) for display.

  4. Navigation change: handlePerpTrade now receives the resolved targetSymbol from PerpsTradeButton instead of using the raw tokenSymbol, affecting which market details screen is opened.

Tag selection rationale:

  • SmokePerps: Directly tests perps flows including market navigation and position management. The trade button behavior change (disabled state for unsupported markets, symbol resolution) could affect perps navigation from the social leaderboard.
  • SmokeWalletPlatform: Required by SmokePerps tag description (Perps is a section inside Trending tab). Social Leaderboard is also part of the wallet platform.
  • SmokeConfirmations: Required by SmokePerps tag description (Add Funds deposits are on-chain transactions).

No E2E specs directly test the Social Leaderboard trader position/profile views, so these are the closest coverage available. The changes are medium risk — they affect UI behavior and navigation logic but are scoped to the social leaderboard perps feature.

Performance Test Selection:
The changes are UI-level modifications to the Social Leaderboard's perps trade button and symbol display logic. No performance-sensitive code paths are affected: no new data fetching loops, no controller changes, no rendering-heavy operations. The PerpsStreamProvider wrapping merely shares an existing singleton stream subscription. No performance test tags are warranted.

View GitHub Actions results

@joaosantos15
joaosantos15 enabled auto-merge June 19, 2026 08:36
@sonarqubecloud

Copy link
Copy Markdown

@joaosantos15
joaosantos15 added this pull request to the merge queue Jun 19, 2026
Merged via the queue into main with commit 16655d5 Jun 19, 2026
120 of 122 checks passed
@joaosantos15
joaosantos15 deleted the TSA-785-leaderboard-bugs branch June 19, 2026 09:49
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 19, 2026
@metamaskbot metamaskbot added the release-8.1.0 Issue or pull request that will be included in release 8.1.0 label Jun 29, 2026
@gauthierpetetin

Copy link
Copy Markdown
Contributor

No release label on PR. Adding release label release-8.1.0 on PR, as PR was added to branch 8.1.0 when release was cut.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.1.0 Issue or pull request that will be included in release 8.1.0 risk:medium AI analysis: medium risk size-M team-social-ai Social & AI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants