1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

NFTs: Update COLLECTIBLES_V1 to NFTS_V1 (#16851)

This commit is contained in:
David Walsh 2022-12-08 11:37:47 -06:00 committed by GitHub
parent 43c278d813
commit 7d3b1d08da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 19 additions and 19 deletions

View File

@ -4,7 +4,7 @@ INFURA_PROJECT_ID=00000000000
SEGMENT_WRITE_KEY= SEGMENT_WRITE_KEY=
ONBOARDING_V2= ONBOARDING_V2=
SWAPS_USE_DEV_APIS= SWAPS_USE_DEV_APIS=
COLLECTIBLES_V1= NFTS_V1=
PUBNUB_PUB_KEY= PUBNUB_PUB_KEY=
PUBNUB_SUB_KEY= PUBNUB_SUB_KEY=
TOKEN_ALLOWANCE_IMPROVEMENTS= TOKEN_ALLOWANCE_IMPROVEMENTS=

View File

@ -376,7 +376,7 @@ export default class MetamaskController extends EventEmitter {
this.nftController.setApiKey(process.env.OPENSEA_KEY); this.nftController.setApiKey(process.env.OPENSEA_KEY);
process.env.COLLECTIBLES_V1 && process.env.NFTS_V1 &&
(this.nftDetectionController = new NftDetectionController({ (this.nftDetectionController = new NftDetectionController({
onNftsStateChange: (listener) => this.nftController.subscribe(listener), onNftsStateChange: (listener) => this.nftController.subscribe(listener),
onPreferencesStateChange: onPreferencesStateChange:
@ -2053,7 +2053,7 @@ export default class MetamaskController extends EventEmitter {
), ),
// DetectCollectibleController // DetectCollectibleController
detectNfts: process.env.COLLECTIBLES_V1 detectNfts: process.env.NFTS_V1
? nftDetectionController.detectNfts.bind(nftDetectionController) ? nftDetectionController.detectNfts.bind(nftDetectionController)
: null, : null,

View File

@ -7,7 +7,7 @@ const commonConfigurationPropertyNames = ['PUBNUB_PUB_KEY', 'PUBNUB_SUB_KEY'];
const configurationPropertyNames = [ const configurationPropertyNames = [
...commonConfigurationPropertyNames, ...commonConfigurationPropertyNames,
'COLLECTIBLES_V1', 'NFTS_V1',
'INFURA_PROJECT_ID', 'INFURA_PROJECT_ID',
'ONBOARDING_V2', 'ONBOARDING_V2',
'PHISHING_WARNING_PAGE_URL', 'PHISHING_WARNING_PAGE_URL',

View File

@ -1018,7 +1018,7 @@ async function getEnvironmentVariables({ buildTarget, buildType, version }) {
const iconNames = await generateIconNames(); const iconNames = await generateIconNames();
return { return {
ICON_NAMES: iconNames, ICON_NAMES: iconNames,
COLLECTIBLES_V1: config.COLLECTIBLES_V1 === '1', NFTS_V1: config.NFTS_V1 === '1',
CONF: devMode ? config : {}, CONF: devMode ? config : {},
IN_TEST: testing, IN_TEST: testing,
INFURA_PROJECT_ID: getInfuraProjectId({ INFURA_PROJECT_ID: getInfuraProjectId({

View File

@ -75,7 +75,7 @@ const TokenOverview = ({ className, token }) => {
isTokenBuyableWyre; isTokenBuyableWyre;
useEffect(() => { useEffect(() => {
if (token.isERC721 && process.env.COLLECTIBLES_V1) { if (token.isERC721 && process.env.NFTS_V1) {
dispatch( dispatch(
showModal({ showModal({
name: 'CONVERT_TOKEN_TO_NFT', name: 'CONVERT_TOKEN_TO_NFT',

View File

@ -55,7 +55,7 @@ describe('TokenOverview', () => {
}); });
it('should show ConvertTokenToNFT modal when token passed in props is an ERC721', () => { 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 = { const token = {
name: 'test', name: 'test',
isERC721: true, isERC721: true,
@ -71,7 +71,7 @@ describe('TokenOverview', () => {
name: 'CONVERT_TOKEN_TO_NFT', name: 'CONVERT_TOKEN_TO_NFT',
tokenAddress: '0x01', tokenAddress: '0x01',
}); });
process.env.COLLECTIBLES_V1 = false; process.env.NFTS_V1 = false;
}); });
}); });
}); });

View File

@ -2077,7 +2077,7 @@ export function updateSendAsset(
details.standard === TOKEN_STANDARDS.ERC1155 || details.standard === TOKEN_STANDARDS.ERC1155 ||
details.standard === TOKEN_STANDARDS.ERC721 details.standard === TOKEN_STANDARDS.ERC721
) { ) {
if (type === ASSET_TYPES.TOKEN && process.env.COLLECTIBLES_V1) { if (type === ASSET_TYPES.TOKEN && process.env.NFTS_V1) {
dispatch( dispatch(
showModal({ showModal({
name: 'CONVERT_TOKEN_TO_NFT', name: 'CONVERT_TOKEN_TO_NFT',

View File

@ -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 () => { 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(() => getTokenStandardAndDetailsStub.mockImplementation(() =>
Promise.resolve({ standard: 'ERC1155', balance: '0x1' }), Promise.resolve({ standard: 'ERC1155', balance: '0x1' }),
); );
@ -1740,7 +1740,7 @@ describe('Send Slice', () => {
}, },
type: 'UI_MODAL_OPEN', type: 'UI_MODAL_OPEN',
}); });
process.env.COLLECTIBLES_V1 = false; process.env.NFTS_V1 = false;
}); });
}); });

View File

@ -312,7 +312,7 @@ export const SETTINGS_CONSTANTS = [
descriptionMessage: (t) => t('enableOpenSeaAPIDescription'), descriptionMessage: (t) => t('enableOpenSeaAPIDescription'),
route: `${EXPERIMENTAL_ROUTE}#opensea-api`, route: `${EXPERIMENTAL_ROUTE}#opensea-api`,
icon: 'fa fa-flask', icon: 'fa fa-flask',
featureFlag: 'COLLECTIBLES_V1', featureFlag: 'NFTS_V1',
}, },
{ {
tabMessage: (t) => t('experimental'), tabMessage: (t) => t('experimental'),
@ -320,7 +320,7 @@ export const SETTINGS_CONSTANTS = [
descriptionMessage: (t) => t('useCollectibleDetectionDescription'), descriptionMessage: (t) => t('useCollectibleDetectionDescription'),
route: `${EXPERIMENTAL_ROUTE}#autodetect-nfts`, route: `${EXPERIMENTAL_ROUTE}#autodetect-nfts`,
icon: 'fa fa-flask', icon: 'fa fa-flask',
featureFlag: 'COLLECTIBLES_V1', featureFlag: 'NFTS_V1',
}, },
{ {
tabMessage: (t) => t('advanced'), tabMessage: (t) => t('advanced'),

View File

@ -695,7 +695,7 @@ export default class Home extends PureComponent {
} }
/> />
</Tab> </Tab>
{process.env.COLLECTIBLES_V1 ? ( {process.env.NFTS_V1 ? (
<Tab <Tab
activeClassName="home__tab--active" activeClassName="home__tab--active"
className="home__tab" className="home__tab"

View File

@ -306,7 +306,7 @@ class ImportToken extends Component {
}); });
break; break;
case process.env.COLLECTIBLES_V1 && case process.env.NFTS_V1 &&
(standard === 'ERC1155' || standard === 'ERC721'): (standard === 'ERC1155' || standard === 'ERC721'):
this.setState({ this.setState({
collectibleAddressError: this.context.t('collectibleAddressError', [ collectibleAddressError: this.context.t('collectibleAddressError', [

View File

@ -152,7 +152,7 @@ describe('Import Token', () => {
}); });
it('sets and error when a token is an NFT', async () => { it('sets and error when a token is an NFT', async () => {
process.env.COLLECTIBLES_V1 = true; process.env.NFTS_V1 = true;
getTokenStandardAndDetails.mockImplementation(() => getTokenStandardAndDetails.mockImplementation(() =>
Promise.resolve({ standard: 'ERC721' }), Promise.resolve({ standard: 'ERC721' }),
); );

View File

@ -221,7 +221,7 @@ export default class Routes extends Component {
component={ImportTokenPage} component={ImportTokenPage}
exact exact
/> />
{process.env.COLLECTIBLES_V1 ? ( {process.env.NFTS_V1 ? (
<Authenticated <Authenticated
path={ADD_COLLECTIBLE_ROUTE} path={ADD_COLLECTIBLE_ROUTE}
component={AddCollectiblePage} component={AddCollectiblePage}

View File

@ -48,7 +48,7 @@ export default class ExperimentalTab extends PureComponent {
} }
renderCollectibleDetectionToggle() { renderCollectibleDetectionToggle() {
if (!process.env.COLLECTIBLES_V1) { if (!process.env.NFTS_V1) {
return null; return null;
} }
@ -99,7 +99,7 @@ export default class ExperimentalTab extends PureComponent {
} }
renderOpenSeaEnabledToggle() { renderOpenSeaEnabledToggle() {
if (!process.env.COLLECTIBLES_V1) { if (!process.env.NFTS_V1) {
return null; return null;
} }
const { t } = this.context; const { t } = this.context;