You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.3 KiB
68 lines
2.3 KiB
5 years ago
|
export const ROPSTEN = 'ropsten'
|
||
|
export const RINKEBY = 'rinkeby'
|
||
|
export const KOVAN = 'kovan'
|
||
|
export const MAINNET = 'mainnet'
|
||
|
export const GOERLI = 'goerli'
|
||
7 years ago
|
|
||
4 years ago
|
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'
|
||
5 years ago
|
|
||
|
export const MAINNET_CHAIN_ID = '0x1'
|
||
|
export const ROPSTEN_CHAIN_ID = '0x3'
|
||
|
export const RINKEBY_CHAIN_ID = '0x4'
|
||
|
export const GOERLI_CHAIN_ID = '0x5'
|
||
4 years ago
|
export const KOVAN_CHAIN_ID = '0x2a'
|
||
7 years ago
|
|
||
5 years ago
|
export const ROPSTEN_DISPLAY_NAME = 'Ropsten'
|
||
|
export const RINKEBY_DISPLAY_NAME = 'Rinkeby'
|
||
|
export const KOVAN_DISPLAY_NAME = 'Kovan'
|
||
4 years ago
|
export const MAINNET_DISPLAY_NAME = 'Ethereum Mainnet'
|
||
5 years ago
|
export const GOERLI_DISPLAY_NAME = 'Goerli'
|
||
5 years ago
|
|
||
4 years ago
|
export const INFURA_PROVIDER_TYPES = [ROPSTEN, RINKEBY, KOVAN, MAINNET, GOERLI]
|
||
5 years ago
|
|
||
|
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 },
|
||
|
}
|
||
|
|
||
|
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,
|
||
|
}
|
||
4 years ago
|
|
||
4 years ago
|
export const CHAIN_ID_TO_TYPE_MAP = Object.entries(
|
||
|
NETWORK_TYPE_TO_ID_MAP,
|
||
|
).reduce((chainIdToTypeMap, [networkType, { chainId }]) => {
|
||
|
chainIdToTypeMap[chainId] = networkType
|
||
|
return chainIdToTypeMap
|
||
|
}, {})
|
||
4 years ago
|
|
||
4 years ago
|
export const CHAIN_ID_TO_NETWORK_ID_MAP = Object.values(
|
||
|
NETWORK_TYPE_TO_ID_MAP,
|
||
|
).reduce((chainIdToNetworkIdMap, { chainId, networkId }) => {
|
||
|
chainIdToNetworkIdMap[chainId] = networkId
|
||
|
return chainIdToNetworkIdMap
|
||
|
}, {})
|