forked from Uniswap/interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnetworks.ts
146 lines (143 loc) · 4.98 KB
/
networks.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import { SupportedChainId } from 'constants/chains'
const INFURA_KEY = process.env.REACT_APP_INFURA_KEY
if (typeof INFURA_KEY === 'undefined') {
throw new Error(`REACT_APP_INFURA_KEY must be a defined environment variable`)
}
const QUICKNODE_RPC_URL = process.env.REACT_APP_BNB_RPC_URL
if (typeof QUICKNODE_RPC_URL === 'undefined') {
throw new Error(`REACT_APP_BNB_RPC_URL must be a defined environment variable`)
}
/**
* Fallback JSON-RPC endpoints.
* These are used if the integrator does not provide an endpoint, or if the endpoint does not work.
*
* MetaMask allows switching to any URL, but displays a warning if it is not on the "Safe" list:
* https://github.com/MetaMask/metamask-mobile/blob/bdb7f37c90e4fc923881a07fca38d4e77c73a579/app/core/RPCMethods/wallet_addEthereumChain.js#L228-L235
* https://chainid.network/chains.json
*
* These "Safe" URLs are listed first, followed by other fallback URLs, which are taken from chainlist.org.
*/
export const FALLBACK_URLS = {
[SupportedChainId.MAINNET]: [
// "Safe" URLs
'https://api.mycryptoapi.com/eth',
'https://cloudflare-eth.com',
// "Fallback" URLs
'https://rpc.ankr.com/eth',
'https://eth-mainnet.public.blastapi.io',
],
[SupportedChainId.GOERLI]: [
// "Safe" URLs
'https://rpc.goerli.mudit.blog/',
// "Fallback" URLs
'https://rpc.ankr.com/eth_goerli',
],
[SupportedChainId.SEPOLIA]: [
// "Safe" URLs
'https://rpc.sepolia.dev/',
// "Fallback" URLs
'https://rpc.sepolia.org/',
'https://rpc2.sepolia.org/',
'https://rpc.sepolia.online/',
'https://www.sepoliarpc.space/',
'https://rpc-sepolia.rockx.com/',
'https://rpc.bordel.wtf/sepolia',
],
[SupportedChainId.POLYGON]: [
// "Safe" URLs
'https://polygon-rpc.com/',
'https://rpc-mainnet.matic.network',
'https://matic-mainnet.chainstacklabs.com',
'https://rpc-mainnet.maticvigil.com',
'https://rpc-mainnet.matic.quiknode.pro',
'https://matic-mainnet-full-rpc.bwarelabs.com',
],
[SupportedChainId.POLYGON_MUMBAI]: [
// "Safe" URLs
'https://matic-mumbai.chainstacklabs.com',
'https://rpc-mumbai.maticvigil.com',
'https://matic-testnet-archive-rpc.bwarelabs.com',
],
[SupportedChainId.ARBITRUM_ONE]: [
// "Safe" URLs
'https://arb1.arbitrum.io/rpc',
// "Fallback" URLs
'https://arbitrum.public-rpc.com',
],
[SupportedChainId.ARBITRUM_GOERLI]: [
// "Safe" URLs
'https://goerli-rollup.arbitrum.io/rpc',
],
[SupportedChainId.OPTIMISM]: [
// "Safe" URLs
'https://mainnet.optimism.io/',
// "Fallback" URLs
'https://rpc.ankr.com/optimism',
],
[SupportedChainId.OPTIMISM_GOERLI]: [
// "Safe" URLs
'https://goerli.optimism.io',
],
[SupportedChainId.CELO]: [
// "Safe" URLs
`https://forno.celo.org`,
],
[SupportedChainId.CELO_ALFAJORES]: [
// "Safe" URLs
`https://alfajores-forno.celo-testnet.org`,
],
[SupportedChainId.BNB]: [
// "Safe" URLs
'https://endpoints.omniatech.io/v1/bsc/mainnet/public',
'https://bsc-mainnet.gateway.pokt.network/v1/lb/6136201a7bad1500343e248d',
'https://1rpc.io/bnb',
'https://bsc-dataseed3.binance.org',
'https://bsc-dataseed2.defibit.io',
'https://bsc-dataseed1.ninicoin.io',
'https://binance.nodereal.io',
'https://bsc-dataseed4.defibit.io',
'https://rpc.ankr.com/bsc',
],
}
/**
* Known JSON-RPC endpoints.
* These are the URLs used by the interface when there is not another available source of chain data.
*/
export const RPC_URLS = {
[SupportedChainId.MAINNET]: [
`https://mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.MAINNET],
],
[SupportedChainId.GOERLI]: [`https://goerli.infura.io/v3/${INFURA_KEY}`, ...FALLBACK_URLS[SupportedChainId.GOERLI]],
[SupportedChainId.SEPOLIA]: [
`https://sepolia.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.SEPOLIA],
],
[SupportedChainId.OPTIMISM]: [
`https://optimism-mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.OPTIMISM],
],
[SupportedChainId.OPTIMISM_GOERLI]: [
`https://optimism-goerli.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.OPTIMISM_GOERLI],
],
[SupportedChainId.ARBITRUM_ONE]: [
`https://arbitrum-mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.ARBITRUM_ONE],
],
[SupportedChainId.ARBITRUM_GOERLI]: [
`https://arbitrum-goerli.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.ARBITRUM_GOERLI],
],
[SupportedChainId.POLYGON]: [
`https://polygon-mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.POLYGON],
],
[SupportedChainId.POLYGON_MUMBAI]: [
`https://polygon-mumbai.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.POLYGON_MUMBAI],
],
[SupportedChainId.CELO]: FALLBACK_URLS[SupportedChainId.CELO],
[SupportedChainId.CELO_ALFAJORES]: FALLBACK_URLS[SupportedChainId.CELO_ALFAJORES],
[SupportedChainId.BNB]: [QUICKNODE_RPC_URL, ...FALLBACK_URLS[SupportedChainId.BNB]],
}