MetaMask / MetaMask/metamask-mobile

Abstract WC/SDK logic outside of BackgroundBridge and RPCMethodMiddleware

Open
#9,719 0 comments 0 reactions 0 assignees View on GitHub
team-wallet-integrations
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

### What is this about?

Currently, there are areas in both `BackgroundBridge` and `RPCMethodMiddleware` files where there is hardcoded logic that is unique to WC/SDK features. These files should be agnostic to the services that use them and feature specific logic should be handled outside or passed in during initialization.

Here are a few examples of these areas that should be abstracted
- In BackgroundBridge - https://github.com/MetaMask/metamask-mobile/blob/e0a2253824aeaf4ce98f109b923cfb76c885a932/app/core/BackgroundBridge/BackgroundBridge.js#L88
- In RPCMethodMiddleware - https://github.com/MetaMask/metamask-mobile/blob/e0a2253824aeaf4ce98f109b923cfb76c885a932/app/core/RPCMethods/RPCMethodMiddleware.ts#L130

### Scenario

_No response_

### Design

_No response_

### Technical Details

- Abstract WC/SDK logic outside of RPCMethodMiddleware and BackgroundBridge

### Threat Modeling Framework

_No response_

### Acceptance Criteria

- BackgroundBridge and RPCMethodMiddleware is kept feature agnostic

### Stakeholder review needed before the work gets merged

- [ ] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)

### References

- An issue related to hardcoded logic - https://github.com/orgs/MetaMask/projects/60/views/6?pane=issue&itemId=61033941

Contributor guide

Open the contributing guide

Research direction

Start with the referenced sections of app/core/BackgroundBridge/BackgroundBridge.js and app/core/RPCMethods/RPCMethodMiddleware.ts, then trace the WC/SDK-specific logic they contain. Define the abstraction or initialization inputs needed to keep both components feature agnostic; done means the acceptance criterion is met without changing their core behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
mobile
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.