From 7d3b1d08da3d11505ef4fcd2f3cc833514cc10da Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 8 Dec 2022 11:37:47 -0600 Subject: [PATCH] NFTs: Update COLLECTIBLES_V1 to NFTS_V1 (#16851) --- .metamaskrc.dist | 2 +- app/scripts/metamask-controller.js | 4 ++-- development/build/config.js | 2 +- development/build/scripts.js | 2 +- ui/components/app/wallet-overview/token-overview.js | 2 +- ui/components/app/wallet-overview/token-overview.test.js | 4 ++-- ui/ducks/send/send.js | 2 +- ui/ducks/send/send.test.js | 4 ++-- ui/helpers/constants/settings.js | 4 ++-- ui/pages/home/home.component.js | 2 +- ui/pages/import-token/import-token.component.js | 2 +- ui/pages/import-token/import-token.test.js | 2 +- ui/pages/routes/routes.component.js | 2 +- .../settings/experimental-tab/experimental-tab.component.js | 4 ++-- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.metamaskrc.dist b/.metamaskrc.dist index cfb23e1b1..7077de494 100644 --- a/.metamaskrc.dist +++ b/.metamaskrc.dist @@ -4,7 +4,7 @@ INFURA_PROJECT_ID=00000000000 SEGMENT_WRITE_KEY= ONBOARDING_V2= SWAPS_USE_DEV_APIS= -COLLECTIBLES_V1= +NFTS_V1= PUBNUB_PUB_KEY= PUBNUB_SUB_KEY= TOKEN_ALLOWANCE_IMPROVEMENTS= diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 6a7dd7eb7..fbabf61b8 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -376,7 +376,7 @@ export default class MetamaskController extends EventEmitter { this.nftController.setApiKey(process.env.OPENSEA_KEY); - process.env.COLLECTIBLES_V1 && + process.env.NFTS_V1 && (this.nftDetectionController = new NftDetectionController({ onNftsStateChange: (listener) => this.nftController.subscribe(listener), onPreferencesStateChange: @@ -2053,7 +2053,7 @@ export default class MetamaskController extends EventEmitter { ), // DetectCollectibleController - detectNfts: process.env.COLLECTIBLES_V1 + detectNfts: process.env.NFTS_V1 ? nftDetectionController.detectNfts.bind(nftDetectionController) : null, diff --git a/development/build/config.js b/development/build/config.js index be3777695..328412f59 100644 --- a/development/build/config.js +++ b/development/build/config.js @@ -7,7 +7,7 @@ const commonConfigurationPropertyNames = ['PUBNUB_PUB_KEY', 'PUBNUB_SUB_KEY']; const configurationPropertyNames = [ ...commonConfigurationPropertyNames, - 'COLLECTIBLES_V1', + 'NFTS_V1', 'INFURA_PROJECT_ID', 'ONBOARDING_V2', 'PHISHING_WARNING_PAGE_URL', diff --git a/development/build/scripts.js b/development/build/scripts.js index eff0fac92..083e9bbcf 100644 --- a/development/build/scripts.js +++ b/development/build/scripts.js @@ -1018,7 +1018,7 @@ async function getEnvironmentVariables({ buildTarget, buildType, version }) { const iconNames = await generateIconNames(); return { ICON_NAMES: iconNames, - COLLECTIBLES_V1: config.COLLECTIBLES_V1 === '1', + NFTS_V1: config.NFTS_V1 === '1', CONF: devMode ? config : {}, IN_TEST: testing, INFURA_PROJECT_ID: getInfuraProjectId({ diff --git a/ui/components/app/wallet-overview/token-overview.js b/ui/components/app/wallet-overview/token-overview.js index 3905c0f11..f701bb308 100644 --- a/ui/components/app/wallet-overview/token-overview.js +++ b/ui/components/app/wallet-overview/token-overview.js @@ -75,7 +75,7 @@ const TokenOverview = ({ className, token }) => { isTokenBuyableWyre; useEffect(() => { - if (token.isERC721 && process.env.COLLECTIBLES_V1) { + if (token.isERC721 && process.env.NFTS_V1) { dispatch( showModal({ name: 'CONVERT_TOKEN_TO_NFT', diff --git a/ui/components/app/wallet-overview/token-overview.test.js b/ui/components/app/wallet-overview/token-overview.test.js index 2a801cadd..f29e4dcd2 100644 --- a/ui/components/app/wallet-overview/token-overview.test.js +++ b/ui/components/app/wallet-overview/token-overview.test.js @@ -55,7 +55,7 @@ describe('TokenOverview', () => { }); it('should show ConvertTokenToNFT modal when token passed in props is an ERC721', () => { - process.env.COLLECTIBLES_V1 = true; + process.env.NFTS_V1 = true; const token = { name: 'test', isERC721: true, @@ -71,7 +71,7 @@ describe('TokenOverview', () => { name: 'CONVERT_TOKEN_TO_NFT', tokenAddress: '0x01', }); - process.env.COLLECTIBLES_V1 = false; + process.env.NFTS_V1 = false; }); }); }); diff --git a/ui/ducks/send/send.js b/ui/ducks/send/send.js index 576ad544d..bf96a4612 100644 --- a/ui/ducks/send/send.js +++ b/ui/ducks/send/send.js @@ -2077,7 +2077,7 @@ export function updateSendAsset( details.standard === TOKEN_STANDARDS.ERC1155 || details.standard === TOKEN_STANDARDS.ERC721 ) { - if (type === ASSET_TYPES.TOKEN && process.env.COLLECTIBLES_V1) { + if (type === ASSET_TYPES.TOKEN && process.env.NFTS_V1) { dispatch( showModal({ name: 'CONVERT_TOKEN_TO_NFT', diff --git a/ui/ducks/send/send.test.js b/ui/ducks/send/send.test.js index 50613b89b..285a593aa 100644 --- a/ui/ducks/send/send.test.js +++ b/ui/ducks/send/send.test.js @@ -1711,7 +1711,7 @@ describe('Send Slice', () => { }); it('should show ConvertTokenToNFT modal and throw "invalidAssetType" error when token passed in props is an ERC721 or ERC1155', async () => { - process.env.COLLECTIBLES_V1 = true; + process.env.NFTS_V1 = true; getTokenStandardAndDetailsStub.mockImplementation(() => Promise.resolve({ standard: 'ERC1155', balance: '0x1' }), ); @@ -1740,7 +1740,7 @@ describe('Send Slice', () => { }, type: 'UI_MODAL_OPEN', }); - process.env.COLLECTIBLES_V1 = false; + process.env.NFTS_V1 = false; }); }); diff --git a/ui/helpers/constants/settings.js b/ui/helpers/constants/settings.js index f53fed4a0..e67e91153 100644 --- a/ui/helpers/constants/settings.js +++ b/ui/helpers/constants/settings.js @@ -312,7 +312,7 @@ export const SETTINGS_CONSTANTS = [ descriptionMessage: (t) => t('enableOpenSeaAPIDescription'), route: `${EXPERIMENTAL_ROUTE}#opensea-api`, icon: 'fa fa-flask', - featureFlag: 'COLLECTIBLES_V1', + featureFlag: 'NFTS_V1', }, { tabMessage: (t) => t('experimental'), @@ -320,7 +320,7 @@ export const SETTINGS_CONSTANTS = [ descriptionMessage: (t) => t('useCollectibleDetectionDescription'), route: `${EXPERIMENTAL_ROUTE}#autodetect-nfts`, icon: 'fa fa-flask', - featureFlag: 'COLLECTIBLES_V1', + featureFlag: 'NFTS_V1', }, { tabMessage: (t) => t('advanced'), diff --git a/ui/pages/home/home.component.js b/ui/pages/home/home.component.js index 718c5174f..5e70a6d16 100644 --- a/ui/pages/home/home.component.js +++ b/ui/pages/home/home.component.js @@ -695,7 +695,7 @@ export default class Home extends PureComponent { } /> - {process.env.COLLECTIBLES_V1 ? ( + {process.env.NFTS_V1 ? ( { }); it('sets and error when a token is an NFT', async () => { - process.env.COLLECTIBLES_V1 = true; + process.env.NFTS_V1 = true; getTokenStandardAndDetails.mockImplementation(() => Promise.resolve({ standard: 'ERC721' }), ); diff --git a/ui/pages/routes/routes.component.js b/ui/pages/routes/routes.component.js index ecfed0fe8..24176bd23 100644 --- a/ui/pages/routes/routes.component.js +++ b/ui/pages/routes/routes.component.js @@ -221,7 +221,7 @@ export default class Routes extends Component { component={ImportTokenPage} exact /> - {process.env.COLLECTIBLES_V1 ? ( + {process.env.NFTS_V1 ? (