MetaMask / MetaMask/metamask-mobile

Refactor DAPP Transfer / Approval related code in RootRPCMethodsUI

Open
#5,569 1 comment 0 reactions 0 assignees View on GitHub
area-transactions team-confirmations-planning type-pinned type-tech-debt
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.