@wagmi/core 0.2.0-next.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +30 -0
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +135 -154
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +135 -154
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +136 -155
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +98 -152
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +98 -152
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +98 -152
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +91 -126
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +91 -126
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +91 -126
- package/dist/base-30d4fad4.cjs.prod.js +544 -0
- package/dist/base-a0d63eb0.cjs.dev.js +544 -0
- package/dist/base-f0102d32.esm.js +517 -0
- package/dist/{classPrivateMethodGet-0e9a7925.cjs.prod.js → classPrivateMethodGet-656c08a7.cjs.prod.js} +1 -1
- package/dist/{classPrivateMethodGet-38b54c7a.cjs.dev.js → classPrivateMethodGet-9b9cd39b.cjs.dev.js} +1 -1
- package/dist/{classPrivateMethodGet-c9db96d6.esm.js → classPrivateMethodGet-e0eaacfc.esm.js} +1 -1
- package/dist/declarations/src/actions/accounts/connect.d.ts +14 -5
- package/dist/declarations/src/actions/accounts/fetchBalance.d.ts +3 -1
- package/dist/declarations/src/actions/accounts/fetchSigner.d.ts +1 -1
- package/dist/declarations/src/actions/accounts/getAccount.d.ts +5 -4
- package/dist/declarations/src/actions/accounts/index.d.ts +1 -2
- package/dist/declarations/src/actions/accounts/switchNetwork.d.ts +1 -1
- package/dist/declarations/src/actions/accounts/watchAccount.d.ts +3 -2
- package/dist/declarations/src/actions/contracts/readContract.d.ts +4 -1
- package/dist/declarations/src/actions/contracts/watchContractEvent.d.ts +3 -1
- package/dist/declarations/src/actions/ens/fetchEnsAddress.d.ts +3 -1
- package/dist/declarations/src/actions/ens/fetchEnsAvatar.d.ts +3 -1
- package/dist/declarations/src/actions/ens/fetchEnsName.d.ts +3 -1
- package/dist/declarations/src/actions/ens/fetchEnsResolver.d.ts +3 -1
- package/dist/declarations/src/actions/ens/index.d.ts +0 -4
- package/dist/declarations/src/actions/index.d.ts +5 -5
- package/dist/declarations/src/actions/network-status/fetchBlockNumber.d.ts +4 -1
- package/dist/declarations/src/actions/network-status/fetchFeeData.d.ts +3 -1
- package/dist/declarations/src/actions/network-status/index.d.ts +1 -2
- package/dist/declarations/src/actions/providers/getProvider.d.ts +6 -2
- package/dist/declarations/src/actions/providers/getWebSocketProvider.d.ts +6 -2
- package/dist/declarations/src/actions/providers/index.d.ts +2 -2
- package/dist/declarations/src/actions/providers/watchProvider.d.ts +4 -3
- package/dist/declarations/src/actions/providers/watchWebSocketProvider.d.ts +4 -3
- package/dist/declarations/src/actions/tokens/fetchToken.d.ts +6 -10
- package/dist/declarations/src/actions/tokens/index.d.ts +0 -1
- package/dist/declarations/src/actions/transactions/waitForTransaction.d.ts +3 -1
- package/dist/declarations/src/client.d.ts +23 -22
- package/dist/declarations/src/connectors/base.d.ts +3 -1
- package/dist/declarations/src/connectors/coinbaseWallet.d.ts +9 -0
- package/dist/declarations/src/connectors/injected.d.ts +2 -10
- package/dist/declarations/src/connectors/mock/connector.d.ts +1 -1
- package/dist/declarations/src/connectors/mock/provider.d.ts +2 -0
- package/dist/declarations/src/constants/abis.d.ts +2 -0
- package/dist/declarations/src/constants/blockExplorers.d.ts +9 -0
- package/dist/declarations/src/constants/chains.d.ts +17 -6
- package/dist/declarations/src/constants/index.d.ts +6 -2
- package/dist/declarations/src/constants/rpcs.d.ts +9 -0
- package/dist/declarations/src/index.d.ts +9 -6
- package/dist/declarations/src/types/index.d.ts +77 -6
- package/dist/declarations/src/utils/getInjectedName.d.ts +1 -1
- package/dist/wagmi-core.cjs.dev.js +658 -1153
- package/dist/wagmi-core.cjs.prod.js +658 -1153
- package/dist/wagmi-core.esm.js +653 -1147
- package/package.json +17 -9
- package/dist/base-09a653f3.cjs.dev.js +0 -453
- package/dist/base-824c3b6d.esm.js +0 -430
- package/dist/base-d8123d5f.cjs.prod.js +0 -453
- package/dist/declarations/src/actions/accounts/watchBalance.d.ts +0 -3
- package/dist/declarations/src/actions/ens/watchEnsAddress.d.ts +0 -3
- package/dist/declarations/src/actions/ens/watchEnsAvatar.d.ts +0 -3
- package/dist/declarations/src/actions/ens/watchEnsName.d.ts +0 -3
- package/dist/declarations/src/actions/ens/watchEnsResolver.d.ts +0 -3
- package/dist/declarations/src/actions/network-status/watchFeeData.d.ts +0 -7
- package/dist/declarations/src/actions/tokens/watchToken.d.ts +0 -3
- package/dist/declarations/src/constants/abis/erc1155.d.ts +0 -17
- package/dist/declarations/src/constants/abis/erc20.d.ts +0 -38
- package/dist/declarations/src/constants/abis/erc721.d.ts +0 -15
- package/dist/declarations/src/constants/abis/index.d.ts +0 -3
- package/dist/declarations/src/types/declarations.d.ts +0 -52
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var EventEmitter = require('eventemitter3');
|
|
4
|
+
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var EventEmitter__default = /*#__PURE__*/_interopDefault(EventEmitter);
|
|
8
|
+
|
|
9
|
+
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
10
|
+
if (privateCollection.has(obj)) {
|
|
11
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
16
|
+
_checkPrivateRedeclaration(obj, privateMap);
|
|
17
|
+
privateMap.set(obj, value);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function _defineProperty(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value: value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return obj;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function _classApplyDescriptorGet(receiver, descriptor) {
|
|
36
|
+
if (descriptor.get) {
|
|
37
|
+
return descriptor.get.call(receiver);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return descriptor.value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) {
|
|
44
|
+
if (!privateMap.has(receiver)) {
|
|
45
|
+
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return privateMap.get(receiver);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function _classPrivateFieldGet(receiver, privateMap) {
|
|
52
|
+
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
53
|
+
return _classApplyDescriptorGet(receiver, descriptor);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) {
|
|
57
|
+
if (descriptor.set) {
|
|
58
|
+
descriptor.set.call(receiver, value);
|
|
59
|
+
} else {
|
|
60
|
+
if (!descriptor.writable) {
|
|
61
|
+
throw new TypeError("attempted to set read only private field");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
descriptor.value = value;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
69
|
+
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
|
|
70
|
+
_classApplyDescriptorSet(receiver, descriptor, value);
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const etherscanBlockExplorers = {
|
|
75
|
+
mainnet: {
|
|
76
|
+
name: 'Etherscan',
|
|
77
|
+
url: 'https://etherscan.io'
|
|
78
|
+
},
|
|
79
|
+
ropsten: {
|
|
80
|
+
name: 'Etherscan',
|
|
81
|
+
url: 'https://ropsten.etherscan.io'
|
|
82
|
+
},
|
|
83
|
+
rinkeby: {
|
|
84
|
+
name: 'Etherscan',
|
|
85
|
+
url: 'https://rinkeby.etherscan.io'
|
|
86
|
+
},
|
|
87
|
+
goerli: {
|
|
88
|
+
name: 'Etherscan',
|
|
89
|
+
url: 'https://goerli.etherscan.io'
|
|
90
|
+
},
|
|
91
|
+
kovan: {
|
|
92
|
+
name: 'Etherscan',
|
|
93
|
+
url: 'https://kovan.etherscan.io'
|
|
94
|
+
},
|
|
95
|
+
optimism: {
|
|
96
|
+
name: 'Etherscan',
|
|
97
|
+
url: 'https://optimistic.etherscan.io'
|
|
98
|
+
},
|
|
99
|
+
optimismKovan: {
|
|
100
|
+
name: 'Etherscan',
|
|
101
|
+
url: 'https://kovan-optimistic.etherscan.io'
|
|
102
|
+
},
|
|
103
|
+
polygon: {
|
|
104
|
+
name: 'PolygonScan',
|
|
105
|
+
url: 'https://polygonscan.com'
|
|
106
|
+
},
|
|
107
|
+
polygonMumbai: {
|
|
108
|
+
name: 'PolygonScan',
|
|
109
|
+
url: 'https://mumbai.polygonscan.com'
|
|
110
|
+
},
|
|
111
|
+
arbitrum: {
|
|
112
|
+
name: 'Arbiscan',
|
|
113
|
+
url: 'https://arbiscan.io'
|
|
114
|
+
},
|
|
115
|
+
arbitrumRinkeby: {
|
|
116
|
+
name: 'Arbiscan',
|
|
117
|
+
url: 'https://testnet.arbiscan.io'
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const defaultAlchemyId = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
|
|
122
|
+
const alchemyRpcUrls = {
|
|
123
|
+
mainnet: 'https://eth-mainnet.alchemyapi.io/v2',
|
|
124
|
+
ropsten: 'https://eth-ropsten.alchemyapi.io/v2',
|
|
125
|
+
rinkeby: 'https://eth-rinkeby.alchemyapi.io/v2',
|
|
126
|
+
goerli: 'https://eth-goerli.alchemyapi.io/v2',
|
|
127
|
+
kovan: 'https://eth-kovan.alchemyapi.io/v2',
|
|
128
|
+
optimism: 'https://opt-mainnet.g.alchemy.com/v2',
|
|
129
|
+
optimismKovan: 'https://opt-kovan.g.alchemy.com/v2',
|
|
130
|
+
polygon: 'https://polygon-mainnet.g.alchemy.com/v2',
|
|
131
|
+
polygonMumbai: 'https://polygon-mumbai.g.alchemy.com/v2',
|
|
132
|
+
arbitrum: 'https://arb-mainnet.g.alchemy.com/v2',
|
|
133
|
+
arbitrumRinkeby: 'https://arb-rinkeby.g.alchemy.com/v2'
|
|
134
|
+
};
|
|
135
|
+
const infuraRpcUrls = {
|
|
136
|
+
mainnet: 'https://mainnet.infura.io/v3',
|
|
137
|
+
ropsten: 'https://ropsten.infura.io/v3',
|
|
138
|
+
rinkeby: 'https://rinkeby.infura.io/v3',
|
|
139
|
+
goerli: 'https://goerli.infura.io/v3',
|
|
140
|
+
kovan: 'https://kovan.infura.io/v3',
|
|
141
|
+
optimism: 'https://optimism-mainnet.infura.io/v3',
|
|
142
|
+
optimismKovan: 'https://optimism-kovan.infura.io/v3',
|
|
143
|
+
polygon: 'https://polygon-mainnet.infura.io/v3',
|
|
144
|
+
polygonMumbai: 'https://polygon-mumbai.infura.io/v3',
|
|
145
|
+
arbitrum: 'https://arbitrum-mainnet.infura.io/v3',
|
|
146
|
+
arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const chainId = {
|
|
150
|
+
mainnet: 1,
|
|
151
|
+
ropsten: 3,
|
|
152
|
+
rinkeby: 4,
|
|
153
|
+
goerli: 5,
|
|
154
|
+
kovan: 42,
|
|
155
|
+
optimism: 10,
|
|
156
|
+
optimismKovan: 69,
|
|
157
|
+
polygon: 137,
|
|
158
|
+
polygonMumbai: 80001,
|
|
159
|
+
arbitrum: 42161,
|
|
160
|
+
arbitrumRinkeby: 421611,
|
|
161
|
+
localhost: 1337,
|
|
162
|
+
hardhat: 31337
|
|
163
|
+
};
|
|
164
|
+
const chain = {
|
|
165
|
+
mainnet: {
|
|
166
|
+
id: chainId.mainnet,
|
|
167
|
+
name: 'Ethereum',
|
|
168
|
+
nativeCurrency: {
|
|
169
|
+
name: 'Ether',
|
|
170
|
+
symbol: 'ETH',
|
|
171
|
+
decimals: 18
|
|
172
|
+
},
|
|
173
|
+
rpcUrls: {
|
|
174
|
+
alchemy: alchemyRpcUrls.mainnet,
|
|
175
|
+
infura: infuraRpcUrls.mainnet,
|
|
176
|
+
default: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId)
|
|
177
|
+
},
|
|
178
|
+
blockExplorers: {
|
|
179
|
+
etherscan: etherscanBlockExplorers.mainnet,
|
|
180
|
+
default: etherscanBlockExplorers.mainnet
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
ropsten: {
|
|
184
|
+
id: chainId.ropsten,
|
|
185
|
+
name: 'Ropsten',
|
|
186
|
+
nativeCurrency: {
|
|
187
|
+
name: 'Ropsten Ether',
|
|
188
|
+
symbol: 'ropETH',
|
|
189
|
+
decimals: 18
|
|
190
|
+
},
|
|
191
|
+
rpcUrls: {
|
|
192
|
+
alchemy: alchemyRpcUrls.ropsten,
|
|
193
|
+
infura: infuraRpcUrls.ropsten,
|
|
194
|
+
default: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId)
|
|
195
|
+
},
|
|
196
|
+
blockExplorers: {
|
|
197
|
+
etherscan: etherscanBlockExplorers.ropsten,
|
|
198
|
+
default: etherscanBlockExplorers.ropsten
|
|
199
|
+
},
|
|
200
|
+
testnet: true
|
|
201
|
+
},
|
|
202
|
+
rinkeby: {
|
|
203
|
+
id: chainId.rinkeby,
|
|
204
|
+
name: 'Rinkeby',
|
|
205
|
+
nativeCurrency: {
|
|
206
|
+
name: 'Rinkeby Ether',
|
|
207
|
+
symbol: 'rETH',
|
|
208
|
+
decimals: 18
|
|
209
|
+
},
|
|
210
|
+
rpcUrls: {
|
|
211
|
+
alchemy: alchemyRpcUrls.rinkeby,
|
|
212
|
+
infura: infuraRpcUrls.rinkeby,
|
|
213
|
+
default: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId)
|
|
214
|
+
},
|
|
215
|
+
blockExplorers: {
|
|
216
|
+
etherscan: etherscanBlockExplorers.rinkeby,
|
|
217
|
+
default: etherscanBlockExplorers.rinkeby
|
|
218
|
+
},
|
|
219
|
+
testnet: true
|
|
220
|
+
},
|
|
221
|
+
goerli: {
|
|
222
|
+
id: chainId.goerli,
|
|
223
|
+
name: 'Goerli',
|
|
224
|
+
nativeCurrency: {
|
|
225
|
+
name: 'Goerli Ether',
|
|
226
|
+
symbol: 'gETH',
|
|
227
|
+
decimals: 18
|
|
228
|
+
},
|
|
229
|
+
rpcUrls: {
|
|
230
|
+
alchemy: alchemyRpcUrls.goerli,
|
|
231
|
+
infura: infuraRpcUrls.goerli,
|
|
232
|
+
default: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId)
|
|
233
|
+
},
|
|
234
|
+
blockExplorers: {
|
|
235
|
+
etherscan: etherscanBlockExplorers.goerli,
|
|
236
|
+
default: etherscanBlockExplorers.goerli
|
|
237
|
+
},
|
|
238
|
+
testnet: true
|
|
239
|
+
},
|
|
240
|
+
kovan: {
|
|
241
|
+
id: chainId.kovan,
|
|
242
|
+
name: 'Kovan',
|
|
243
|
+
nativeCurrency: {
|
|
244
|
+
name: 'Kovan Ether',
|
|
245
|
+
symbol: 'kETH',
|
|
246
|
+
decimals: 18
|
|
247
|
+
},
|
|
248
|
+
rpcUrls: {
|
|
249
|
+
alchemy: alchemyRpcUrls.kovan,
|
|
250
|
+
infura: infuraRpcUrls.kovan,
|
|
251
|
+
default: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId)
|
|
252
|
+
},
|
|
253
|
+
blockExplorers: {
|
|
254
|
+
etherscan: etherscanBlockExplorers.kovan,
|
|
255
|
+
default: etherscanBlockExplorers.kovan
|
|
256
|
+
},
|
|
257
|
+
testnet: true
|
|
258
|
+
},
|
|
259
|
+
optimism: {
|
|
260
|
+
id: chainId.optimism,
|
|
261
|
+
name: 'Optimism',
|
|
262
|
+
nativeCurrency: {
|
|
263
|
+
name: 'Ether',
|
|
264
|
+
symbol: 'ETH',
|
|
265
|
+
decimals: 18
|
|
266
|
+
},
|
|
267
|
+
rpcUrls: {
|
|
268
|
+
alchemy: alchemyRpcUrls.optimism,
|
|
269
|
+
infura: infuraRpcUrls.optimism,
|
|
270
|
+
default: 'https://mainnet.optimism.io'
|
|
271
|
+
},
|
|
272
|
+
blockExplorers: {
|
|
273
|
+
etherscan: etherscanBlockExplorers.optimism,
|
|
274
|
+
default: etherscanBlockExplorers.optimism
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
optimismKovan: {
|
|
278
|
+
id: chainId.optimismKovan,
|
|
279
|
+
name: 'Optimism Kovan',
|
|
280
|
+
nativeCurrency: {
|
|
281
|
+
name: 'Kovan Ether',
|
|
282
|
+
symbol: 'KOR',
|
|
283
|
+
decimals: 18
|
|
284
|
+
},
|
|
285
|
+
rpcUrls: {
|
|
286
|
+
alchemy: alchemyRpcUrls.optimismKovan,
|
|
287
|
+
infura: infuraRpcUrls.optimismKovan,
|
|
288
|
+
default: 'https://kovan.optimism.io'
|
|
289
|
+
},
|
|
290
|
+
blockExplorers: {
|
|
291
|
+
etherscan: etherscanBlockExplorers.optimismKovan,
|
|
292
|
+
default: etherscanBlockExplorers.optimismKovan
|
|
293
|
+
},
|
|
294
|
+
testnet: true
|
|
295
|
+
},
|
|
296
|
+
polygon: {
|
|
297
|
+
id: chainId.polygon,
|
|
298
|
+
name: 'Polygon',
|
|
299
|
+
nativeCurrency: {
|
|
300
|
+
name: 'MATIC',
|
|
301
|
+
symbol: 'MATIC',
|
|
302
|
+
decimals: 18
|
|
303
|
+
},
|
|
304
|
+
rpcUrls: {
|
|
305
|
+
alchemy: alchemyRpcUrls.polygon,
|
|
306
|
+
infura: infuraRpcUrls.polygon,
|
|
307
|
+
default: 'https://polygon-rpc.com'
|
|
308
|
+
},
|
|
309
|
+
blockExplorers: {
|
|
310
|
+
etherscan: etherscanBlockExplorers.polygon,
|
|
311
|
+
default: etherscanBlockExplorers.polygon
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
polygonMumbai: {
|
|
315
|
+
id: chainId.polygonMumbai,
|
|
316
|
+
name: 'Polygon Mumbai',
|
|
317
|
+
nativeCurrency: {
|
|
318
|
+
name: 'MATIC',
|
|
319
|
+
symbol: 'MATIC',
|
|
320
|
+
decimals: 18
|
|
321
|
+
},
|
|
322
|
+
rpcUrls: {
|
|
323
|
+
alchemy: alchemyRpcUrls.polygonMumbai,
|
|
324
|
+
infura: infuraRpcUrls.polygonMumbai,
|
|
325
|
+
default: 'https://matic-mumbai.chainstacklabs.com'
|
|
326
|
+
},
|
|
327
|
+
blockExplorers: {
|
|
328
|
+
etherscan: etherscanBlockExplorers.polygonMumbai,
|
|
329
|
+
default: etherscanBlockExplorers.polygonMumbai
|
|
330
|
+
},
|
|
331
|
+
testnet: true
|
|
332
|
+
},
|
|
333
|
+
arbitrum: {
|
|
334
|
+
id: chainId.arbitrum,
|
|
335
|
+
name: 'Arbitrum',
|
|
336
|
+
nativeCurrency: {
|
|
337
|
+
name: 'Ether',
|
|
338
|
+
symbol: 'AETH',
|
|
339
|
+
decimals: 18
|
|
340
|
+
},
|
|
341
|
+
rpcUrls: {
|
|
342
|
+
alchemy: alchemyRpcUrls.arbitrum,
|
|
343
|
+
infura: infuraRpcUrls.arbitrum,
|
|
344
|
+
default: 'https://arb1.arbitrum.io/rpc'
|
|
345
|
+
},
|
|
346
|
+
blockExplorers: {
|
|
347
|
+
arbitrum: {
|
|
348
|
+
name: 'Arbitrum Explorer',
|
|
349
|
+
url: 'https://explorer.arbitrum.io'
|
|
350
|
+
},
|
|
351
|
+
etherscan: etherscanBlockExplorers.arbitrum,
|
|
352
|
+
default: etherscanBlockExplorers.arbitrum
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
arbitrumRinkeby: {
|
|
356
|
+
id: chainId.arbitrumRinkeby,
|
|
357
|
+
name: 'Arbitrum Rinkeby',
|
|
358
|
+
nativeCurrency: {
|
|
359
|
+
name: 'Arbitrum Rinkeby Ether',
|
|
360
|
+
symbol: 'ARETH',
|
|
361
|
+
decimals: 18
|
|
362
|
+
},
|
|
363
|
+
rpcUrls: {
|
|
364
|
+
alchemy: alchemyRpcUrls.arbitrumRinkeby,
|
|
365
|
+
infura: infuraRpcUrls.arbitrumRinkeby,
|
|
366
|
+
default: 'https://rinkeby.arbitrum.io/rpc'
|
|
367
|
+
},
|
|
368
|
+
blockExplorers: {
|
|
369
|
+
arbitrum: {
|
|
370
|
+
name: 'Arbitrum Explorer',
|
|
371
|
+
url: 'https://rinkeby-explorer.arbitrum.io'
|
|
372
|
+
},
|
|
373
|
+
etherscan: etherscanBlockExplorers.arbitrumRinkeby,
|
|
374
|
+
default: etherscanBlockExplorers.arbitrumRinkeby
|
|
375
|
+
},
|
|
376
|
+
testnet: true
|
|
377
|
+
},
|
|
378
|
+
localhost: {
|
|
379
|
+
id: chainId.localhost,
|
|
380
|
+
name: 'Localhost',
|
|
381
|
+
rpcUrls: {
|
|
382
|
+
default: 'http://127.0.0.1:8545'
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
hardhat: {
|
|
386
|
+
id: chainId.hardhat,
|
|
387
|
+
name: 'Hardhat',
|
|
388
|
+
rpcUrls: {
|
|
389
|
+
default: 'http://127.0.0.1:8545'
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
const allChains = Object.values(chain);
|
|
394
|
+
const defaultChains = [chain.mainnet, chain.ropsten, chain.rinkeby, chain.goerli, chain.kovan];
|
|
395
|
+
const defaultL2Chains = [chain.arbitrum, chain.arbitrumRinkeby, chain.optimism, chain.optimismKovan];
|
|
396
|
+
|
|
397
|
+
function normalizeChainId(chainId) {
|
|
398
|
+
if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
|
|
399
|
+
return chainId;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
class AddChainError extends Error {
|
|
403
|
+
constructor() {
|
|
404
|
+
super(...arguments);
|
|
405
|
+
|
|
406
|
+
_defineProperty(this, "name", 'AddChainError');
|
|
407
|
+
|
|
408
|
+
_defineProperty(this, "message", 'Error adding chain');
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
class ChainNotConfiguredError extends Error {
|
|
413
|
+
constructor() {
|
|
414
|
+
super(...arguments);
|
|
415
|
+
|
|
416
|
+
_defineProperty(this, "name", 'ChainNotConfigured');
|
|
417
|
+
|
|
418
|
+
_defineProperty(this, "message", 'Chain not configured');
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
}
|
|
422
|
+
class ConnectorAlreadyConnectedError extends Error {
|
|
423
|
+
constructor() {
|
|
424
|
+
super(...arguments);
|
|
425
|
+
|
|
426
|
+
_defineProperty(this, "name", 'ConnectorAlreadyConnectedError');
|
|
427
|
+
|
|
428
|
+
_defineProperty(this, "message", 'Connector already connected');
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
}
|
|
432
|
+
class ConnectorNotFoundError extends Error {
|
|
433
|
+
constructor() {
|
|
434
|
+
super(...arguments);
|
|
435
|
+
|
|
436
|
+
_defineProperty(this, "name", 'ConnectorNotFoundError');
|
|
437
|
+
|
|
438
|
+
_defineProperty(this, "message", 'Connector not found');
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
}
|
|
442
|
+
class SwitchChainError extends Error {
|
|
443
|
+
constructor() {
|
|
444
|
+
super(...arguments);
|
|
445
|
+
|
|
446
|
+
_defineProperty(this, "name", 'SwitchChainError');
|
|
447
|
+
|
|
448
|
+
_defineProperty(this, "message", 'Error switching chain');
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
}
|
|
452
|
+
class SwitchChainNotSupportedError extends Error {
|
|
453
|
+
constructor() {
|
|
454
|
+
super(...arguments);
|
|
455
|
+
|
|
456
|
+
_defineProperty(this, "name", 'SwitchChainNotSupportedError');
|
|
457
|
+
|
|
458
|
+
_defineProperty(this, "message", 'Switch chain not supported by connector');
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
}
|
|
462
|
+
class UserRejectedRequestError extends Error {
|
|
463
|
+
constructor() {
|
|
464
|
+
super(...arguments);
|
|
465
|
+
|
|
466
|
+
_defineProperty(this, "name", 'UserRejectedRequestError');
|
|
467
|
+
|
|
468
|
+
_defineProperty(this, "message", 'User rejected request');
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
class Connector extends EventEmitter__default["default"] {
|
|
474
|
+
/** Unique connector id */
|
|
475
|
+
|
|
476
|
+
/** Connector name */
|
|
477
|
+
|
|
478
|
+
/** Chains connector supports */
|
|
479
|
+
|
|
480
|
+
/** Options to use with connector */
|
|
481
|
+
|
|
482
|
+
/** Whether connector is usable */
|
|
483
|
+
constructor(_ref) {
|
|
484
|
+
let {
|
|
485
|
+
chains = defaultChains,
|
|
486
|
+
options
|
|
487
|
+
} = _ref;
|
|
488
|
+
super();
|
|
489
|
+
|
|
490
|
+
_defineProperty(this, "id", void 0);
|
|
491
|
+
|
|
492
|
+
_defineProperty(this, "name", void 0);
|
|
493
|
+
|
|
494
|
+
_defineProperty(this, "chains", void 0);
|
|
495
|
+
|
|
496
|
+
_defineProperty(this, "options", void 0);
|
|
497
|
+
|
|
498
|
+
_defineProperty(this, "ready", void 0);
|
|
499
|
+
|
|
500
|
+
this.chains = chains;
|
|
501
|
+
this.options = options;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
getBlockExplorerUrls(chain) {
|
|
505
|
+
var _chain$blockExplorers;
|
|
506
|
+
|
|
507
|
+
const blockExplorer = (_chain$blockExplorers = chain.blockExplorers) === null || _chain$blockExplorers === void 0 ? void 0 : _chain$blockExplorers.default;
|
|
508
|
+
if (Array.isArray(blockExplorer)) return blockExplorer.map(x => x.url);
|
|
509
|
+
if (blockExplorer !== null && blockExplorer !== void 0 && blockExplorer.url) return [blockExplorer.url];
|
|
510
|
+
return [];
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
getRpcUrls(chain) {
|
|
514
|
+
return typeof chain.rpcUrls.default === 'string' ? [chain.rpcUrls.default] : chain.rpcUrls.default;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
isChainUnsupported(chainId) {
|
|
518
|
+
return !this.chains.some(x => x.id === chainId);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
exports.AddChainError = AddChainError;
|
|
524
|
+
exports.ChainNotConfiguredError = ChainNotConfiguredError;
|
|
525
|
+
exports.Connector = Connector;
|
|
526
|
+
exports.ConnectorAlreadyConnectedError = ConnectorAlreadyConnectedError;
|
|
527
|
+
exports.ConnectorNotFoundError = ConnectorNotFoundError;
|
|
528
|
+
exports.SwitchChainError = SwitchChainError;
|
|
529
|
+
exports.SwitchChainNotSupportedError = SwitchChainNotSupportedError;
|
|
530
|
+
exports.UserRejectedRequestError = UserRejectedRequestError;
|
|
531
|
+
exports._checkPrivateRedeclaration = _checkPrivateRedeclaration;
|
|
532
|
+
exports._classPrivateFieldGet = _classPrivateFieldGet;
|
|
533
|
+
exports._classPrivateFieldInitSpec = _classPrivateFieldInitSpec;
|
|
534
|
+
exports._classPrivateFieldSet = _classPrivateFieldSet;
|
|
535
|
+
exports._defineProperty = _defineProperty;
|
|
536
|
+
exports.alchemyRpcUrls = alchemyRpcUrls;
|
|
537
|
+
exports.allChains = allChains;
|
|
538
|
+
exports.chain = chain;
|
|
539
|
+
exports.chainId = chainId;
|
|
540
|
+
exports.defaultChains = defaultChains;
|
|
541
|
+
exports.defaultL2Chains = defaultL2Chains;
|
|
542
|
+
exports.etherscanBlockExplorers = etherscanBlockExplorers;
|
|
543
|
+
exports.infuraRpcUrls = infuraRpcUrls;
|
|
544
|
+
exports.normalizeChainId = normalizeChainId;
|