Skip to content

Wallet connect#28172

Open
EdouardBougon wants to merge 5 commits intomainfrom
Wallet-Connect
Open

Wallet connect#28172
EdouardBougon wants to merge 5 commits intomainfrom
Wallet-Connect

Conversation

@EdouardBougon
Copy link
Copy Markdown
Contributor

@EdouardBougon EdouardBougon commented Mar 31, 2026

Description

Changelog

CHANGELOG entry:

Related issues

Fixes:

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

High Risk
Extends WalletConnect session/permission handling beyond EVM and adds Snap-based routing for Tron requests, touching connection, session update, and event emission paths that are central to dapp interoperability.

Overview
Adds WalletConnect multichain (Tron) support by expanding permissions and session namespaces beyond eip155, including a new WalletConnectMultiChainConnector for CAIP chain normalization and safe chainChanged emission decisions.

WalletConnect2Session now subscribes to store chain changes to update WC sessions, routes non-EVM requests (feature-flagged tron) to the Tron Snap via handleSnapRequest, and updates redirect behavior to be namespace-aware via REDIRECT_METHODS_BY_NAMESPACE.

Improves robustness/observability around WC QR/deeplink flows (extra logging, WC2 enablement checks, init/getInstance timeout, and cleanup of broken restored sessions), and updates Permissions defaults and getPermittedChains to return scopes across namespaces (including optional Tron scope when enabled).

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

@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.

@metamaskbot metamaskbot added the team-wallet-standard Team responsible of the MetaMask Wallet Standard implementation label Mar 31, 2026
EdouardBougon and others added 5 commits April 10, 2026 16:08
…compatibility

Normalize WalletConnect Tron requests to canonical Snap methods and sanitize params for JSON-RPC validity. Expand Tron session chain/account compatibility to support both decimal and hex CAIP references so dapps and wallet stay interoperable.

Made-with: Cursor
Ensure tron signTransaction requests execute with metamask origin and adapt signature-only Snap results into a full signed transaction payload expected by WalletConnect dapps.

Made-with: Cursor
@Olivier-BB Olivier-BB marked this pull request as ready for review April 10, 2026 14:12
@Olivier-BB Olivier-BB requested review from a team as code owners April 10, 2026 14:12
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - draft PR

All E2E tests pre-selected.

View GitHub Actions results

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 1 potential issue.

Fix All in Cursor

❌ 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 5709a36. Configure here.

// should be multichain/tron-aware. WalletKit rejects these emits and
// this blocks the connection flow.
return;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

updateSession early return breaks all EVM-only sessions

High Severity

The guard if (!mergedNamespaces.tron?.chains?.length) returns early for every session that lacks a Tron namespace, which includes all standard EVM-only WalletConnect connections. This prevents web3Wallet.updateSession() from being called and blocks chainChanged event emission for pure EVM dApps. The comment says the intent is to protect "multichain/tron-aware" sessions, but the condition triggers unconditionally whenever Tron chains are absent, silently breaking chain switching for the majority of WalletConnect sessions.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5709a36. Configure here.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
34.1% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

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

Labels

size-XL team-wallet-standard Team responsible of the MetaMask Wallet Standard implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants