2021-02-04 19:15:23 +01:00
|
|
|
export const ROPSTEN = 'ropsten';
|
|
|
|
export const RINKEBY = 'rinkeby';
|
|
|
|
export const KOVAN = 'kovan';
|
|
|
|
export const MAINNET = 'mainnet';
|
|
|
|
export const GOERLI = 'goerli';
|
|
|
|
export const NETWORK_TYPE_RPC = 'rpc';
|
2018-04-12 23:17:36 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export const MAINNET_NETWORK_ID = '1';
|
|
|
|
export const ROPSTEN_NETWORK_ID = '3';
|
|
|
|
export const RINKEBY_NETWORK_ID = '4';
|
|
|
|
export const GOERLI_NETWORK_ID = '5';
|
|
|
|
export const KOVAN_NETWORK_ID = '42';
|
2021-03-12 23:23:26 +01:00
|
|
|
export const LOCALHOST_NETWORK_ID = '1337';
|
2020-05-20 17:57:45 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export const MAINNET_CHAIN_ID = '0x1';
|
|
|
|
export const ROPSTEN_CHAIN_ID = '0x3';
|
|
|
|
export const RINKEBY_CHAIN_ID = '0x4';
|
|
|
|
export const GOERLI_CHAIN_ID = '0x5';
|
|
|
|
export const KOVAN_CHAIN_ID = '0x2a';
|
2021-03-12 23:23:26 +01:00
|
|
|
export const LOCALHOST_CHAIN_ID = '0x539';
|
2021-04-07 17:37:04 +02:00
|
|
|
export const BSC_CHAIN_ID = '0x38';
|
2021-07-01 23:48:30 +02:00
|
|
|
export const OPTIMISM_CHAIN_ID = '0xa';
|
|
|
|
export const OPTIMISM_TESTNET_CHAIN_ID = '0x45';
|
2021-07-09 17:24:00 +02:00
|
|
|
export const POLYGON_CHAIN_ID = '0x89';
|
2018-04-12 23:17:36 +02:00
|
|
|
|
2021-01-21 00:37:18 +01:00
|
|
|
/**
|
|
|
|
* The largest possible chain ID we can handle.
|
|
|
|
* Explanation: https://gist.github.com/rekmarks/a47bd5f2525936c4b8eee31a16345553
|
|
|
|
*/
|
2021-02-04 19:15:23 +01:00
|
|
|
export const MAX_SAFE_CHAIN_ID = 4503599627370476;
|
2021-01-21 00:37:18 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export const ROPSTEN_DISPLAY_NAME = 'Ropsten';
|
|
|
|
export const RINKEBY_DISPLAY_NAME = 'Rinkeby';
|
|
|
|
export const KOVAN_DISPLAY_NAME = 'Kovan';
|
|
|
|
export const MAINNET_DISPLAY_NAME = 'Ethereum Mainnet';
|
|
|
|
export const GOERLI_DISPLAY_NAME = 'Goerli';
|
2020-05-20 17:57:45 +02:00
|
|
|
|
2021-06-10 00:18:38 +02:00
|
|
|
const infuraProjectId = process.env.INFURA_PROJECT_ID;
|
|
|
|
const getRpcUrl = (network) =>
|
|
|
|
`https://${network}.infura.io/v3/${infuraProjectId}`;
|
|
|
|
|
|
|
|
export const ROPSTEN_RPC_URL = getRpcUrl('ropsten');
|
|
|
|
export const RINKEBY_RPC_URL = getRpcUrl('rinkeby');
|
|
|
|
export const KOVAN_RPC_URL = getRpcUrl('kovan');
|
|
|
|
export const MAINNET_RPC_URL = getRpcUrl('mainnet');
|
|
|
|
export const GOERLI_RPC_URL = getRpcUrl('goerli');
|
|
|
|
|
2021-04-02 00:57:00 +02:00
|
|
|
export const ETH_SYMBOL = 'ETH';
|
2021-04-23 16:53:10 +02:00
|
|
|
export const WETH_SYMBOL = 'WETH';
|
2021-04-02 00:57:00 +02:00
|
|
|
export const TEST_ETH_SYMBOL = 'TESTETH';
|
|
|
|
export const BNB_SYMBOL = 'BNB';
|
2021-07-20 19:17:15 +02:00
|
|
|
export const MATIC_SYMBOL = 'MATIC';
|
2021-04-02 00:57:00 +02:00
|
|
|
|
|
|
|
export const ETH_TOKEN_IMAGE_URL = './images/eth_logo.svg';
|
|
|
|
export const TEST_ETH_TOKEN_IMAGE_URL = './images/black-eth-logo.svg';
|
|
|
|
export const BNB_TOKEN_IMAGE_URL = './images/bnb.png';
|
2021-07-20 19:17:15 +02:00
|
|
|
export const MATIC_TOKEN_IMAGE_URL = './images/matic-token.png';
|
2021-04-02 00:57:00 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export const INFURA_PROVIDER_TYPES = [ROPSTEN, RINKEBY, KOVAN, MAINNET, GOERLI];
|
2020-05-20 17:57:45 +02:00
|
|
|
|
2021-02-16 16:31:16 +01:00
|
|
|
export const TEST_CHAINS = [
|
|
|
|
ROPSTEN_CHAIN_ID,
|
|
|
|
RINKEBY_CHAIN_ID,
|
|
|
|
GOERLI_CHAIN_ID,
|
|
|
|
KOVAN_CHAIN_ID,
|
|
|
|
];
|
|
|
|
|
2021-06-10 00:18:38 +02:00
|
|
|
/**
|
|
|
|
* Map of all build-in Infura networks to their network and chain IDs.
|
|
|
|
*/
|
2020-05-20 17:57:45 +02:00
|
|
|
export const NETWORK_TYPE_TO_ID_MAP = {
|
|
|
|
[ROPSTEN]: { networkId: ROPSTEN_NETWORK_ID, chainId: ROPSTEN_CHAIN_ID },
|
|
|
|
[RINKEBY]: { networkId: RINKEBY_NETWORK_ID, chainId: RINKEBY_CHAIN_ID },
|
|
|
|
[KOVAN]: { networkId: KOVAN_NETWORK_ID, chainId: KOVAN_CHAIN_ID },
|
|
|
|
[GOERLI]: { networkId: GOERLI_NETWORK_ID, chainId: GOERLI_CHAIN_ID },
|
|
|
|
[MAINNET]: { networkId: MAINNET_NETWORK_ID, chainId: MAINNET_CHAIN_ID },
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-05-20 17:57:45 +02:00
|
|
|
|
|
|
|
export const NETWORK_TO_NAME_MAP = {
|
|
|
|
[ROPSTEN]: ROPSTEN_DISPLAY_NAME,
|
|
|
|
[RINKEBY]: RINKEBY_DISPLAY_NAME,
|
|
|
|
[KOVAN]: KOVAN_DISPLAY_NAME,
|
|
|
|
[MAINNET]: MAINNET_DISPLAY_NAME,
|
|
|
|
[GOERLI]: GOERLI_DISPLAY_NAME,
|
|
|
|
|
|
|
|
[ROPSTEN_NETWORK_ID]: ROPSTEN_DISPLAY_NAME,
|
|
|
|
[RINKEBY_NETWORK_ID]: RINKEBY_DISPLAY_NAME,
|
|
|
|
[KOVAN_NETWORK_ID]: KOVAN_DISPLAY_NAME,
|
|
|
|
[GOERLI_NETWORK_ID]: GOERLI_DISPLAY_NAME,
|
|
|
|
[MAINNET_NETWORK_ID]: MAINNET_DISPLAY_NAME,
|
|
|
|
|
|
|
|
[ROPSTEN_CHAIN_ID]: ROPSTEN_DISPLAY_NAME,
|
|
|
|
[RINKEBY_CHAIN_ID]: RINKEBY_DISPLAY_NAME,
|
|
|
|
[KOVAN_CHAIN_ID]: KOVAN_DISPLAY_NAME,
|
|
|
|
[GOERLI_CHAIN_ID]: GOERLI_DISPLAY_NAME,
|
|
|
|
[MAINNET_CHAIN_ID]: MAINNET_DISPLAY_NAME,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-10-31 01:58:12 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
export const CHAIN_ID_TO_TYPE_MAP = Object.entries(
|
|
|
|
NETWORK_TYPE_TO_ID_MAP,
|
|
|
|
).reduce((chainIdToTypeMap, [networkType, { chainId }]) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
chainIdToTypeMap[chainId] = networkType;
|
|
|
|
return chainIdToTypeMap;
|
|
|
|
}, {});
|
2020-10-31 01:58:12 +01:00
|
|
|
|
2021-06-10 00:18:38 +02:00
|
|
|
export const CHAIN_ID_TO_RPC_URL_MAP = {
|
|
|
|
[ROPSTEN_CHAIN_ID]: ROPSTEN_RPC_URL,
|
|
|
|
[RINKEBY_CHAIN_ID]: RINKEBY_RPC_URL,
|
|
|
|
[KOVAN_CHAIN_ID]: KOVAN_RPC_URL,
|
|
|
|
[GOERLI_CHAIN_ID]: GOERLI_RPC_URL,
|
|
|
|
[MAINNET_CHAIN_ID]: MAINNET_RPC_URL,
|
|
|
|
};
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
export const CHAIN_ID_TO_NETWORK_ID_MAP = Object.values(
|
|
|
|
NETWORK_TYPE_TO_ID_MAP,
|
|
|
|
).reduce((chainIdToNetworkIdMap, { chainId, networkId }) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
chainIdToNetworkIdMap[chainId] = networkId;
|
|
|
|
return chainIdToNetworkIdMap;
|
|
|
|
}, {});
|
2021-04-02 00:57:00 +02:00
|
|
|
|
|
|
|
export const NATIVE_CURRENCY_TOKEN_IMAGE_MAP = {
|
|
|
|
[ETH_SYMBOL]: ETH_TOKEN_IMAGE_URL,
|
|
|
|
[TEST_ETH_SYMBOL]: TEST_ETH_TOKEN_IMAGE_URL,
|
|
|
|
[BNB_SYMBOL]: BNB_TOKEN_IMAGE_URL,
|
|
|
|
};
|
2021-04-15 19:41:40 +02:00
|
|
|
|
|
|
|
export const INFURA_BLOCKED_KEY = 'countryBlocked';
|
2021-06-30 16:39:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hardforks are points in the chain where logic is changed significantly
|
|
|
|
* enough where there is a fork and the new fork becomes the active chain.
|
|
|
|
* These constants are presented in chronological order starting with BERLIN
|
|
|
|
* because when we first needed to track the hardfork we had launched support
|
|
|
|
* for EIP-2718 (where transactions can have types and different shapes) and
|
|
|
|
* EIP-2930 (optional access lists), which were included in BERLIN.
|
|
|
|
*
|
|
|
|
* BERLIN - forked at block number 12,244,000, included typed transactions and
|
|
|
|
* optional access lists
|
|
|
|
* LONDON - future, upcoming fork that introduces the baseFeePerGas, an amount
|
|
|
|
* of the ETH transaction fees that will be burned instead of given to the
|
|
|
|
* miner. This change necessitated the third type of transaction envelope to
|
|
|
|
* specify maxFeePerGas and maxPriorityFeePerGas moving the fee bidding system
|
|
|
|
* to a second price auction model.
|
|
|
|
*/
|
|
|
|
export const HARDFORKS = {
|
|
|
|
BERLIN: 'berlin',
|
|
|
|
LONDON: 'london',
|
|
|
|
};
|
2021-07-01 23:48:30 +02:00
|
|
|
|
|
|
|
export const CHAIN_ID_TO_GAS_LIMIT_BUFFER_MAP = {
|
|
|
|
[OPTIMISM_CHAIN_ID]: 1,
|
|
|
|
[OPTIMISM_TESTNET_CHAIN_ID]: 1,
|
|
|
|
};
|