-
Notifications
You must be signed in to change notification settings - Fork 246
/
default_networks.go
258 lines (232 loc) · 7.92 KB
/
default_networks.go
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
package api
import (
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/status-im/status-go/params"
"github.com/status-im/status-go/protocol/requests"
)
const (
mainnetChainID uint64 = 1
goerliChainID uint64 = 5
sepoliaChainID uint64 = 11155111
optimismChainID uint64 = 10
optimismGoerliChainID uint64 = 420
optimismSepoliaChainID uint64 = 11155420
arbitrumChainID uint64 = 42161
arbitrumGoerliChainID uint64 = 421613
arbitrumSepoliaChainID uint64 = 421614
sntSymbol = "SNT"
sttSymbol = "STT"
)
var ganacheTokenAddress = common.HexToAddress("0x8571Ddc46b10d31EF963aF49b6C7799Ea7eff818")
var mainnet = params.Network{
ChainID: mainnetChainID,
ChainName: "Ethereum Mainnet",
RPCURL: "https://eth-archival.rpc.grove.city/v1/",
FallbackURL: "https://mainnet.infura.io/v3/",
BlockExplorerURL: "https://etherscan.io/",
IconURL: "network/Network=Ethereum",
ChainColor: "#627EEA",
ShortName: "eth",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: false,
Layer: 1,
Enabled: true,
RelatedChainID: goerliChainID,
}
var goerli = params.Network{
ChainID: goerliChainID,
ChainName: "Ethereum Goerli",
RPCURL: "https://goerli-archival.rpc.grove.city/v1/",
FallbackURL: "https://goerli.infura.io/v3/",
BlockExplorerURL: "https://goerli.etherscan.io/",
IconURL: "network/Network=Testnet",
ChainColor: "#627EEA",
ShortName: "goEth",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: true,
Layer: 1,
Enabled: true,
RelatedChainID: mainnetChainID,
}
var sepolia = params.Network{
ChainID: sepoliaChainID,
ChainName: "Ethereum Sepolia",
RPCURL: "https://sepolia-archival.rpc.grove.city/v1/",
FallbackURL: "https://sepolia.infura.io/v3/",
BlockExplorerURL: "https://sepolia.etherscan.io/",
IconURL: "network/Network=Testnet",
ChainColor: "#627EEA",
ShortName: "eth",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: true,
Layer: 1,
Enabled: true,
RelatedChainID: mainnetChainID,
}
var optimism = params.Network{
ChainID: optimismChainID,
ChainName: "Optimism",
RPCURL: "https://optimism-mainnet.rpc.grove.city/v1/",
FallbackURL: "https://optimism-mainnet.infura.io/v3/",
BlockExplorerURL: "https://optimistic.etherscan.io",
IconURL: "network/Network=Optimism",
ChainColor: "#E90101",
ShortName: "opt",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: false,
Layer: 2,
Enabled: true,
RelatedChainID: optimismGoerliChainID,
}
var optimismGoerli = params.Network{
ChainID: optimismGoerliChainID,
ChainName: "Optimism Goerli",
RPCURL: "https://optimism-goerli.infura.io/v3/",
FallbackURL: "",
BlockExplorerURL: "https://goerli-optimism.etherscan.io/",
IconURL: "network/Network=Testnet",
ChainColor: "#E90101",
ShortName: "goOpt",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: true,
Layer: 2,
Enabled: false,
RelatedChainID: optimismChainID,
}
var optimismSepolia = params.Network{
ChainID: optimismSepoliaChainID,
ChainName: "Optimism Sepolia",
RPCURL: "https://optimism-sepolia.infura.io/v3/",
FallbackURL: "",
BlockExplorerURL: "https://sepolia-optimism.etherscan.io/",
IconURL: "network/Network=Testnet",
ChainColor: "#E90101",
ShortName: "opt",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: true,
Layer: 2,
Enabled: false,
RelatedChainID: optimismChainID,
}
var arbitrum = params.Network{
ChainID: arbitrumChainID,
ChainName: "Arbitrum",
RPCURL: "https://arbitrum-one.rpc.grove.city/v1/",
FallbackURL: "https://arbitrum-mainnet.infura.io/v3/",
BlockExplorerURL: "https://arbiscan.io/",
IconURL: "network/Network=Arbitrum",
ChainColor: "#51D0F0",
ShortName: "arb",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: false,
Layer: 2,
Enabled: true,
RelatedChainID: arbitrumGoerliChainID,
}
var arbitrumGoerli = params.Network{
ChainID: arbitrumGoerliChainID,
ChainName: "Arbitrum Goerli",
RPCURL: "https://arbitrum-goerli.infura.io/v3/",
FallbackURL: "",
BlockExplorerURL: "https://goerli.arbiscan.io/",
IconURL: "network/Network=Testnet",
ChainColor: "#51D0F0",
ShortName: "goArb",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: true,
Layer: 2,
Enabled: false,
RelatedChainID: arbitrumChainID,
}
var arbitrumSepolia = params.Network{
ChainID: arbitrumSepoliaChainID,
ChainName: "Arbitrum Sepolia",
RPCURL: "https://arbitrum-sepolia.infura.io/v3/",
FallbackURL: "",
BlockExplorerURL: "https://sepolia-explorer.arbitrum.io/",
IconURL: "network/Network=Testnet",
ChainColor: "#51D0F0",
ShortName: "arb",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: true,
Layer: 2,
Enabled: false,
RelatedChainID: arbitrumChainID,
}
var defaultNetworks = []params.Network{
mainnet,
goerli,
sepolia,
optimism,
optimismGoerli,
optimismSepolia,
arbitrum,
arbitrumGoerli,
arbitrumSepolia,
}
var mainnetGanacheTokenOverrides = params.TokenOverride{
Symbol: sntSymbol,
Address: ganacheTokenAddress,
}
var goerliGanacheTokenOverrides = params.TokenOverride{
Symbol: sttSymbol,
Address: ganacheTokenAddress,
}
func setRPCs(networks []params.Network, request *requests.WalletSecretsConfig) []params.Network {
var networksWithRPC []params.Network
for _, n := range networks {
if request.InfuraToken != "" {
if strings.Contains(n.RPCURL, "infura") {
n.RPCURL += request.InfuraToken
}
if strings.Contains(n.FallbackURL, "infura") {
n.FallbackURL += request.InfuraToken
}
}
if request.PoktToken != "" {
if strings.Contains(n.RPCURL, "grove") {
n.RPCURL += request.PoktToken
}
if strings.Contains(n.FallbackURL, "grove") {
n.FallbackURL += request.PoktToken
}
}
if request.GanacheURL != "" {
n.RPCURL = request.GanacheURL
n.FallbackURL = request.GanacheURL
if n.ChainID == mainnetChainID {
n.TokenOverrides = []params.TokenOverride{
mainnetGanacheTokenOverrides,
}
} else if n.ChainID == goerliChainID {
n.TokenOverrides = []params.TokenOverride{
goerliGanacheTokenOverrides,
}
}
}
networksWithRPC = append(networksWithRPC, n)
}
return networksWithRPC
}
func BuildDefaultNetworks(request *requests.CreateAccount) []params.Network {
return setRPCs(defaultNetworks, &request.WalletSecretsConfig)
}