@wagmi/core 0.2.0-next.7 → 0.2.0-next.8
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/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 +96 -153
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +96 -153
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +96 -153
- 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-7ffc0425.cjs.prod.js +541 -0
- package/dist/base-82f423a9.esm.js +515 -0
- package/dist/base-b3073ce2.cjs.dev.js +541 -0
- package/dist/{classPrivateMethodGet-38b54c7a.cjs.dev.js → classPrivateMethodGet-0dc9fedc.cjs.dev.js} +1 -1
- package/dist/{classPrivateMethodGet-c9db96d6.esm.js → classPrivateMethodGet-1c660f09.esm.js} +1 -1
- package/dist/{classPrivateMethodGet-0e9a7925.cjs.prod.js → classPrivateMethodGet-c084b176.cjs.prod.js} +1 -1
- package/dist/declarations/src/actions/accounts/connect.d.ts +12 -3
- package/dist/declarations/src/actions/accounts/index.d.ts +1 -1
- package/dist/declarations/src/actions/accounts/switchNetwork.d.ts +1 -1
- package/dist/declarations/src/actions/index.d.ts +1 -1
- package/dist/declarations/src/connectors/base.d.ts +3 -1
- package/dist/declarations/src/connectors/coinbaseWallet.d.ts +9 -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 +16 -6
- package/dist/declarations/src/constants/index.d.ts +6 -2
- package/dist/declarations/src/constants/keys.d.ts +2 -0
- package/dist/declarations/src/constants/rpcs.d.ts +7 -0
- package/dist/declarations/src/index.d.ts +8 -5
- package/dist/declarations/src/types/index.d.ts +10 -5
- package/dist/wagmi-core.cjs.dev.js +518 -1024
- package/dist/wagmi-core.cjs.prod.js +518 -1024
- package/dist/wagmi-core.esm.js +516 -1025
- package/package.json +2 -2
- 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/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
|
@@ -0,0 +1,541 @@
|
|
|
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
|
+
|
|
123
|
+
const alchemyRpcUrls = {
|
|
124
|
+
mainnet: 'https://eth-mainnet.alchemyapi.io/v2',
|
|
125
|
+
ropsten: 'https://eth-ropsten.alchemyapi.io/v2',
|
|
126
|
+
rinkeby: 'https://eth-rinkeby.alchemyapi.io/v2',
|
|
127
|
+
goerli: 'https://eth-goerli.alchemyapi.io/v2',
|
|
128
|
+
kovan: 'https://eth-kovan.alchemyapi.io/v2',
|
|
129
|
+
optimism: 'https://opt-mainnet.g.alchemy.com/v2',
|
|
130
|
+
optimismKovan: 'https://opt-kovan.g.alchemy.com/v2',
|
|
131
|
+
polygon: 'https://polygon-mainnet.g.alchemy.com/v2',
|
|
132
|
+
polygonMumbai: 'https://polygon-mumbai.g.alchemy.com/v2',
|
|
133
|
+
arbitrum: 'https://arb-mainnet.g.alchemy.com/v2',
|
|
134
|
+
arbitrumRinkeby: 'https://arb-rinkeby.g.alchemy.com/v2'
|
|
135
|
+
};
|
|
136
|
+
const infuraRpcUrls = {
|
|
137
|
+
mainnet: 'https://mainnet.infura.io/v3',
|
|
138
|
+
ropsten: 'https://ropsten.infura.io/v3',
|
|
139
|
+
rinkeby: 'https://rinkeby.infura.io/v3',
|
|
140
|
+
goerli: 'https://goerli.infura.io/v3',
|
|
141
|
+
kovan: 'https://kovan.infura.io/v3',
|
|
142
|
+
optimism: 'https://optimism-mainnet.infura.io/v3',
|
|
143
|
+
optimismKovan: 'https://optimism-kovan.infura.io/v3',
|
|
144
|
+
polygon: 'https://polygon-mainnet.infura.io/v3',
|
|
145
|
+
polygonMumbai: 'https://polygon-mumbai.infura.io/v3',
|
|
146
|
+
arbitrum: 'https://arbitrum-mainnet.infura.io/v3',
|
|
147
|
+
arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const chainId = {
|
|
151
|
+
mainnet: 1,
|
|
152
|
+
ropsten: 3,
|
|
153
|
+
rinkeby: 4,
|
|
154
|
+
goerli: 5,
|
|
155
|
+
kovan: 42,
|
|
156
|
+
optimism: 10,
|
|
157
|
+
optimismKovan: 69,
|
|
158
|
+
polygon: 137,
|
|
159
|
+
polygonMumbai: 80001,
|
|
160
|
+
arbitrum: 42161,
|
|
161
|
+
arbitrumRinkeby: 421611,
|
|
162
|
+
localhost: 1337,
|
|
163
|
+
hardhat: 31337
|
|
164
|
+
};
|
|
165
|
+
const chain = {
|
|
166
|
+
mainnet: {
|
|
167
|
+
id: chainId.mainnet,
|
|
168
|
+
name: 'Mainnet',
|
|
169
|
+
nativeCurrency: {
|
|
170
|
+
name: 'Ether',
|
|
171
|
+
symbol: 'ETH',
|
|
172
|
+
decimals: 18
|
|
173
|
+
},
|
|
174
|
+
rpcUrls: {
|
|
175
|
+
alchemy: alchemyRpcUrls.mainnet,
|
|
176
|
+
infura: infuraRpcUrls.mainnet,
|
|
177
|
+
default: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId)
|
|
178
|
+
},
|
|
179
|
+
blockExplorers: {
|
|
180
|
+
etherscan: etherscanBlockExplorers.mainnet,
|
|
181
|
+
default: etherscanBlockExplorers.mainnet
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
ropsten: {
|
|
185
|
+
id: chainId.ropsten,
|
|
186
|
+
name: 'Ropsten',
|
|
187
|
+
nativeCurrency: {
|
|
188
|
+
name: 'Ropsten Ether',
|
|
189
|
+
symbol: 'ropETH',
|
|
190
|
+
decimals: 18
|
|
191
|
+
},
|
|
192
|
+
rpcUrls: {
|
|
193
|
+
alchemy: alchemyRpcUrls.ropsten,
|
|
194
|
+
infura: infuraRpcUrls.ropsten,
|
|
195
|
+
default: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId)
|
|
196
|
+
},
|
|
197
|
+
blockExplorers: {
|
|
198
|
+
etherscan: etherscanBlockExplorers.ropsten,
|
|
199
|
+
default: etherscanBlockExplorers.ropsten
|
|
200
|
+
},
|
|
201
|
+
testnet: true
|
|
202
|
+
},
|
|
203
|
+
rinkeby: {
|
|
204
|
+
id: chainId.rinkeby,
|
|
205
|
+
name: 'Rinkeby',
|
|
206
|
+
nativeCurrency: {
|
|
207
|
+
name: 'Rinkeby Ether',
|
|
208
|
+
symbol: 'rETH',
|
|
209
|
+
decimals: 18
|
|
210
|
+
},
|
|
211
|
+
rpcUrls: {
|
|
212
|
+
alchemy: alchemyRpcUrls.rinkeby,
|
|
213
|
+
infura: infuraRpcUrls.rinkeby,
|
|
214
|
+
default: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId)
|
|
215
|
+
},
|
|
216
|
+
blockExplorers: {
|
|
217
|
+
etherscan: etherscanBlockExplorers.rinkeby,
|
|
218
|
+
default: etherscanBlockExplorers.rinkeby
|
|
219
|
+
},
|
|
220
|
+
testnet: true
|
|
221
|
+
},
|
|
222
|
+
goerli: {
|
|
223
|
+
id: chainId.goerli,
|
|
224
|
+
name: 'Goerli',
|
|
225
|
+
nativeCurrency: {
|
|
226
|
+
name: 'Goerli Ether',
|
|
227
|
+
symbol: 'gETH',
|
|
228
|
+
decimals: 18
|
|
229
|
+
},
|
|
230
|
+
rpcUrls: {
|
|
231
|
+
alchemy: alchemyRpcUrls.goerli,
|
|
232
|
+
infura: infuraRpcUrls.goerli,
|
|
233
|
+
default: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId)
|
|
234
|
+
},
|
|
235
|
+
blockExplorers: {
|
|
236
|
+
etherscan: etherscanBlockExplorers.goerli,
|
|
237
|
+
default: etherscanBlockExplorers.goerli
|
|
238
|
+
},
|
|
239
|
+
testnet: true
|
|
240
|
+
},
|
|
241
|
+
kovan: {
|
|
242
|
+
id: chainId.kovan,
|
|
243
|
+
name: 'Kovan',
|
|
244
|
+
nativeCurrency: {
|
|
245
|
+
name: 'Kovan Ether',
|
|
246
|
+
symbol: 'kETH',
|
|
247
|
+
decimals: 18
|
|
248
|
+
},
|
|
249
|
+
rpcUrls: {
|
|
250
|
+
alchemy: alchemyRpcUrls.kovan,
|
|
251
|
+
infura: infuraRpcUrls.kovan,
|
|
252
|
+
default: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId)
|
|
253
|
+
},
|
|
254
|
+
blockExplorers: {
|
|
255
|
+
etherscan: etherscanBlockExplorers.kovan,
|
|
256
|
+
default: etherscanBlockExplorers.kovan
|
|
257
|
+
},
|
|
258
|
+
testnet: true
|
|
259
|
+
},
|
|
260
|
+
optimism: {
|
|
261
|
+
id: chainId.optimism,
|
|
262
|
+
name: 'Optimism',
|
|
263
|
+
nativeCurrency: {
|
|
264
|
+
name: 'Ether',
|
|
265
|
+
symbol: 'ETH',
|
|
266
|
+
decimals: 18
|
|
267
|
+
},
|
|
268
|
+
rpcUrls: {
|
|
269
|
+
alchemy: alchemyRpcUrls.optimism,
|
|
270
|
+
infura: infuraRpcUrls.optimism,
|
|
271
|
+
default: ['https://mainnet.optimism.io']
|
|
272
|
+
},
|
|
273
|
+
blockExplorers: {
|
|
274
|
+
etherscan: etherscanBlockExplorers.optimism,
|
|
275
|
+
default: etherscanBlockExplorers.optimism
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
optimismKovan: {
|
|
279
|
+
id: chainId.optimismKovan,
|
|
280
|
+
name: 'Optimism Kovan',
|
|
281
|
+
nativeCurrency: {
|
|
282
|
+
name: 'Kovan Ether',
|
|
283
|
+
symbol: 'KOR',
|
|
284
|
+
decimals: 18
|
|
285
|
+
},
|
|
286
|
+
rpcUrls: {
|
|
287
|
+
alchemy: alchemyRpcUrls.optimismKovan,
|
|
288
|
+
infura: infuraRpcUrls.optimismKovan,
|
|
289
|
+
default: ['https://kovan.optimism.io']
|
|
290
|
+
},
|
|
291
|
+
blockExplorers: {
|
|
292
|
+
etherscan: etherscanBlockExplorers.optimismKovan,
|
|
293
|
+
default: etherscanBlockExplorers.optimismKovan
|
|
294
|
+
},
|
|
295
|
+
testnet: true
|
|
296
|
+
},
|
|
297
|
+
polygon: {
|
|
298
|
+
id: chainId.polygon,
|
|
299
|
+
name: 'Polygon Mainnet',
|
|
300
|
+
nativeCurrency: {
|
|
301
|
+
name: 'MATIC',
|
|
302
|
+
symbol: 'MATIC',
|
|
303
|
+
decimals: 18
|
|
304
|
+
},
|
|
305
|
+
rpcUrls: {
|
|
306
|
+
alchemy: alchemyRpcUrls.polygon,
|
|
307
|
+
infura: infuraRpcUrls.polygon,
|
|
308
|
+
default: ['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']
|
|
309
|
+
},
|
|
310
|
+
blockExplorers: {
|
|
311
|
+
etherscan: etherscanBlockExplorers.polygon,
|
|
312
|
+
default: etherscanBlockExplorers.polygon
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
polygonMumbai: {
|
|
316
|
+
id: chainId.polygonMumbai,
|
|
317
|
+
name: 'Mumbai',
|
|
318
|
+
nativeCurrency: {
|
|
319
|
+
name: 'MATIC',
|
|
320
|
+
symbol: 'MATIC',
|
|
321
|
+
decimals: 18
|
|
322
|
+
},
|
|
323
|
+
rpcUrls: {
|
|
324
|
+
alchemy: alchemyRpcUrls.polygonMumbai,
|
|
325
|
+
infura: infuraRpcUrls.polygonMumbai,
|
|
326
|
+
default: ['https://matic-mumbai.chainstacklabs.com', 'https://rpc-mumbai.maticvigil.com', 'https://matic-testnet-archive-rpc.bwarelabs.com']
|
|
327
|
+
},
|
|
328
|
+
blockExplorers: {
|
|
329
|
+
etherscan: etherscanBlockExplorers.polygonMumbai,
|
|
330
|
+
default: etherscanBlockExplorers.polygonMumbai
|
|
331
|
+
},
|
|
332
|
+
testnet: true
|
|
333
|
+
},
|
|
334
|
+
arbitrum: {
|
|
335
|
+
id: chainId.arbitrum,
|
|
336
|
+
name: 'Arbitrum One',
|
|
337
|
+
nativeCurrency: {
|
|
338
|
+
name: 'Ether',
|
|
339
|
+
symbol: 'AETH',
|
|
340
|
+
decimals: 18
|
|
341
|
+
},
|
|
342
|
+
rpcUrls: {
|
|
343
|
+
alchemy: alchemyRpcUrls.arbitrum,
|
|
344
|
+
infura: infuraRpcUrls.arbitrum,
|
|
345
|
+
default: ['https://arb1.arbitrum.io/rpc']
|
|
346
|
+
},
|
|
347
|
+
blockExplorers: {
|
|
348
|
+
etherscan: etherscanBlockExplorers.arbitrum,
|
|
349
|
+
default: [etherscanBlockExplorers.arbitrum, {
|
|
350
|
+
name: 'Arbitrum Explorer',
|
|
351
|
+
url: 'https://explorer.arbitrum.io'
|
|
352
|
+
}]
|
|
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
|
+
etherscan: etherscanBlockExplorers.arbitrumRinkeby,
|
|
370
|
+
default: [etherscanBlockExplorers.arbitrumRinkeby, {
|
|
371
|
+
name: 'Arbitrum Explorer',
|
|
372
|
+
url: 'https://rinkeby-explorer.arbitrum.io'
|
|
373
|
+
}]
|
|
374
|
+
},
|
|
375
|
+
testnet: true
|
|
376
|
+
},
|
|
377
|
+
localhost: {
|
|
378
|
+
id: chainId.localhost,
|
|
379
|
+
name: 'Localhost',
|
|
380
|
+
rpcUrls: {
|
|
381
|
+
default: 'http://127.0.0.1:8545'
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
hardhat: {
|
|
385
|
+
id: chainId.hardhat,
|
|
386
|
+
name: 'Hardhat',
|
|
387
|
+
rpcUrls: {
|
|
388
|
+
default: 'http://127.0.0.1:8545'
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
const allChains = Object.values(chain);
|
|
393
|
+
const defaultChains = [chain.mainnet, chain.ropsten, chain.rinkeby, chain.goerli, chain.kovan];
|
|
394
|
+
|
|
395
|
+
function normalizeChainId(chainId) {
|
|
396
|
+
if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
|
|
397
|
+
return chainId;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
class AddChainError extends Error {
|
|
401
|
+
constructor() {
|
|
402
|
+
super(...arguments);
|
|
403
|
+
|
|
404
|
+
_defineProperty(this, "name", 'AddChainError');
|
|
405
|
+
|
|
406
|
+
_defineProperty(this, "message", 'Error adding chain');
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
}
|
|
410
|
+
class ChainNotConfiguredError extends Error {
|
|
411
|
+
constructor() {
|
|
412
|
+
super(...arguments);
|
|
413
|
+
|
|
414
|
+
_defineProperty(this, "name", 'ChainNotConfigured');
|
|
415
|
+
|
|
416
|
+
_defineProperty(this, "message", 'Chain not configured');
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
}
|
|
420
|
+
class ConnectorAlreadyConnectedError extends Error {
|
|
421
|
+
constructor() {
|
|
422
|
+
super(...arguments);
|
|
423
|
+
|
|
424
|
+
_defineProperty(this, "name", 'ConnectorAlreadyConnectedError');
|
|
425
|
+
|
|
426
|
+
_defineProperty(this, "message", 'Connector already connected');
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
}
|
|
430
|
+
class ConnectorNotFoundError extends Error {
|
|
431
|
+
constructor() {
|
|
432
|
+
super(...arguments);
|
|
433
|
+
|
|
434
|
+
_defineProperty(this, "name", 'ConnectorNotFoundError');
|
|
435
|
+
|
|
436
|
+
_defineProperty(this, "message", 'Connector not found');
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
}
|
|
440
|
+
class SwitchChainError extends Error {
|
|
441
|
+
constructor() {
|
|
442
|
+
super(...arguments);
|
|
443
|
+
|
|
444
|
+
_defineProperty(this, "name", 'SwitchChainError');
|
|
445
|
+
|
|
446
|
+
_defineProperty(this, "message", 'Error switching chain');
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
}
|
|
450
|
+
class SwitchChainNotSupportedError extends Error {
|
|
451
|
+
constructor() {
|
|
452
|
+
super(...arguments);
|
|
453
|
+
|
|
454
|
+
_defineProperty(this, "name", 'SwitchChainNotSupportedError');
|
|
455
|
+
|
|
456
|
+
_defineProperty(this, "message", 'Switch chain not supported by connector');
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
}
|
|
460
|
+
class UserRejectedRequestError extends Error {
|
|
461
|
+
constructor() {
|
|
462
|
+
super(...arguments);
|
|
463
|
+
|
|
464
|
+
_defineProperty(this, "name", 'UserRejectedRequestError');
|
|
465
|
+
|
|
466
|
+
_defineProperty(this, "message", 'User rejected request');
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
class Connector extends EventEmitter__default["default"] {
|
|
472
|
+
/** Unique connector id */
|
|
473
|
+
|
|
474
|
+
/** Connector name */
|
|
475
|
+
|
|
476
|
+
/** Chains connector supports */
|
|
477
|
+
|
|
478
|
+
/** Options to use with connector */
|
|
479
|
+
|
|
480
|
+
/** Whether connector is usable */
|
|
481
|
+
constructor(_ref) {
|
|
482
|
+
let {
|
|
483
|
+
chains = defaultChains,
|
|
484
|
+
options
|
|
485
|
+
} = _ref;
|
|
486
|
+
super();
|
|
487
|
+
|
|
488
|
+
_defineProperty(this, "id", void 0);
|
|
489
|
+
|
|
490
|
+
_defineProperty(this, "name", void 0);
|
|
491
|
+
|
|
492
|
+
_defineProperty(this, "chains", void 0);
|
|
493
|
+
|
|
494
|
+
_defineProperty(this, "options", void 0);
|
|
495
|
+
|
|
496
|
+
_defineProperty(this, "ready", void 0);
|
|
497
|
+
|
|
498
|
+
this.chains = chains;
|
|
499
|
+
this.options = options;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
getBlockExplorerUrls(chain) {
|
|
503
|
+
var _chain$blockExplorers;
|
|
504
|
+
|
|
505
|
+
const blockExplorer = (_chain$blockExplorers = chain.blockExplorers) === null || _chain$blockExplorers === void 0 ? void 0 : _chain$blockExplorers.default;
|
|
506
|
+
if (Array.isArray(blockExplorer)) return blockExplorer.map(x => x.url);
|
|
507
|
+
if (blockExplorer !== null && blockExplorer !== void 0 && blockExplorer.url) return [blockExplorer.url];
|
|
508
|
+
return [];
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
getRpcUrls(chain) {
|
|
512
|
+
return typeof chain.rpcUrls.default === 'string' ? [chain.rpcUrls.default] : chain.rpcUrls.default;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
isChainUnsupported(chainId) {
|
|
516
|
+
return !this.chains.some(x => x.id === chainId);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
exports.AddChainError = AddChainError;
|
|
522
|
+
exports.ChainNotConfiguredError = ChainNotConfiguredError;
|
|
523
|
+
exports.Connector = Connector;
|
|
524
|
+
exports.ConnectorAlreadyConnectedError = ConnectorAlreadyConnectedError;
|
|
525
|
+
exports.ConnectorNotFoundError = ConnectorNotFoundError;
|
|
526
|
+
exports.SwitchChainError = SwitchChainError;
|
|
527
|
+
exports.SwitchChainNotSupportedError = SwitchChainNotSupportedError;
|
|
528
|
+
exports.UserRejectedRequestError = UserRejectedRequestError;
|
|
529
|
+
exports._checkPrivateRedeclaration = _checkPrivateRedeclaration;
|
|
530
|
+
exports._classPrivateFieldGet = _classPrivateFieldGet;
|
|
531
|
+
exports._classPrivateFieldInitSpec = _classPrivateFieldInitSpec;
|
|
532
|
+
exports._classPrivateFieldSet = _classPrivateFieldSet;
|
|
533
|
+
exports._defineProperty = _defineProperty;
|
|
534
|
+
exports.alchemyRpcUrls = alchemyRpcUrls;
|
|
535
|
+
exports.allChains = allChains;
|
|
536
|
+
exports.chain = chain;
|
|
537
|
+
exports.chainId = chainId;
|
|
538
|
+
exports.defaultChains = defaultChains;
|
|
539
|
+
exports.etherscanBlockExplorers = etherscanBlockExplorers;
|
|
540
|
+
exports.infuraRpcUrls = infuraRpcUrls;
|
|
541
|
+
exports.normalizeChainId = normalizeChainId;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { BaseProvider } from '@ethersproject/providers';
|
|
1
2
|
import { Client } from '../../client';
|
|
2
|
-
import { Connector } from '../../connectors';
|
|
3
|
+
import { Connector, ConnectorData } from '../../connectors';
|
|
4
|
+
export declare type ConnectArgs = {
|
|
5
|
+
/** Connector to connect */
|
|
6
|
+
connector: Connector;
|
|
7
|
+
};
|
|
8
|
+
declare type Data = Required<ConnectorData<BaseProvider>>;
|
|
3
9
|
export declare type ConnectResult = {
|
|
4
|
-
|
|
10
|
+
account: Data['account'];
|
|
11
|
+
chain: Data['chain'];
|
|
5
12
|
connector: Client['connector'];
|
|
13
|
+
provider: Data['provider'];
|
|
6
14
|
};
|
|
7
|
-
export declare function connect(connector:
|
|
15
|
+
export declare function connect({ connector, }: ConnectArgs): Promise<ConnectResult>;
|
|
16
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { connect, type ConnectResult } from './connect';
|
|
1
|
+
export { connect, type ConnectArgs, type ConnectResult } from './connect';
|
|
2
2
|
export { disconnect } from './disconnect';
|
|
3
3
|
export { fetchBalance, type FetchBalanceArgs, type FetchBalanceResult, } from './fetchBalance';
|
|
4
4
|
export { fetchSigner, type FetchSignerResult } from './fetchSigner';
|
|
@@ -3,4 +3,4 @@ export declare type SwitchNetworkArgs = {
|
|
|
3
3
|
chainId: number;
|
|
4
4
|
};
|
|
5
5
|
export declare type SwitchNetworkResult = Chain;
|
|
6
|
-
export declare function switchNetwork(
|
|
6
|
+
export declare function switchNetwork({ chainId, }: SwitchNetworkArgs): Promise<SwitchNetworkResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { connect, disconnect, fetchBalance, fetchSigner, getAccount, getNetwork, signMessage, signTypedData, switchNetwork, watchAccount, watchBalance, watchNetwork, watchSigner, type ConnectResult, type FetchBalanceArgs, type FetchBalanceResult, type FetchSignerResult, type GetAccountResult, type GetNetworkResult, type SignMessageArgs, type SignMessageResult, type SignTypedDataArgs, type SignTypedDataResult, type SwitchNetworkArgs, type SwitchNetworkResult, type WatchAccountCallback, type WatchBalanceCallback, type WatchNetworkCallback, type WatchSignerCallback, } from './accounts';
|
|
1
|
+
export { connect, disconnect, fetchBalance, fetchSigner, getAccount, getNetwork, signMessage, signTypedData, switchNetwork, watchAccount, watchBalance, watchNetwork, watchSigner, type ConnectArgs, type ConnectResult, type FetchBalanceArgs, type FetchBalanceResult, type FetchSignerResult, type GetAccountResult, type GetNetworkResult, type SignMessageArgs, type SignMessageResult, type SignTypedDataArgs, type SignTypedDataResult, type SwitchNetworkArgs, type SwitchNetworkResult, type WatchAccountCallback, type WatchBalanceCallback, type WatchNetworkCallback, type WatchSignerCallback, } from './accounts';
|
|
2
2
|
export { getContract, readContract, watchContractEvent, watchReadContract, writeContract, type GetContractArgs, type ReadContractArgs, type ReadContractConfig, type ReadContractResult, type WatchReadContractArgs, type WatchReadContractConfig, type WatchReadContractResult, type WriteContractArgs, type WriteContractConfig, type WriteContractResult, } from './contracts';
|
|
3
3
|
export { fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, watchEnsAddress, watchEnsAvatar, watchEnsName, watchEnsResolver, type FetchEnsAddressArgs, type FetchEnsAddressResult, type FetchEnsAvatarArgs, type FetchEnsAvatarResult, type FetchEnsNameArgs, type FetchEnsNameResult, type FetchEnsResolverArgs, type FetchEnsResolverResult, type WatchEnsAddressCallback, type WatchEnsAvatarCallback, type WatchEnsNameCallback, type WatchEnsResolverCallback, } from './ens';
|
|
4
4
|
export { fetchBlockNumber, fetchFeeData, watchBlockNumber, watchFeeData, type FetchBlockNumberResult, type FetchFeeDataArgs, type FetchFeeDataResult, type WatchBlockNumberArgs, type WatchBlockNumberCallback, type WatchFeeDataArgs, type WatchFeeDataCallback, } from './network-status';
|
|
@@ -34,7 +34,7 @@ export declare abstract class Connector<Provider = any, Options = any> extends E
|
|
|
34
34
|
chains?: Chain[];
|
|
35
35
|
options: Options;
|
|
36
36
|
});
|
|
37
|
-
abstract connect(): Promise<ConnectorData
|
|
37
|
+
abstract connect(): Promise<Required<ConnectorData>>;
|
|
38
38
|
abstract disconnect(): Promise<void>;
|
|
39
39
|
abstract getAccount(): Promise<string>;
|
|
40
40
|
abstract getChainId(): Promise<number>;
|
|
@@ -50,5 +50,7 @@ export declare abstract class Connector<Provider = any, Options = any> extends E
|
|
|
50
50
|
protected abstract onAccountsChanged(accounts: string[]): void;
|
|
51
51
|
protected abstract onChainChanged(chain: number | string): void;
|
|
52
52
|
protected abstract onDisconnect(error: Error): void;
|
|
53
|
+
protected getBlockExplorerUrls(chain: Chain): string[];
|
|
54
|
+
protected getRpcUrls(chain: Chain): string[];
|
|
53
55
|
protected isChainUnsupported(chainId: number): boolean;
|
|
54
56
|
}
|
|
@@ -4,7 +4,16 @@ import type { CoinbaseWalletSDKOptions } from '@coinbase/wallet-sdk/dist/Coinbas
|
|
|
4
4
|
import { Chain } from '../types';
|
|
5
5
|
import { Connector } from './base';
|
|
6
6
|
declare type Options = CoinbaseWalletSDKOptions & {
|
|
7
|
+
/**
|
|
8
|
+
* Fallback Ethereum JSON RPC URL
|
|
9
|
+
* @default ""
|
|
10
|
+
*/
|
|
7
11
|
jsonRpcUrl?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Fallback Ethereum Chain ID
|
|
14
|
+
* @default 1
|
|
15
|
+
*/
|
|
16
|
+
chainId?: number;
|
|
8
17
|
};
|
|
9
18
|
export declare class CoinbaseWalletConnector extends Connector<CoinbaseWalletProvider, Options> {
|
|
10
19
|
#private;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChainName } from './chains';
|
|
2
|
+
export declare type BlockExplorerName = 'etherscan';
|
|
3
|
+
export declare type BlockExplorer = {
|
|
4
|
+
name: string;
|
|
5
|
+
url: string;
|
|
6
|
+
};
|
|
7
|
+
declare type EtherscanChains = Extract<ChainName, 'mainnet' | 'ropsten' | 'rinkeby' | 'goerli' | 'kovan' | 'optimism' | 'optimismKovan' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumRinkeby'>;
|
|
8
|
+
export declare const etherscanBlockExplorers: Record<EtherscanChains, BlockExplorer>;
|
|
9
|
+
export {};
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { Chain } from '../types';
|
|
2
|
-
declare type ChainName = '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export declare type ChainName = 'arbitrum' | 'arbitrumRinkeby' | 'goerli' | 'hardhat' | 'kovan' | 'localhost' | 'mainnet' | 'optimism' | 'optimismKovan' | 'polygon' | 'polygonMumbai' | 'rinkeby' | 'ropsten';
|
|
3
|
+
export declare const chainId: {
|
|
4
|
+
readonly mainnet: 1;
|
|
5
|
+
readonly ropsten: 3;
|
|
6
|
+
readonly rinkeby: 4;
|
|
7
|
+
readonly goerli: 5;
|
|
8
|
+
readonly kovan: 42;
|
|
9
|
+
readonly optimism: 10;
|
|
10
|
+
readonly optimismKovan: 69;
|
|
11
|
+
readonly polygon: 137;
|
|
12
|
+
readonly polygonMumbai: 80001;
|
|
13
|
+
readonly arbitrum: 42161;
|
|
14
|
+
readonly arbitrumRinkeby: 421611;
|
|
15
|
+
readonly localhost: 1337;
|
|
16
|
+
readonly hardhat: 31337;
|
|
17
|
+
};
|
|
7
18
|
export declare const chain: Record<ChainName, Chain>;
|
|
8
19
|
export declare const allChains: Chain[];
|
|
9
20
|
export declare const defaultChains: Chain[];
|
|
10
|
-
export {};
|