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

Replace Rinkeby with Goerli for dev testing (#15781)

This commit is contained in:
Daniel 2022-09-12 13:11:29 +02:00 committed by GitHub
parent e8232aa714
commit 34e2faaf49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 49 additions and 92 deletions

View File

@ -1974,9 +1974,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Πολύγωνο"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -2127,12 +2127,12 @@
"networkNameEthereum": {
"message": "Ethereum"
},
"networkNameGoerli": {
"message": "Goerli"
},
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Red de prueba"
},

View File

@ -1703,9 +1703,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Red de prueba"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "बहुभुज"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "テストネット"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "테스트넷"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -1687,9 +1687,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Тестовая сеть"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -2001,9 +2001,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Mạng thử nghiệm"
},

View File

@ -2004,9 +2004,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -1654,9 +1654,6 @@
"networkNamePolygon": {
"message": "Polygon"
},
"networkNameRinkeby": {
"message": "Rinkeby"
},
"networkNameTestnet": {
"message": "Testnet"
},

View File

@ -9,7 +9,7 @@ import {
POLYGON_CHAIN_ID,
MATIC_SYMBOL,
MATIC_TOKEN_IMAGE_URL,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
AVALANCHE_CHAIN_ID,
AVALANCHE_SYMBOL,
AVAX_TOKEN_IMAGE_URL,
@ -66,7 +66,7 @@ export const TEST_ETH_SWAPS_TOKEN_OBJECT = {
iconUrl: TEST_ETH_TOKEN_IMAGE_URL,
};
export const RINKEBY_SWAPS_TOKEN_OBJECT = {
export const GOERLI_SWAPS_TOKEN_OBJECT = {
symbol: ETH_SYMBOL,
name: 'Ether',
address: DEFAULT_TOKEN_ADDRESS,
@ -90,8 +90,8 @@ const AVALANCHE_CONTRACT_ADDRESS = '0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31';
export const WETH_CONTRACT_ADDRESS =
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
export const WETH_RINKEBY_CONTRACT_ADDRESS =
'0xc778417e063141139fce010982780140aa0cd5ab';
export const WETH_GOERLI_CONTRACT_ADDRESS =
'0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6';
export const WBNB_CONTRACT_ADDRESS =
'0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c';
export const WMATIC_CONTRACT_ADDRESS =
@ -110,7 +110,7 @@ export const GAS_DEV_API_BASE_URL =
const BSC_DEFAULT_BLOCK_EXPLORER_URL = 'https://bscscan.com/';
const MAINNET_DEFAULT_BLOCK_EXPLORER_URL = 'https://etherscan.io/';
const RINKEBY_DEFAULT_BLOCK_EXPLORER_URL = 'https://rinkeby.etherscan.io/';
const GOERLI_DEFAULT_BLOCK_EXPLORER_URL = 'https://goerli.etherscan.io/';
const POLYGON_DEFAULT_BLOCK_EXPLORER_URL = 'https://polygonscan.com/';
const AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL = 'https://snowtrace.io/';
@ -124,12 +124,12 @@ export const ALLOWED_PROD_SWAPS_CHAIN_IDS = [
export const ALLOWED_DEV_SWAPS_CHAIN_IDS = [
...ALLOWED_PROD_SWAPS_CHAIN_IDS,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
];
export const ALLOWED_SMART_TRANSACTIONS_CHAIN_IDS = [
MAINNET_CHAIN_ID,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
];
export const SWAPS_CHAINID_CONTRACT_ADDRESS_MAP = {
@ -137,7 +137,7 @@ export const SWAPS_CHAINID_CONTRACT_ADDRESS_MAP = {
[SWAPS_TESTNET_CHAIN_ID]: TESTNET_CONTRACT_ADDRESS,
[BSC_CHAIN_ID]: BSC_CONTRACT_ADDRESS,
[POLYGON_CHAIN_ID]: POLYGON_CONTRACT_ADDRESS,
[RINKEBY_CHAIN_ID]: TESTNET_CONTRACT_ADDRESS,
[GOERLI_CHAIN_ID]: TESTNET_CONTRACT_ADDRESS,
[AVALANCHE_CHAIN_ID]: AVALANCHE_CONTRACT_ADDRESS,
};
@ -146,7 +146,7 @@ export const SWAPS_WRAPPED_TOKENS_ADDRESSES = {
[SWAPS_TESTNET_CHAIN_ID]: WETH_CONTRACT_ADDRESS,
[BSC_CHAIN_ID]: WBNB_CONTRACT_ADDRESS,
[POLYGON_CHAIN_ID]: WMATIC_CONTRACT_ADDRESS,
[RINKEBY_CHAIN_ID]: WETH_RINKEBY_CONTRACT_ADDRESS,
[GOERLI_CHAIN_ID]: WETH_GOERLI_CONTRACT_ADDRESS,
[AVALANCHE_CHAIN_ID]: WAVAX_CONTRACT_ADDRESS,
};
@ -159,9 +159,9 @@ export const ALLOWED_CONTRACT_ADDRESSES = {
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[SWAPS_TESTNET_CHAIN_ID],
SWAPS_WRAPPED_TOKENS_ADDRESSES[SWAPS_TESTNET_CHAIN_ID],
],
[RINKEBY_CHAIN_ID]: [
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[RINKEBY_CHAIN_ID],
SWAPS_WRAPPED_TOKENS_ADDRESSES[RINKEBY_CHAIN_ID],
[GOERLI_CHAIN_ID]: [
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[GOERLI_CHAIN_ID],
SWAPS_WRAPPED_TOKENS_ADDRESSES[GOERLI_CHAIN_ID],
],
[BSC_CHAIN_ID]: [
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[BSC_CHAIN_ID],
@ -182,7 +182,7 @@ export const SWAPS_CHAINID_DEFAULT_TOKEN_MAP = {
[SWAPS_TESTNET_CHAIN_ID]: TEST_ETH_SWAPS_TOKEN_OBJECT,
[BSC_CHAIN_ID]: BNB_SWAPS_TOKEN_OBJECT,
[POLYGON_CHAIN_ID]: MATIC_SWAPS_TOKEN_OBJECT,
[RINKEBY_CHAIN_ID]: RINKEBY_SWAPS_TOKEN_OBJECT,
[GOERLI_CHAIN_ID]: GOERLI_SWAPS_TOKEN_OBJECT,
[AVALANCHE_CHAIN_ID]: AVAX_SWAPS_TOKEN_OBJECT,
};
@ -190,14 +190,14 @@ export const SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP = {
[BSC_CHAIN_ID]: BSC_DEFAULT_BLOCK_EXPLORER_URL,
[MAINNET_CHAIN_ID]: MAINNET_DEFAULT_BLOCK_EXPLORER_URL,
[POLYGON_CHAIN_ID]: POLYGON_DEFAULT_BLOCK_EXPLORER_URL,
[RINKEBY_CHAIN_ID]: RINKEBY_DEFAULT_BLOCK_EXPLORER_URL,
[GOERLI_CHAIN_ID]: GOERLI_DEFAULT_BLOCK_EXPLORER_URL,
[AVALANCHE_CHAIN_ID]: AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL,
};
export const ETHEREUM = 'ethereum';
export const POLYGON = 'polygon';
export const BSC = 'bsc';
export const RINKEBY = 'rinkeby';
export const GOERLI = 'goerli';
export const AVALANCHE = 'avalanche';
export const SWAPS_CLIENT_ID = 'extension';

View File

@ -5,7 +5,7 @@ import { setSwapsLiveness, setSwapsFeatureFlags } from '../../store/actions';
import { setStorageItem } from '../../helpers/utils/storage-helpers';
import {
MAINNET_CHAIN_ID,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
BSC_CHAIN_ID,
POLYGON_CHAIN_ID,
} from '../../../shared/constants/network';
@ -280,9 +280,9 @@ describe('Ducks - Swaps', () => {
expect(swaps.getSmartTransactionsEnabled(state)).toBe(false);
});
it('returns true if feature flag is enabled, not a HW and is Rinkeby network', () => {
it('returns true if feature flag is enabled, not a HW and is Goerli network', () => {
const state = createSwapsMockStore();
state.metamask.provider.chainId = RINKEBY_CHAIN_ID;
state.metamask.provider.chainId = GOERLI_CHAIN_ID;
expect(swaps.getSmartTransactionsEnabled(state)).toBe(true);
});

View File

@ -26,6 +26,7 @@ import {
BSC_CHAIN_ID,
POLYGON_CHAIN_ID,
AVALANCHE_CHAIN_ID,
GOERLI_CHAIN_ID,
} from '../../shared/constants/network';
import { useEqualityCheck } from './useEqualityCheck';
@ -66,13 +67,20 @@ export function getRenderableTokenData(
)
: '';
const chainIdForTokenIcons =
chainId === GOERLI_CHAIN_ID ? MAINNET_CHAIN_ID : chainId;
const tokenIconUrl =
(symbol === ETH_SYMBOL && chainId === MAINNET_CHAIN_ID) ||
(symbol === ETH_SYMBOL && chainId === GOERLI_CHAIN_ID) ||
(symbol === BNB_SYMBOL && chainId === BSC_CHAIN_ID) ||
(symbol === MATIC_SYMBOL && chainId === POLYGON_CHAIN_ID) ||
(symbol === AVALANCHE_SYMBOL && chainId === AVALANCHE_CHAIN_ID)
? iconUrl
: formatIconUrlWithProxy({ chainId, tokenAddress: address || '' });
: formatIconUrlWithProxy({
chainId: chainIdForTokenIcons,
tokenAddress: address || '',
});
const usedIconUrl = tokenIconUrl || token?.image;
return {

View File

@ -7,7 +7,7 @@ import {
BSC_CHAIN_ID,
LOCALHOST_CHAIN_ID,
POLYGON_CHAIN_ID,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
AVALANCHE_CHAIN_ID,
} from '../../../../shared/constants/network';
import TransactionDetail from '../../../components/app/transaction-detail/transaction-detail.component';
@ -48,8 +48,8 @@ export default function FeeCard({
return t('networkNamePolygon');
case LOCALHOST_CHAIN_ID:
return t('networkNameTestnet');
case RINKEBY_CHAIN_ID:
return t('networkNameRinkeby');
case GOERLI_CHAIN_ID:
return t('networkNameGoerli');
case AVALANCHE_CHAIN_ID:
return t('networkNameAvalanche');
default:

View File

@ -8,7 +8,7 @@ import {
ETHEREUM,
POLYGON,
BSC,
RINKEBY,
GOERLI,
AVALANCHE,
SWAPS_API_V2_BASE_URL,
SWAPS_DEV_API_V2_BASE_URL,
@ -26,7 +26,7 @@ import {
BSC_CHAIN_ID,
POLYGON_CHAIN_ID,
LOCALHOST_CHAIN_ID,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
ETH_SYMBOL,
AVALANCHE_CHAIN_ID,
} from '../../../shared/constants/network';
@ -82,7 +82,7 @@ const getBaseUrlForNewSwapsApi = (type, chainId) => {
return `${v2ApiBaseUrl}/networks/${chainIdDecimal}`;
};
const TEST_CHAIN_IDS = [RINKEBY_CHAIN_ID, LOCALHOST_CHAIN_ID];
const TEST_CHAIN_IDS = [GOERLI_CHAIN_ID, LOCALHOST_CHAIN_ID];
export const getBaseApi = function (type, chainId = MAINNET_CHAIN_ID) {
// eslint-disable-next-line no-param-reassign
@ -874,8 +874,8 @@ export const getNetworkNameByChainId = (chainId) => {
return BSC;
case POLYGON_CHAIN_ID:
return POLYGON;
case RINKEBY_CHAIN_ID:
return RINKEBY;
case GOERLI_CHAIN_ID:
return GOERLI;
case AVALANCHE_CHAIN_ID:
return AVALANCHE;
default:
@ -892,8 +892,8 @@ export const getNetworkNameByChainId = (chainId) => {
*/
export const getSwapsLivenessForNetwork = (swapsFeatureFlags = {}, chainId) => {
const networkName = getNetworkNameByChainId(chainId);
// Use old APIs for testnet and Rinkeby.
if ([LOCALHOST_CHAIN_ID, RINKEBY_CHAIN_ID].includes(chainId)) {
// Use old APIs for testnet and Goerli.
if ([LOCALHOST_CHAIN_ID, GOERLI_CHAIN_ID].includes(chainId)) {
return {
swapsFeatureIsLive: true,
};

View File

@ -5,7 +5,7 @@ import {
BSC_CHAIN_ID,
POLYGON_CHAIN_ID,
LOCALHOST_CHAIN_ID,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
KOVAN_CHAIN_ID,
AVALANCHE_CHAIN_ID,
ETH_SYMBOL,
@ -19,7 +19,7 @@ import {
ETHEREUM,
POLYGON,
BSC,
RINKEBY,
GOERLI,
AVALANCHE,
} from '../../../shared/constants/swaps';
import {
@ -273,11 +273,11 @@ describe('Swaps Util', () => {
).toBe(true);
});
it('returns true if "to" is Rinkeby contract address on Rinkeby network', () => {
it('returns true if "to" is Goerli contract address on Goerli network', () => {
usedTradeTxParams.to =
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[RINKEBY_CHAIN_ID];
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[GOERLI_CHAIN_ID];
expect(
isContractAddressValid(usedTradeTxParams.to, RINKEBY_CHAIN_ID),
isContractAddressValid(usedTradeTxParams.to, GOERLI_CHAIN_ID),
).toBe(true);
});
@ -317,8 +317,8 @@ describe('Swaps Util', () => {
expect(getNetworkNameByChainId(POLYGON_CHAIN_ID)).toBe(POLYGON);
});
it('returns "rinkeby" for Rinkeby chain ID', () => {
expect(getNetworkNameByChainId(RINKEBY_CHAIN_ID)).toBe(RINKEBY);
it('returns "goerli" for Goerli chain ID', () => {
expect(getNetworkNameByChainId(GOERLI_CHAIN_ID)).toBe(GOERLI);
});
it('returns "avalanche" for Avalanche chain ID', () => {
@ -343,14 +343,14 @@ describe('Swaps Util', () => {
).toMatchObject(expectedSwapsLiveness);
});
it('returns info that Swaps are enabled and cannot use API v2 for Rinkeby chain ID', () => {
it('returns info that Swaps are enabled and cannot use API v2 for Goerli chain ID', () => {
const expectedSwapsLiveness = {
swapsFeatureIsLive: true,
};
expect(
getSwapsLivenessForNetwork(
MOCKS.createFeatureFlagsResponse(),
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
),
).toMatchObject(expectedSwapsLiveness);
});