chore: remove collection API calls from NFT detection process #6762
+40
−949
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
Background
While investigating ASSETS-1346 to improve NFT detection performance in Mobile and Extension, I identified a significant performance bottleneck in our API call pattern.
Current Implementation Issues
Our NFT detection process was making inefficient API calls:
Analysis
The collections API calls were used to append the following data to token responses:
However, due to our recent provider migration, only 3 of these 5 fields are currently utilized:
Solution
After discussion with @Prithpal-Sooriya and @alfeng6, we determined that removing the collections API calls provides significant performance benefits that outweigh the loss of these 3 data fields.
Impact
contractDeployedAt
,creator
, andtopBid
This change prioritizes performance optimization over supplementary metadata that has limited current usage.
References
Issue: https://consensyssoftware.atlassian.net/browse/ASSETS-1346
Checklist
Note
Eliminates collection endpoint requests in NFT detection, simplifying logic and tests while updating the changelog to note the performance optimization and removed collection metadata fields.
NftDetectionController
by removing collection fetches (/collections
) and related batching logic; stops enriching tokens with collection fields and dropsMAX_GET_COLLECTION_BATCH_SIZE
.getCollections
-related test cases; adjust expectations to not rely on collection metadata.contractDeployedAt
,creator
,topBid
).packages/assets-controllers/src/NftDetectionController.test.ts
.Written by Cursor Bugbot for commit f3ebac9. This will update automatically on new commits. Configure here.