MetaMask / MetaMask/core

NftDetectionController: Refactor

Open
#1,607 0 comments 0 reactions 0 assignees View on GitHub
team-assets team-wallet-framework wf-controller-tech-debt
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

The `detectNfts` method has a [cyclomatic complexity](https://kyleshevlin.com/managing-cyclomatic-complexity) of 16 which is due to the logic to normalize data from the OpenSea API. The code to make the request as well as the normalization code should be extracted to separate files so that it is easier to understand and test.

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate NftDetectionController and its detectNfts method, then trace the OpenSea API request and the normalization logic it performs. Extract those responsibilities into separate files and add or update tests so the request and normalization behavior remain covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.