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

Disable Swaps on Rinkeby for production (#14372)

* Disable Swaps in Rinkeby for production

* Use arrays instead of objects for allowed chain ids

* Trigger Build
This commit is contained in:
Daniel 2022-04-14 17:02:38 +02:00 committed by GitHub
parent 99461941f8
commit 9403ee9c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -114,14 +114,18 @@ const RINKEBY_DEFAULT_BLOCK_EXPLORER_URL = 'https://rinkeby.etherscan.io/';
const POLYGON_DEFAULT_BLOCK_EXPLORER_URL = 'https://polygonscan.com/';
const AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL = 'https://snowtrace.io/';
export const ALLOWED_SWAPS_CHAIN_IDS = {
[MAINNET_CHAIN_ID]: true,
[SWAPS_TESTNET_CHAIN_ID]: true,
[BSC_CHAIN_ID]: true,
[POLYGON_CHAIN_ID]: true,
[RINKEBY_CHAIN_ID]: true,
[AVALANCHE_CHAIN_ID]: true,
};
export const ALLOWED_PROD_SWAPS_CHAIN_IDS = [
MAINNET_CHAIN_ID,
SWAPS_TESTNET_CHAIN_ID,
BSC_CHAIN_ID,
POLYGON_CHAIN_ID,
AVALANCHE_CHAIN_ID,
];
export const ALLOWED_DEV_SWAPS_CHAIN_IDS = [
...ALLOWED_PROD_SWAPS_CHAIN_IDS,
RINKEBY_CHAIN_ID,
];
export const ALLOWED_SMART_TRANSACTIONS_CHAIN_IDS = [
MAINNET_CHAIN_ID,

View File

@ -37,7 +37,8 @@ import { TRUNCATED_NAME_CHAR_LIMIT } from '../../shared/constants/labels';
import {
SWAPS_CHAINID_DEFAULT_TOKEN_MAP,
ALLOWED_SWAPS_CHAIN_IDS,
ALLOWED_PROD_SWAPS_CHAIN_IDS,
ALLOWED_DEV_SWAPS_CHAIN_IDS,
} from '../../shared/constants/swaps';
import { shortenAddress, getAccountByAddress } from '../helpers/utils/util';
@ -666,7 +667,10 @@ export function getSwapsDefaultToken(state) {
export function getIsSwapsChain(state) {
const chainId = getCurrentChainId(state);
return ALLOWED_SWAPS_CHAIN_IDS[chainId];
const isProduction = process.env.METAMASK_ENVIRONMENT === 'production';
return isProduction
? ALLOWED_PROD_SWAPS_CHAIN_IDS.includes(chainId)
: ALLOWED_DEV_SWAPS_CHAIN_IDS.includes(chainId);
}
export function getIsBuyableChain(state) {