Skip to content

fix: 25144 QR code popup constantly in explorer screen due to predictions require typed sign to connect. cp-7.63.0#25334

Merged
dawnseeker8 merged 15 commits intomainfrom
fix/25144-qr-code-popup-fix-in-explorer
Jan 29, 2026
Merged

fix: 25144 QR code popup constantly in explorer screen due to predictions require typed sign to connect. cp-7.63.0#25334
dawnseeker8 merged 15 commits intomainfrom
fix/25144-qr-code-popup-fix-in-explorer

Conversation

@dawnseeker8
Copy link
Copy Markdown
Contributor

@dawnseeker8 dawnseeker8 commented Jan 28, 2026

This PR will fix #25144 which constantly popup QR signing transaction.

Root clause

The cause of this issue is little bit complicate,
The issue is that the Explorer/Trending tab has a Perps section that automatically initializes when the tab is clicked. This initialization:

  1. Creates a wallet adapter (createWalletAdapter() in HyperLiquidWalletService.ts)
  2. Prepares signing methods that require hardware wallet interaction
  3. Monitors account changes via Redux subscription in PerpsConnectionManager.ts (lines 81-163)
  4. Repeatedly reconnects when account changes are detected, creating new wallet adapters each time

The whole flow like below

Explorer Tab Click
  → PerpsSection renders (sections.config.tsx)
    → usePerpsMarkets() hook
      → streamManager.marketData.subscribe()
        → PerpsConnectionManager.connect()
          → setupStateMonitoring() - subscribes to Redux
            → reconnectWithNewContext() on account change
              → createWalletAdapter()
                → signTypedData method created
                  → QR POPUP TRIGGERED (for hardware wallets)

solution

implement global signing cache for DEX abstraction and referral setup

  • Introduces a global singleton cache to manage signing operations for DEX abstraction, builder fee approval, and referral code setup, preventing repeated signing requests across provider reconnections.
  • Updates HyperLiquidProvider to utilize the new cache for checking and setting DEX abstraction status, ensuring critical operations for hardware wallets are streamlined.
  • Adds methods in PerpsConnectionManager to clear cache entries, enhancing debugging and user experience after signature rejections.
  • Refactors existing logic to improve handling of concurrent signing attempts and cache state management.

This change enhances the user experience by reducing unnecessary signing prompts and improving the efficiency of the DEX abstraction process.

Description

Changelog

CHANGELOG entry: implement global signing cache for DEX abstraction and referral setup to fix the issue #25144

Related issues

Fixes: #25144

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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

Medium Risk
Changes when and how perps signing operations (DEX abstraction, builder fee, referral) are triggered, and adds a global cache/lock to suppress retries across reconnections; mistakes could block trading setup or incorrectly skip required signatures.

Overview
Introduces a new global singleton TradingReadinessCache/PerpsSigningCache to persist per-user/per-network signing state and coordinate in-flight signing operations across provider reconnections.

Refactors HyperLiquidProvider to defer all signature-requiring setup out of ensureReady() into a new ensureReadyForTrading() (used by placeOrder, cancels, closes, TP/SL updates), and updates DEX abstraction, builder-fee approval, and referral setup to consult/cache results (including failures) and wait on global in-flight locks to avoid repeated hardware-wallet prompts.

Adds PerpsConnectionManager APIs to clear DEX abstraction cache for a user or clear all signing cache, and expands/updates tests to cover the new cache behavior and the now non-blocking builder-fee failure behavior.

Written by Cursor Bugbot for commit e147571. This will update automatically on new commits. Configure here.

…eferral setup

- Introduces a global singleton cache to manage signing operations for DEX abstraction, builder fee approval, and referral code setup, preventing repeated signing requests across provider reconnections.
- Updates `HyperLiquidProvider` to utilize the new cache for checking and setting DEX abstraction status, ensuring critical operations for hardware wallets are streamlined.
- Adds methods in `PerpsConnectionManager` to clear cache entries, enhancing debugging and user experience after signature rejections.
- Refactors existing logic to improve handling of concurrent signing attempts and cache state management.

This change enhances the user experience by reducing unnecessary signing prompts and improving the efficiency of the DEX abstraction process.
@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.

dawnseeker8 and others added 5 commits January 28, 2026 22:15
- Updated `HyperLiquidProvider` and `PerpsConnectionManager` to utilize the new `TradingReadinessCache` for managing signing operations related to DEX abstraction and builder fee approvals.
- Introduced `TradingReadinessCache` as a global singleton to enhance the efficiency of signing requests and prevent unnecessary prompts during provider reconnections.
- Refactored cache clearing methods in `PerpsConnectionManager` to align with the new cache structure, improving overall cache management and debugging capabilities.
@dawnseeker8 dawnseeker8 marked this pull request as ready for review January 29, 2026 09:58
@dawnseeker8 dawnseeker8 requested a review from a team as a code owner January 29, 2026 09:58
dawnseeker8 and others added 3 commits January 29, 2026 10:52
- Added handling for `tradingSetupPromise` in the `HyperLiquidProvider` to ensure it completes before disconnecting.
- This change prevents potential state updates after the disconnect process, improving stability during client disconnections.
@github-actions github-actions bot added size-XL and removed size-L labels Jan 29, 2026
dawnseeker8 and others added 2 commits January 29, 2026 14:12
- Introduced methods to clear specific states (DEX abstraction, builder fee, referral) in the TradingReadinessCache, allowing for more granular cache management.
- Updated PerpsConnectionManager to utilize the new cache methods, improving clarity and functionality in cache operations.
- Refactored related tests to ensure coverage for the new cache methods and their behaviors, enhancing overall test reliability.
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

@github-project-automation github-project-automation bot moved this to Needs dev review in PR review queue Jan 29, 2026
@dawnseeker8 dawnseeker8 changed the title fix: 25144 QR code popup constantly in explorer screen due to predictions require typed sign to connect. fix: 25144 QR code popup constantly in explorer screen due to predictions require typed sign to connect. cp-7.63.0 Jan 29, 2026
@michalconsensys
Copy link
Copy Markdown
Contributor

Hello @dawnseeker8 , many thanks for having a look into the issue. I'm not able to test this locally without a HW wallet, could you please share a video of the UX after this change is implemented?

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps
  • Selected Performance tags: @PerformancePreps
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR introduces a global singleton cache (TradingReadinessCache/PerpsSigningCache) for Perps signing operations to prevent repeated signing requests, which is critical for hardware wallets to avoid QR popup spam.

Key changes:

  1. New TradingReadinessCache.ts - Global singleton cache tracking DEX abstraction, builder fee approval, and referral setup states
  2. HyperLiquidProvider.ts - Major refactoring to defer signing operations until actual trading via new ensureReadyForTrading() method, with in-flight lock mechanism to prevent concurrent signing attempts
  3. PerpsConnectionManager.ts - Added cache clearing methods for debugging
  4. Comprehensive unit tests - All new functionality is well-tested

The changes are entirely isolated to the Perps (perpetuals trading) feature within app/components/UI/Perps/. No other wallet features are affected. The SmokePerps tag covers:

  • Add Funds flow to deposit USDC into Perps trading account
  • Balance verification after deposits
  • Entry point via Perps button in TradeWalletActions menu

While the changes modify trading flow initialization, they are internal optimizations with good unit test coverage. The risk is medium because the changes affect the trading setup flow, but the impact is limited to Perps functionality only.

Performance Test Selection:
The changes to HyperLiquidProvider.ts modify the initialization and trading setup flow by deferring signing operations. This could impact the performance of the Perps trading flow, particularly the time to become ready for trading. The new caching mechanism and in-flight lock system could affect how quickly users can start trading after entering the Perps section. The @PerformancePreps tag covers perps market loading, position management, add funds flow, and order execution - all of which could be affected by these initialization changes.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@gambinish gambinish left a comment

Choose a reason for hiding this comment

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

Tested the flow mentioned in the corresponding issue, and I didn't see the flashing QR sign prompt while viewing the Explore page after a successful earn deposit.

All Perps flows seem to still remain functional after this change.

@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Jan 29, 2026
@dawnseeker8 dawnseeker8 added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit 1d4bd68 Jan 29, 2026
86 of 87 checks passed
@dawnseeker8 dawnseeker8 deleted the fix/25144-qr-code-popup-fix-in-explorer branch January 29, 2026 18:22
@github-project-automation github-project-automation bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Jan 29, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2026
@metamaskbot metamaskbot added release-7.65.0 Issue or pull request that will be included in release 7.65.0 release-7.64.0 Issue or pull request that will be included in release 7.64.0 and removed release-7.65.0 Issue or pull request that will be included in release 7.65.0 labels Jan 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.64.0 Issue or pull request that will be included in release 7.64.0 size-XL team-accounts-framework Accounts team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug]: Hardware wallet get signature QR code keeps popping up on Explore after successful QR transaction.

4 participants