feat: split request_source to distinguish SDKv1 from MWP#28697
feat: split request_source to distinguish SDKv1 from MWP#28697
Conversation
Previously both SDKv1 (socket relay) and MWP/SDKv2 connections produced
the same request_source value 'MetaMask-SDK-Remote-Conn' on RPC pipeline
events (Transaction Added, Signature Requested, etc.), making them
indistinguishable in analytics.
Adds a transport field ('socket_relay' | 'mwp') to the analytics param
passed to getRpcMethodMiddleware, and branches getSource() on it:
- SDKv1: 'MetaMask-SDK-Remote-Conn' (unchanged, preserves data continuity)
- MWP/V2: 'MetaMask-Connect' (new)
Relates to WAPI-1398.
|
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. |
Centralizes transport values (socket_relay, mwp, walletconnect) in a TransportType constant alongside SourceType in useAnalytics.types.ts, replacing scattered magic strings in the RPC middleware and bridge code.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Risk Assessment:
Selected Tags:
Tags NOT selected: SmokeAccounts, SmokeIdentity, SmokeTrade, SmokeWalletPlatform, SmokeRamps, SmokeCard, SmokePerps, SmokePredictions, SmokeSeedlessOnboarding, FlaskBuildTests - these are not directly affected by SDK connection transport type differentiation. Performance Test Selection: |
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 e27ae07. Configure here.
| export const TransportType = { | ||
| SOCKET_RELAY: 'socket_relay', | ||
| MWP: 'mwp', | ||
| WALLETCONNECT: 'walletconnect', |
There was a problem hiding this comment.
Unused TransportType.WALLETCONNECT constant defined but never referenced
Low Severity
TransportType.WALLETCONNECT is defined but never referenced anywhere in the codebase. Only TransportType.MWP and TransportType.SOCKET_RELAY are used. WalletConnect connections pass analytics: {} (no isRemoteConn), so they bypass the transport check entirely in getSource() — making this constant unreachable by design.
Reviewed by Cursor Bugbot for commit e27ae07. Configure here.
|
|
✅ E2E Fixture Validation — Schema is up to date |





Summary
Both SDKv1 (socket relay) and MWP/SDKv2 connections produced the same
request_sourcevalue (MetaMask-SDK-Remote-Conn) on RPC pipeline events (Transaction Added,Signature Requested, etc.), making them indistinguishable in analytics.Adds a
transportfield (socket_relay|mwp) to the analytics param passed togetRpcMethodMiddlewareand branchesgetSource()on it:MetaMask-SDK-Remote-Conn(unchanged — preserves data continuity)MetaMask-Connect(new)Related
Test plan
request_sourceisMetaMask-SDK-Remote-Connrequest_sourceisMetaMask-Connectrequest_sourcevalues unchangedNote
Low Risk
Low risk: small, additive analytics metadata change that only affects how
request_sourceis computed for remote SDK connections; main risk is misclassification iftransportis omitted or set incorrectly.Overview
Remote SDK connections now pass an explicit analytics
transport(e.g.,socket_relayvsmwp) intogetRpcMethodMiddleware, andgetSource()uses it to splitrequest_sourcebetween SDKv1 socket-relay (MetaMask-SDK-Remote-Conn, unchanged) and MWP/SDKv2 (MetaMask-Connect, new).Adds the shared
TransportTypeenum and wires it into SDKv1 bridge setup and SDKv2 RPC bridge adapter so RPC pipeline events can be attributed correctly in analytics.Reviewed by Cursor Bugbot for commit e27ae07. Bugbot is set up for automated code reviews on this repo. Configure here.