MetaMask / MetaMask/metamask-mobile
Move manually added swapsTransactions state out out TransactionController
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### What is this about?
From: https://github.com/MetaMask/metamask-mobile/pull/9442#discussion_r1589011924
In Mobile, the field `swapsController` is manually added to the `TransactionController` and accessed in several different places to determine the Swap metadata (e.g. From/To tokens, amounts).
This should really be put somewhere else, probably in a Redux slice.
This needs to be addressed when the TransactionController updates to v^25 or more, because TransactionController at that version will extend the BaseControllerV2 and that will not allow direct updates to the state anymore.
### Scenario
_No response_
### Design
_No response_
### Technical Details
_No response_
### Threat Modeling Framework
_No response_
### Acceptance Criteria
All Swap metadata is still able to be accessed correctly when not looked up from the `TransactionController.swapsTransactions`
### Stakeholder review needed before the work gets merged
- [X] 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
https://github.com/MetaMask/metamask-mobile/pull/9442#discussion_r1589011924
Contributor guide
Research direction
Start by tracing the manually added TransactionController.swapsController and its swapsTransactions references, using the discussion in PR #9442 as context. Identify every place that reads Swap metadata and determine how the proposed Redux slice will provide equivalent access; done means all Swap metadata remains accessible without TransactionController.swapsTransactions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100