MetaMask / MetaMask/metamask-extension
Multichain: Cleanup `getCurrentChainId` partial state usages
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
### What is this about?
As part of the Default Networks work, we started passing partial state to `getCurrentChainId` in backend files like `app/scripts/metamask-controller.js`. In anticipation for https://github.com/MetaMask/metamask-extension/issues/27832 , we should clean this practice up, instead by have a shared function between UI and backend so that partial states aren't being used.
These usages can be identified looking like this:
```
getCurrentChainId({
metamask: { ...this.networkController.state },
})
```
### Scenario
_No response_
### Design
_No response_
### Technical Details
_No response_
### Threat Modeling Framework
_No response_
### Acceptance Criteria
_No response_
### 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
_No response_
Contributor guide
Research direction
Start by searching for getCurrentChainId calls that pass partial metamask state, including the example in app/scripts/metamask-controller.js. Trace how the function is used in UI and backend code and identify the shared function boundary. Done means these usages no longer pass partial state and both sides use the shared approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- full-stack
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100