chore: remove hardcoded NFT chain allowlist from NftDetectionController#8180
Open
chore: remove hardcoded NFT chain allowlist from NftDetectionController#8180
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Summary
As part of the NFT provider migration plan, this PR removes the hardcoded
supportedNftDetectionNetworksallowlist fromNftDetectionControllerand delegates chain support validation to the server instead.Changes
supportedNftDetectionNetworks: Drops the staticSet<Hex>that previously allowed only 8 specific chains (Mainnet, BSC, Polygon, Avalanche, Linea, Base, Sei, Monad) through NFT detection. Detection now passes all provided chain IDs directly to the API.detectNfts: The pre-API filter that dropped unsupported chains before calling#getOwnerNftshas been removed.chainIdsis now passed through unmodified, allowing the server to decide what to return.#getOwnerNfts: Chains that convert to decimal'0'(non-EVM/invalid chains) are filtered out before making the API call, and if all chains are non-EVM, the method returns{ tokens: [], continuation: null }early — avoiding a pointless API round-trip.continuationtype: UpdatedReservoirResponse.continuationfromstring | undefinedtostring | nullto match the updated server response shape.Motivation
Keeping a hardcoded chain allowlist in the Core package tightly coupled backend and frontend release cycles — adding support for a new chain required coordinated changes in both places simultaneously. The backend change in
va-mmcx-nft-api#221updates the NFT API to return[]instead of an error for unsupported chains. With that in place, the Core package no longer needs to know which chains are supported, enabling each side to evolve independently going forward.Testing
NftDetectionControllertests should continue to pass.Merge checklist
va-mmcx-nft-api#221is merged and deployed to productionReferences
https://consensyssoftware.atlassian.net/browse/ASSETS-2899
Checklist
Note
Medium Risk
Behavior now depends on the backend returning empty results (not errors) for unsupported chains, and changes request scoping/filtering for multi-chain NFT detection.
Overview
NftDetectionControllerno longer hardcodes asupportedNftDetectionNetworksallowlist;detectNftsnow sends whateverchainIdsit’s given to the NFT API (relying on the server to return empty results for unsupported chains).To avoid pointless requests,
#getOwnerNftsnow filters out non-EVM chain IDs (hex that convert to decimal0) and short-circuits with an empty{ tokens: [], continuation: null }response when nothing remains. TheReservoirResponse.continuationtype is updated tostring | nullto match the API response shape, and the changelog is updated accordingly.Written by Cursor Bugbot for commit 1be56af. This will update automatically on new commits. Configure here.