@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,517 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
|
|
3
|
+
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
4
|
+
if (privateCollection.has(obj)) {
|
|
5
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
10
|
+
_checkPrivateRedeclaration(obj, privateMap);
|
|
11
|
+
privateMap.set(obj, value);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function _defineProperty(obj, key, value) {
|
|
15
|
+
if (key in obj) {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
value: value,
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
obj[key] = value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _classApplyDescriptorGet(receiver, descriptor) {
|
|
30
|
+
if (descriptor.get) {
|
|
31
|
+
return descriptor.get.call(receiver);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return descriptor.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) {
|
|
38
|
+
if (!privateMap.has(receiver)) {
|
|
39
|
+
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return privateMap.get(receiver);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function _classPrivateFieldGet(receiver, privateMap) {
|
|
46
|
+
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
47
|
+
return _classApplyDescriptorGet(receiver, descriptor);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) {
|
|
51
|
+
if (descriptor.set) {
|
|
52
|
+
descriptor.set.call(receiver, value);
|
|
53
|
+
} else {
|
|
54
|
+
if (!descriptor.writable) {
|
|
55
|
+
throw new TypeError("attempted to set read only private field");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
descriptor.value = value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
63
|
+
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
|
|
64
|
+
_classApplyDescriptorSet(receiver, descriptor, value);
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const etherscanBlockExplorers = {
|
|
69
|
+
mainnet: {
|
|
70
|
+
name: 'Etherscan',
|
|
71
|
+
url: 'https://etherscan.io'
|
|
72
|
+
},
|
|
73
|
+
ropsten: {
|
|
74
|
+
name: 'Etherscan',
|
|
75
|
+
url: 'https://ropsten.etherscan.io'
|
|
76
|
+
},
|
|
77
|
+
rinkeby: {
|
|
78
|
+
name: 'Etherscan',
|
|
79
|
+
url: 'https://rinkeby.etherscan.io'
|
|
80
|
+
},
|
|
81
|
+
goerli: {
|
|
82
|
+
name: 'Etherscan',
|
|
83
|
+
url: 'https://goerli.etherscan.io'
|
|
84
|
+
},
|
|
85
|
+
kovan: {
|
|
86
|
+
name: 'Etherscan',
|
|
87
|
+
url: 'https://kovan.etherscan.io'
|
|
88
|
+
},
|
|
89
|
+
optimism: {
|
|
90
|
+
name: 'Etherscan',
|
|
91
|
+
url: 'https://optimistic.etherscan.io'
|
|
92
|
+
},
|
|
93
|
+
optimismKovan: {
|
|
94
|
+
name: 'Etherscan',
|
|
95
|
+
url: 'https://kovan-optimistic.etherscan.io'
|
|
96
|
+
},
|
|
97
|
+
polygon: {
|
|
98
|
+
name: 'PolygonScan',
|
|
99
|
+
url: 'https://polygonscan.com'
|
|
100
|
+
},
|
|
101
|
+
polygonMumbai: {
|
|
102
|
+
name: 'PolygonScan',
|
|
103
|
+
url: 'https://mumbai.polygonscan.com'
|
|
104
|
+
},
|
|
105
|
+
arbitrum: {
|
|
106
|
+
name: 'Arbiscan',
|
|
107
|
+
url: 'https://arbiscan.io'
|
|
108
|
+
},
|
|
109
|
+
arbitrumRinkeby: {
|
|
110
|
+
name: 'Arbiscan',
|
|
111
|
+
url: 'https://testnet.arbiscan.io'
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const defaultAlchemyId = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
|
|
116
|
+
const alchemyRpcUrls = {
|
|
117
|
+
mainnet: 'https://eth-mainnet.alchemyapi.io/v2',
|
|
118
|
+
ropsten: 'https://eth-ropsten.alchemyapi.io/v2',
|
|
119
|
+
rinkeby: 'https://eth-rinkeby.alchemyapi.io/v2',
|
|
120
|
+
goerli: 'https://eth-goerli.alchemyapi.io/v2',
|
|
121
|
+
kovan: 'https://eth-kovan.alchemyapi.io/v2',
|
|
122
|
+
optimism: 'https://opt-mainnet.g.alchemy.com/v2',
|
|
123
|
+
optimismKovan: 'https://opt-kovan.g.alchemy.com/v2',
|
|
124
|
+
polygon: 'https://polygon-mainnet.g.alchemy.com/v2',
|
|
125
|
+
polygonMumbai: 'https://polygon-mumbai.g.alchemy.com/v2',
|
|
126
|
+
arbitrum: 'https://arb-mainnet.g.alchemy.com/v2',
|
|
127
|
+
arbitrumRinkeby: 'https://arb-rinkeby.g.alchemy.com/v2'
|
|
128
|
+
};
|
|
129
|
+
const infuraRpcUrls = {
|
|
130
|
+
mainnet: 'https://mainnet.infura.io/v3',
|
|
131
|
+
ropsten: 'https://ropsten.infura.io/v3',
|
|
132
|
+
rinkeby: 'https://rinkeby.infura.io/v3',
|
|
133
|
+
goerli: 'https://goerli.infura.io/v3',
|
|
134
|
+
kovan: 'https://kovan.infura.io/v3',
|
|
135
|
+
optimism: 'https://optimism-mainnet.infura.io/v3',
|
|
136
|
+
optimismKovan: 'https://optimism-kovan.infura.io/v3',
|
|
137
|
+
polygon: 'https://polygon-mainnet.infura.io/v3',
|
|
138
|
+
polygonMumbai: 'https://polygon-mumbai.infura.io/v3',
|
|
139
|
+
arbitrum: 'https://arbitrum-mainnet.infura.io/v3',
|
|
140
|
+
arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const chainId = {
|
|
144
|
+
mainnet: 1,
|
|
145
|
+
ropsten: 3,
|
|
146
|
+
rinkeby: 4,
|
|
147
|
+
goerli: 5,
|
|
148
|
+
kovan: 42,
|
|
149
|
+
optimism: 10,
|
|
150
|
+
optimismKovan: 69,
|
|
151
|
+
polygon: 137,
|
|
152
|
+
polygonMumbai: 80001,
|
|
153
|
+
arbitrum: 42161,
|
|
154
|
+
arbitrumRinkeby: 421611,
|
|
155
|
+
localhost: 1337,
|
|
156
|
+
hardhat: 31337
|
|
157
|
+
};
|
|
158
|
+
const chain = {
|
|
159
|
+
mainnet: {
|
|
160
|
+
id: chainId.mainnet,
|
|
161
|
+
name: 'Ethereum',
|
|
162
|
+
nativeCurrency: {
|
|
163
|
+
name: 'Ether',
|
|
164
|
+
symbol: 'ETH',
|
|
165
|
+
decimals: 18
|
|
166
|
+
},
|
|
167
|
+
rpcUrls: {
|
|
168
|
+
alchemy: alchemyRpcUrls.mainnet,
|
|
169
|
+
infura: infuraRpcUrls.mainnet,
|
|
170
|
+
default: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId)
|
|
171
|
+
},
|
|
172
|
+
blockExplorers: {
|
|
173
|
+
etherscan: etherscanBlockExplorers.mainnet,
|
|
174
|
+
default: etherscanBlockExplorers.mainnet
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
ropsten: {
|
|
178
|
+
id: chainId.ropsten,
|
|
179
|
+
name: 'Ropsten',
|
|
180
|
+
nativeCurrency: {
|
|
181
|
+
name: 'Ropsten Ether',
|
|
182
|
+
symbol: 'ropETH',
|
|
183
|
+
decimals: 18
|
|
184
|
+
},
|
|
185
|
+
rpcUrls: {
|
|
186
|
+
alchemy: alchemyRpcUrls.ropsten,
|
|
187
|
+
infura: infuraRpcUrls.ropsten,
|
|
188
|
+
default: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId)
|
|
189
|
+
},
|
|
190
|
+
blockExplorers: {
|
|
191
|
+
etherscan: etherscanBlockExplorers.ropsten,
|
|
192
|
+
default: etherscanBlockExplorers.ropsten
|
|
193
|
+
},
|
|
194
|
+
testnet: true
|
|
195
|
+
},
|
|
196
|
+
rinkeby: {
|
|
197
|
+
id: chainId.rinkeby,
|
|
198
|
+
name: 'Rinkeby',
|
|
199
|
+
nativeCurrency: {
|
|
200
|
+
name: 'Rinkeby Ether',
|
|
201
|
+
symbol: 'rETH',
|
|
202
|
+
decimals: 18
|
|
203
|
+
},
|
|
204
|
+
rpcUrls: {
|
|
205
|
+
alchemy: alchemyRpcUrls.rinkeby,
|
|
206
|
+
infura: infuraRpcUrls.rinkeby,
|
|
207
|
+
default: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId)
|
|
208
|
+
},
|
|
209
|
+
blockExplorers: {
|
|
210
|
+
etherscan: etherscanBlockExplorers.rinkeby,
|
|
211
|
+
default: etherscanBlockExplorers.rinkeby
|
|
212
|
+
},
|
|
213
|
+
testnet: true
|
|
214
|
+
},
|
|
215
|
+
goerli: {
|
|
216
|
+
id: chainId.goerli,
|
|
217
|
+
name: 'Goerli',
|
|
218
|
+
nativeCurrency: {
|
|
219
|
+
name: 'Goerli Ether',
|
|
220
|
+
symbol: 'gETH',
|
|
221
|
+
decimals: 18
|
|
222
|
+
},
|
|
223
|
+
rpcUrls: {
|
|
224
|
+
alchemy: alchemyRpcUrls.goerli,
|
|
225
|
+
infura: infuraRpcUrls.goerli,
|
|
226
|
+
default: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId)
|
|
227
|
+
},
|
|
228
|
+
blockExplorers: {
|
|
229
|
+
etherscan: etherscanBlockExplorers.goerli,
|
|
230
|
+
default: etherscanBlockExplorers.goerli
|
|
231
|
+
},
|
|
232
|
+
testnet: true
|
|
233
|
+
},
|
|
234
|
+
kovan: {
|
|
235
|
+
id: chainId.kovan,
|
|
236
|
+
name: 'Kovan',
|
|
237
|
+
nativeCurrency: {
|
|
238
|
+
name: 'Kovan Ether',
|
|
239
|
+
symbol: 'kETH',
|
|
240
|
+
decimals: 18
|
|
241
|
+
},
|
|
242
|
+
rpcUrls: {
|
|
243
|
+
alchemy: alchemyRpcUrls.kovan,
|
|
244
|
+
infura: infuraRpcUrls.kovan,
|
|
245
|
+
default: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId)
|
|
246
|
+
},
|
|
247
|
+
blockExplorers: {
|
|
248
|
+
etherscan: etherscanBlockExplorers.kovan,
|
|
249
|
+
default: etherscanBlockExplorers.kovan
|
|
250
|
+
},
|
|
251
|
+
testnet: true
|
|
252
|
+
},
|
|
253
|
+
optimism: {
|
|
254
|
+
id: chainId.optimism,
|
|
255
|
+
name: 'Optimism',
|
|
256
|
+
nativeCurrency: {
|
|
257
|
+
name: 'Ether',
|
|
258
|
+
symbol: 'ETH',
|
|
259
|
+
decimals: 18
|
|
260
|
+
},
|
|
261
|
+
rpcUrls: {
|
|
262
|
+
alchemy: alchemyRpcUrls.optimism,
|
|
263
|
+
infura: infuraRpcUrls.optimism,
|
|
264
|
+
default: 'https://mainnet.optimism.io'
|
|
265
|
+
},
|
|
266
|
+
blockExplorers: {
|
|
267
|
+
etherscan: etherscanBlockExplorers.optimism,
|
|
268
|
+
default: etherscanBlockExplorers.optimism
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
optimismKovan: {
|
|
272
|
+
id: chainId.optimismKovan,
|
|
273
|
+
name: 'Optimism Kovan',
|
|
274
|
+
nativeCurrency: {
|
|
275
|
+
name: 'Kovan Ether',
|
|
276
|
+
symbol: 'KOR',
|
|
277
|
+
decimals: 18
|
|
278
|
+
},
|
|
279
|
+
rpcUrls: {
|
|
280
|
+
alchemy: alchemyRpcUrls.optimismKovan,
|
|
281
|
+
infura: infuraRpcUrls.optimismKovan,
|
|
282
|
+
default: 'https://kovan.optimism.io'
|
|
283
|
+
},
|
|
284
|
+
blockExplorers: {
|
|
285
|
+
etherscan: etherscanBlockExplorers.optimismKovan,
|
|
286
|
+
default: etherscanBlockExplorers.optimismKovan
|
|
287
|
+
},
|
|
288
|
+
testnet: true
|
|
289
|
+
},
|
|
290
|
+
polygon: {
|
|
291
|
+
id: chainId.polygon,
|
|
292
|
+
name: 'Polygon',
|
|
293
|
+
nativeCurrency: {
|
|
294
|
+
name: 'MATIC',
|
|
295
|
+
symbol: 'MATIC',
|
|
296
|
+
decimals: 18
|
|
297
|
+
},
|
|
298
|
+
rpcUrls: {
|
|
299
|
+
alchemy: alchemyRpcUrls.polygon,
|
|
300
|
+
infura: infuraRpcUrls.polygon,
|
|
301
|
+
default: 'https://polygon-rpc.com'
|
|
302
|
+
},
|
|
303
|
+
blockExplorers: {
|
|
304
|
+
etherscan: etherscanBlockExplorers.polygon,
|
|
305
|
+
default: etherscanBlockExplorers.polygon
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
polygonMumbai: {
|
|
309
|
+
id: chainId.polygonMumbai,
|
|
310
|
+
name: 'Polygon Mumbai',
|
|
311
|
+
nativeCurrency: {
|
|
312
|
+
name: 'MATIC',
|
|
313
|
+
symbol: 'MATIC',
|
|
314
|
+
decimals: 18
|
|
315
|
+
},
|
|
316
|
+
rpcUrls: {
|
|
317
|
+
alchemy: alchemyRpcUrls.polygonMumbai,
|
|
318
|
+
infura: infuraRpcUrls.polygonMumbai,
|
|
319
|
+
default: 'https://matic-mumbai.chainstacklabs.com'
|
|
320
|
+
},
|
|
321
|
+
blockExplorers: {
|
|
322
|
+
etherscan: etherscanBlockExplorers.polygonMumbai,
|
|
323
|
+
default: etherscanBlockExplorers.polygonMumbai
|
|
324
|
+
},
|
|
325
|
+
testnet: true
|
|
326
|
+
},
|
|
327
|
+
arbitrum: {
|
|
328
|
+
id: chainId.arbitrum,
|
|
329
|
+
name: 'Arbitrum',
|
|
330
|
+
nativeCurrency: {
|
|
331
|
+
name: 'Ether',
|
|
332
|
+
symbol: 'AETH',
|
|
333
|
+
decimals: 18
|
|
334
|
+
},
|
|
335
|
+
rpcUrls: {
|
|
336
|
+
alchemy: alchemyRpcUrls.arbitrum,
|
|
337
|
+
infura: infuraRpcUrls.arbitrum,
|
|
338
|
+
default: 'https://arb1.arbitrum.io/rpc'
|
|
339
|
+
},
|
|
340
|
+
blockExplorers: {
|
|
341
|
+
arbitrum: {
|
|
342
|
+
name: 'Arbitrum Explorer',
|
|
343
|
+
url: 'https://explorer.arbitrum.io'
|
|
344
|
+
},
|
|
345
|
+
etherscan: etherscanBlockExplorers.arbitrum,
|
|
346
|
+
default: etherscanBlockExplorers.arbitrum
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
arbitrumRinkeby: {
|
|
350
|
+
id: chainId.arbitrumRinkeby,
|
|
351
|
+
name: 'Arbitrum Rinkeby',
|
|
352
|
+
nativeCurrency: {
|
|
353
|
+
name: 'Arbitrum Rinkeby Ether',
|
|
354
|
+
symbol: 'ARETH',
|
|
355
|
+
decimals: 18
|
|
356
|
+
},
|
|
357
|
+
rpcUrls: {
|
|
358
|
+
alchemy: alchemyRpcUrls.arbitrumRinkeby,
|
|
359
|
+
infura: infuraRpcUrls.arbitrumRinkeby,
|
|
360
|
+
default: 'https://rinkeby.arbitrum.io/rpc'
|
|
361
|
+
},
|
|
362
|
+
blockExplorers: {
|
|
363
|
+
arbitrum: {
|
|
364
|
+
name: 'Arbitrum Explorer',
|
|
365
|
+
url: 'https://rinkeby-explorer.arbitrum.io'
|
|
366
|
+
},
|
|
367
|
+
etherscan: etherscanBlockExplorers.arbitrumRinkeby,
|
|
368
|
+
default: etherscanBlockExplorers.arbitrumRinkeby
|
|
369
|
+
},
|
|
370
|
+
testnet: true
|
|
371
|
+
},
|
|
372
|
+
localhost: {
|
|
373
|
+
id: chainId.localhost,
|
|
374
|
+
name: 'Localhost',
|
|
375
|
+
rpcUrls: {
|
|
376
|
+
default: 'http://127.0.0.1:8545'
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
hardhat: {
|
|
380
|
+
id: chainId.hardhat,
|
|
381
|
+
name: 'Hardhat',
|
|
382
|
+
rpcUrls: {
|
|
383
|
+
default: 'http://127.0.0.1:8545'
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
const allChains = Object.values(chain);
|
|
388
|
+
const defaultChains = [chain.mainnet, chain.ropsten, chain.rinkeby, chain.goerli, chain.kovan];
|
|
389
|
+
const defaultL2Chains = [chain.arbitrum, chain.arbitrumRinkeby, chain.optimism, chain.optimismKovan];
|
|
390
|
+
|
|
391
|
+
function normalizeChainId(chainId) {
|
|
392
|
+
if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
|
|
393
|
+
return chainId;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
class AddChainError extends Error {
|
|
397
|
+
constructor() {
|
|
398
|
+
super(...arguments);
|
|
399
|
+
|
|
400
|
+
_defineProperty(this, "name", 'AddChainError');
|
|
401
|
+
|
|
402
|
+
_defineProperty(this, "message", 'Error adding chain');
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
}
|
|
406
|
+
class ChainNotConfiguredError extends Error {
|
|
407
|
+
constructor() {
|
|
408
|
+
super(...arguments);
|
|
409
|
+
|
|
410
|
+
_defineProperty(this, "name", 'ChainNotConfigured');
|
|
411
|
+
|
|
412
|
+
_defineProperty(this, "message", 'Chain not configured');
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
}
|
|
416
|
+
class ConnectorAlreadyConnectedError extends Error {
|
|
417
|
+
constructor() {
|
|
418
|
+
super(...arguments);
|
|
419
|
+
|
|
420
|
+
_defineProperty(this, "name", 'ConnectorAlreadyConnectedError');
|
|
421
|
+
|
|
422
|
+
_defineProperty(this, "message", 'Connector already connected');
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
}
|
|
426
|
+
class ConnectorNotFoundError extends Error {
|
|
427
|
+
constructor() {
|
|
428
|
+
super(...arguments);
|
|
429
|
+
|
|
430
|
+
_defineProperty(this, "name", 'ConnectorNotFoundError');
|
|
431
|
+
|
|
432
|
+
_defineProperty(this, "message", 'Connector not found');
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
}
|
|
436
|
+
class SwitchChainError extends Error {
|
|
437
|
+
constructor() {
|
|
438
|
+
super(...arguments);
|
|
439
|
+
|
|
440
|
+
_defineProperty(this, "name", 'SwitchChainError');
|
|
441
|
+
|
|
442
|
+
_defineProperty(this, "message", 'Error switching chain');
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
}
|
|
446
|
+
class SwitchChainNotSupportedError extends Error {
|
|
447
|
+
constructor() {
|
|
448
|
+
super(...arguments);
|
|
449
|
+
|
|
450
|
+
_defineProperty(this, "name", 'SwitchChainNotSupportedError');
|
|
451
|
+
|
|
452
|
+
_defineProperty(this, "message", 'Switch chain not supported by connector');
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
}
|
|
456
|
+
class UserRejectedRequestError extends Error {
|
|
457
|
+
constructor() {
|
|
458
|
+
super(...arguments);
|
|
459
|
+
|
|
460
|
+
_defineProperty(this, "name", 'UserRejectedRequestError');
|
|
461
|
+
|
|
462
|
+
_defineProperty(this, "message", 'User rejected request');
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
class Connector extends EventEmitter {
|
|
468
|
+
/** Unique connector id */
|
|
469
|
+
|
|
470
|
+
/** Connector name */
|
|
471
|
+
|
|
472
|
+
/** Chains connector supports */
|
|
473
|
+
|
|
474
|
+
/** Options to use with connector */
|
|
475
|
+
|
|
476
|
+
/** Whether connector is usable */
|
|
477
|
+
constructor(_ref) {
|
|
478
|
+
let {
|
|
479
|
+
chains = defaultChains,
|
|
480
|
+
options
|
|
481
|
+
} = _ref;
|
|
482
|
+
super();
|
|
483
|
+
|
|
484
|
+
_defineProperty(this, "id", void 0);
|
|
485
|
+
|
|
486
|
+
_defineProperty(this, "name", void 0);
|
|
487
|
+
|
|
488
|
+
_defineProperty(this, "chains", void 0);
|
|
489
|
+
|
|
490
|
+
_defineProperty(this, "options", void 0);
|
|
491
|
+
|
|
492
|
+
_defineProperty(this, "ready", void 0);
|
|
493
|
+
|
|
494
|
+
this.chains = chains;
|
|
495
|
+
this.options = options;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
getBlockExplorerUrls(chain) {
|
|
499
|
+
var _chain$blockExplorers;
|
|
500
|
+
|
|
501
|
+
const blockExplorer = (_chain$blockExplorers = chain.blockExplorers) === null || _chain$blockExplorers === void 0 ? void 0 : _chain$blockExplorers.default;
|
|
502
|
+
if (Array.isArray(blockExplorer)) return blockExplorer.map(x => x.url);
|
|
503
|
+
if (blockExplorer !== null && blockExplorer !== void 0 && blockExplorer.url) return [blockExplorer.url];
|
|
504
|
+
return [];
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
getRpcUrls(chain) {
|
|
508
|
+
return typeof chain.rpcUrls.default === 'string' ? [chain.rpcUrls.default] : chain.rpcUrls.default;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
isChainUnsupported(chainId) {
|
|
512
|
+
return !this.chains.some(x => x.id === chainId);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export { AddChainError as A, Connector as C, SwitchChainError as S, UserRejectedRequestError as U, _defineProperty as _, _classPrivateFieldInitSpec as a, ConnectorNotFoundError as b, _classPrivateFieldSet as c, _classPrivateFieldGet as d, allChains as e, ChainNotConfiguredError as f, ConnectorAlreadyConnectedError as g, SwitchChainNotSupportedError as h, alchemyRpcUrls as i, chain as j, chainId as k, defaultChains as l, defaultL2Chains as m, normalizeChainId as n, etherscanBlockExplorers as o, infuraRpcUrls as p, _checkPrivateRedeclaration as q };
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import type { BaseProvider } from '@ethersproject/providers';
|
|
1
2
|
import { Client } from '../../client';
|
|
2
|
-
import { Connector } from '../../connectors';
|
|
3
|
-
export declare type
|
|
4
|
-
|
|
5
|
-
connector:
|
|
3
|
+
import { Connector, ConnectorData } from '../../connectors';
|
|
4
|
+
export declare type ConnectArgs = {
|
|
5
|
+
/** Connector to connect */
|
|
6
|
+
connector: Connector;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
declare type Data<TProvider extends BaseProvider = BaseProvider> = Required<ConnectorData<TProvider>>;
|
|
9
|
+
export declare type ConnectResult<TProvider extends BaseProvider = BaseProvider> = {
|
|
10
|
+
account: Data<TProvider>['account'];
|
|
11
|
+
chain: Data<TProvider>['chain'];
|
|
12
|
+
connector: Client<TProvider>['connector'];
|
|
13
|
+
provider: Data<TProvider>['provider'];
|
|
14
|
+
};
|
|
15
|
+
export declare function connect<TProvider extends BaseProvider>({ connector, }: ConnectArgs): Promise<ConnectResult<TProvider>>;
|
|
16
|
+
export {};
|
|
@@ -3,6 +3,8 @@ import { Unit } from '../../types';
|
|
|
3
3
|
export declare type FetchBalanceArgs = {
|
|
4
4
|
/** Address or ENS name */
|
|
5
5
|
addressOrName: string;
|
|
6
|
+
/** Chain id to use for provider */
|
|
7
|
+
chainId?: number;
|
|
6
8
|
/** Units for formatting output */
|
|
7
9
|
formatUnits?: Unit | number;
|
|
8
10
|
/** ERC-20 address */
|
|
@@ -15,4 +17,4 @@ export declare type FetchBalanceResult = {
|
|
|
15
17
|
unit: Unit | number;
|
|
16
18
|
value: BigNumber;
|
|
17
19
|
};
|
|
18
|
-
export declare function fetchBalance({ addressOrName, formatUnits: unit, token, }: FetchBalanceArgs): Promise<FetchBalanceResult>;
|
|
20
|
+
export declare function fetchBalance({ addressOrName, chainId, formatUnits: unit, token, }: FetchBalanceArgs): Promise<FetchBalanceResult>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { BaseProvider } from '@ethersproject/providers';
|
|
1
2
|
import { Client, Data } from '../../client';
|
|
2
|
-
export declare type GetAccountResult = {
|
|
3
|
-
address?: Data['account'];
|
|
4
|
-
connector?: Client['connector'];
|
|
3
|
+
export declare type GetAccountResult<TProvider extends BaseProvider = BaseProvider> = {
|
|
4
|
+
address?: Data<TProvider>['account'];
|
|
5
|
+
connector?: Client<TProvider>['connector'];
|
|
5
6
|
};
|
|
6
|
-
export declare function getAccount(): GetAccountResult
|
|
7
|
+
export declare function getAccount<TProvider extends BaseProvider>(): GetAccountResult<TProvider>;
|
|
@@ -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';
|
|
@@ -8,6 +8,5 @@ export { signMessage, type SignMessageArgs, type SignMessageResult, } from './si
|
|
|
8
8
|
export { signTypedData, type SignTypedDataArgs, type SignTypedDataResult, } from './signTypedData';
|
|
9
9
|
export { switchNetwork, type SwitchNetworkArgs, type SwitchNetworkResult, } from './switchNetwork';
|
|
10
10
|
export { watchAccount, type WatchAccountCallback } from './watchAccount';
|
|
11
|
-
export { watchBalance, type WatchBalanceCallback } from './watchBalance';
|
|
12
11
|
export { watchNetwork, type WatchNetworkCallback } from './watchNetwork';
|
|
13
12
|
export { watchSigner, type WatchSignerCallback } from './watchSigner';
|
|
@@ -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,3 +1,4 @@
|
|
|
1
|
+
import type { BaseProvider } from '@ethersproject/providers';
|
|
1
2
|
import { GetAccountResult } from './getAccount';
|
|
2
|
-
export declare type WatchAccountCallback = (data: GetAccountResult) => void;
|
|
3
|
-
export declare function watchAccount(callback: WatchAccountCallback): () => void;
|
|
3
|
+
export declare type WatchAccountCallback<TProvider extends BaseProvider = BaseProvider> = (data: GetAccountResult<TProvider>) => void;
|
|
4
|
+
export declare function watchAccount<TProvider extends BaseProvider>(callback: WatchAccountCallback<TProvider>): () => void;
|
|
@@ -5,7 +5,10 @@ export declare type ReadContractArgs = GetContractArgs;
|
|
|
5
5
|
export declare type ReadContractConfig = {
|
|
6
6
|
/** Arguments to pass contract method */
|
|
7
7
|
args?: any | any[];
|
|
8
|
+
/** Chain id to use for provider */
|
|
9
|
+
chainId?: number;
|
|
10
|
+
/** Call overrides */
|
|
8
11
|
overrides?: CallOverrides;
|
|
9
12
|
};
|
|
10
13
|
export declare type ReadContractResult = Result;
|
|
11
|
-
export declare function readContract<Contract extends EthersContract = EthersContract>(contractConfig: ReadContractArgs, functionName: string, { args, overrides }?: ReadContractConfig): Promise<Result>;
|
|
14
|
+
export declare function readContract<Contract extends EthersContract = EthersContract>(contractConfig: ReadContractArgs, functionName: string, { args, chainId, overrides }?: ReadContractConfig): Promise<Result>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Contract as EthersContract } from 'ethers/lib/ethers';
|
|
2
2
|
import { GetContractArgs } from './getContract';
|
|
3
3
|
declare type Config = {
|
|
4
|
+
/** Chain id to use for provider */
|
|
5
|
+
chainId?: number;
|
|
4
6
|
/** Receive only a single event */
|
|
5
7
|
once?: boolean;
|
|
6
8
|
};
|
|
@@ -8,5 +10,5 @@ export declare function watchContractEvent<Contract extends EthersContract = Eth
|
|
|
8
10
|
/** Contract configuration */
|
|
9
11
|
contractArgs: GetContractArgs,
|
|
10
12
|
/** Event name to listen to */
|
|
11
|
-
eventName: Parameters<Contract['on']>[0], callback: Parameters<Contract['on']>[1], { once }?: Config): () => void;
|
|
13
|
+
eventName: Parameters<Contract['on']>[0], callback: Parameters<Contract['on']>[1], { chainId, once }?: Config): () => void;
|
|
12
14
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare type FetchEnsAddressArgs = {
|
|
2
|
+
/** Chain id to use for provider */
|
|
3
|
+
chainId?: number;
|
|
2
4
|
/** ENS name to resolve */
|
|
3
5
|
name: string;
|
|
4
6
|
};
|
|
5
7
|
export declare type FetchEnsAddressResult = string | null;
|
|
6
|
-
export declare function fetchEnsAddress({ name, }: FetchEnsAddressArgs): Promise<FetchEnsAddressResult>;
|
|
8
|
+
export declare function fetchEnsAddress({ chainId, name, }: FetchEnsAddressArgs): Promise<FetchEnsAddressResult>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare type FetchEnsAvatarArgs = {
|
|
2
2
|
/** Address or ENS name */
|
|
3
3
|
addressOrName: string;
|
|
4
|
+
/** Chain id to use for provider */
|
|
5
|
+
chainId?: number;
|
|
4
6
|
};
|
|
5
7
|
export declare type FetchEnsAvatarResult = string | null;
|
|
6
|
-
export declare function fetchEnsAvatar({ addressOrName, }: FetchEnsAvatarArgs): Promise<FetchEnsAvatarResult>;
|
|
8
|
+
export declare function fetchEnsAvatar({ addressOrName, chainId, }: FetchEnsAvatarArgs): Promise<FetchEnsAvatarResult>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare type FetchEnsNameArgs = {
|
|
2
2
|
/** Address to lookup */
|
|
3
3
|
address: string;
|
|
4
|
+
/** Chain id to use for provider */
|
|
5
|
+
chainId?: number;
|
|
4
6
|
};
|
|
5
7
|
export declare type FetchEnsNameResult = string | null;
|
|
6
|
-
export declare function fetchEnsName({ address, }: FetchEnsNameArgs): Promise<FetchEnsNameResult>;
|
|
8
|
+
export declare function fetchEnsName({ address, chainId, }: FetchEnsNameArgs): Promise<FetchEnsNameResult>;
|