@@ -4,19 +4,83 @@ import {
4
4
injectedWallet ,
5
5
metaMaskWallet ,
6
6
} from "@rainbow-me/rainbowkit/wallets" ;
7
- import { chain , configureChains , createClient } from "wagmi" ;
7
+ import { configureChains , createClient } from "wagmi" ;
8
+ import {
9
+ fantom as fantomChain ,
10
+ fantomTestnet as fantomTestnetChain ,
11
+ mainnet ,
12
+ arbitrum ,
13
+ optimism ,
14
+ goerli ,
15
+ arbitrumGoerli ,
16
+ hardhat ,
17
+ avalancheFuji as avalancheFujiChain ,
18
+ avalanche as avalancheChain ,
19
+ } from "wagmi/chains" ;
8
20
import { alchemyProvider } from "wagmi/providers/alchemy" ;
9
21
import { infuraProvider } from "wagmi/providers/infura" ;
10
22
import { publicProvider } from "wagmi/providers/public" ;
11
23
import PublicGoodsNetworkIcon from "common/src/icons/PublicGoodsNetwork.svg" ;
12
- import { FantomFTMLogo , FTMTestnet , OPIcon } from "../assets" ;
13
-
14
- const ftmTestnetIcon = FTMTestnet ;
15
- const ftmMainnetIcon = FantomFTMLogo ;
24
+ import { polygon , polygonMumbai } from "@wagmi/core/chains" ;
25
+ import { FantomFTMLogo } from "../assets" ;
16
26
17
27
// RPC keys
18
- const alchemyId = process . env . REACT_APP_ALCHEMY_ID ;
19
- const infuraId = process . env . REACT_APP_INFURA_ID ;
28
+ const alchemyId = process . env . REACT_APP_ALCHEMY_ID ! ;
29
+ const infuraId = process . env . REACT_APP_INFURA_ID ! ;
30
+
31
+ export const avalanche : Chain = {
32
+ ...avalancheChain ,
33
+ rpcUrls : {
34
+ default : {
35
+ http : [
36
+ "https://avalanche-mainnet.infura.io/v3/1e0a90928efe4bb78bb1eeceb8aacc27" ,
37
+ ] ,
38
+ } ,
39
+ public : {
40
+ http : [ "https://api.avax.network/ext/bc/C/rpc" ] ,
41
+ } ,
42
+ } ,
43
+ } ;
44
+
45
+ export const avalancheFuji : Chain = {
46
+ ...avalancheFujiChain ,
47
+ rpcUrls : {
48
+ default : {
49
+ http : [
50
+ "https://avalanche-fuji.infura.io/v3/1e0a90928efe4bb78bb1eeceb8aacc27" ,
51
+ ] ,
52
+ } ,
53
+ public : {
54
+ http : [ "https://api.avax-test.network/ext/bc/C/rpc" ] ,
55
+ } ,
56
+ } ,
57
+ } ;
58
+
59
+ export const fantom : Chain = {
60
+ ...fantomChain ,
61
+ rpcUrls : {
62
+ default : {
63
+ http : [ "https://rpcapi.fantom.network/" ] ,
64
+ } ,
65
+ public : {
66
+ http : [ "https://rpcapi.fantom.network/" ] ,
67
+ } ,
68
+ } ,
69
+ iconUrl : FantomFTMLogo ,
70
+ } ;
71
+
72
+ export const fantomTestnet : Chain = {
73
+ ...fantomTestnetChain ,
74
+ rpcUrls : {
75
+ default : {
76
+ http : [ "https://rpc.testnet.fantom.network/" ] ,
77
+ } ,
78
+ public : {
79
+ http : [ "https://rpc.testnet.fantom.network/" ] ,
80
+ } ,
81
+ } ,
82
+ iconUrl : FantomFTMLogo ,
83
+ } ;
20
84
21
85
export const pgn : Chain = {
22
86
id : 424 ,
@@ -29,7 +93,8 @@ export const pgn: Chain = {
29
93
symbol : "ETH" ,
30
94
} ,
31
95
rpcUrls : {
32
- default : "https://rpc.publicgoods.network" ,
96
+ default : { http : [ "https://rpc.publicgoods.network" ] } ,
97
+ public : { http : [ "https://rpc.publicgoods.network" ] } ,
33
98
} ,
34
99
blockExplorers : {
35
100
default : {
@@ -51,7 +116,8 @@ export const pgnTestnet: Chain = {
51
116
symbol : "ETH" ,
52
117
} ,
53
118
rpcUrls : {
54
- default : "https://sepolia.publicgoods.network" ,
119
+ default : { http : [ "https://sepolia.publicgoods.network" ] } ,
120
+ public : { http : [ "https://sepolia.publicgoods.network" ] } ,
55
121
} ,
56
122
blockExplorers : {
57
123
default : {
@@ -61,91 +127,37 @@ export const pgnTestnet: Chain = {
61
127
} ,
62
128
testnet : true ,
63
129
} ;
64
- // Adding custom chain setups for Fantom Mainnet and Testnet
65
- const fantomTestnet : Chain = {
66
- id : 4002 ,
67
- name : "Fantom Testnet" ,
68
- network : "fantom testnet" ,
69
- iconUrl : ftmTestnetIcon ,
70
- nativeCurrency : {
71
- decimals : 18 ,
72
- name : "Fantom" ,
73
- symbol : "FTM" ,
74
- } ,
75
- rpcUrls : {
76
- default : "https://rpc.testnet.fantom.network/" ,
77
- } ,
78
- blockExplorers : {
79
- default : { name : "ftmscan" , url : "https://testnet.ftmscan.com" } ,
80
- } ,
81
- testnet : true ,
82
- } ;
83
-
84
- const fantomMainnet : Chain = {
85
- id : 250 ,
86
- name : "Fantom" ,
87
- network : "fantom mainnet" ,
88
- iconUrl : ftmMainnetIcon ,
89
- nativeCurrency : {
90
- decimals : 18 ,
91
- name : "Fantom" ,
92
- symbol : "FTM" ,
93
- } ,
94
- rpcUrls : {
95
- default : "https://rpcapi.fantom.network/" ,
96
- } ,
97
- blockExplorers : {
98
- default : { name : "ftmscan" , url : "https://ftmscan.com" } ,
99
- } ,
100
- testnet : false ,
101
- } ;
102
-
103
- const optimismMainnet : Chain = {
104
- id : 10 ,
105
- name : "Optimism" ,
106
- network : "optimism mainnet" ,
107
- iconUrl : OPIcon ,
108
- nativeCurrency : {
109
- decimals : 18 ,
110
- name : "Optimism" ,
111
- symbol : "ETH" ,
112
- } ,
113
- rpcUrls : {
114
- default : `https://opt-mainnet.g.alchemy.com/v2/${ alchemyId } ` ,
115
- } ,
116
- blockExplorers : {
117
- default : { name : "etherscan" , url : "https://optimistic.etherscan.io" } ,
118
- } ,
119
- testnet : false ,
120
- } ;
121
130
122
131
// todo: fix for rpc issue is with hardhat local chain calling rpc
123
132
if ( process . env . REACT_APP_LOCALCHAIN === "true" ) {
124
- chainsAvailable . push ( chain . hardhat ) ;
133
+ chainsAvailable . push ( hardhat ) ;
125
134
}
126
135
127
136
if ( process . env . REACT_APP_ENV === "production" ) {
128
137
chainsAvailable . push (
129
- chain . mainnet ,
130
- fantomMainnet ,
131
- optimismMainnet ,
138
+ mainnet ,
139
+ fantom ,
140
+ optimism ,
132
141
pgn ,
133
- chain . arbitrum ,
134
- chain . polygon
142
+ arbitrum ,
143
+ avalanche ,
144
+ polygon
135
145
) ;
136
146
} else {
137
147
chainsAvailable . push (
138
- optimismMainnet ,
139
- chain . goerli ,
148
+ optimism ,
149
+ goerli ,
140
150
fantomTestnet ,
141
- fantomMainnet ,
142
- chain . mainnet ,
151
+ fantom ,
152
+ mainnet ,
143
153
pgnTestnet ,
144
154
pgn ,
145
- chain . arbitrum ,
146
- chain . arbitrumGoerli ,
147
- chain . polygon ,
148
- chain . polygonMumbai
155
+ arbitrum ,
156
+ arbitrumGoerli ,
157
+ polygon ,
158
+ polygonMumbai ,
159
+ avalanche ,
160
+ avalancheFuji
149
161
) ;
150
162
}
151
163
@@ -163,7 +175,10 @@ const connectors = connectorsForWallets([
163
175
wallets : [
164
176
injectedWallet ( { chains } ) ,
165
177
coinbaseWallet ( { appName : "Builder" , chains } ) ,
166
- metaMaskWallet ( { chains } ) ,
178
+ metaMaskWallet ( {
179
+ chains,
180
+ projectId : "0000000000" /* We don't support walletconnect */ ,
181
+ } ) ,
167
182
] ,
168
183
} ,
169
184
] ) ;
0 commit comments