MetaMask / MetaMask/metamask-mobile
Refactor DAPP Transfer / Approval related code in RootRPCMethodsUI
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### **Description**
`RootRPCMethodsUI.js` has code to handle a new DAPP request for a transfer or approval. This includes message listeners:
https://github.com/MetaMask/metamask-mobile/blob/bdb7f37c90e4fc923881a07fca38d4e77c73a579/app/components/Nav/Main/RootRPCMethodsUI.js#L687
And functions: `onUnapprovedTransaction`, `toggleApproveModal`, `toggleDappTransactionModal` and other related code. This code can be moved out into a hook which can then be used in `RootRPCMethodsUI`.
### **Acceptance Criteria**
- All of DAPP transfer / approval related code is moved to the new hook (as much as possible)
- Transfer / Approval functionality continues to work as it is currently
- Refactored code has good unit test coverage
### **References**
https://docs.google.com/document/d/19xKY4e07UThOa1jsDQA8pjsNLUBRn39EdUbaFpz3OR0/edit?usp=sharing
Contributor guide
Research direction
Start in app/components/Nav/Main/RootRPCMethodsUI.js at the DAPP request message listeners and the onUnapprovedTransaction, toggleApproveModal, and toggleDappTransactionModal functions. Trace all related transfer and approval code before deciding what belongs in the new hook. Done means the functionality remains unchanged and the refactored behavior has good unit test coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native, typescript
- Domain
- frontend, mobile
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100