@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
|
@@ -1,453 +0,0 @@
|
|
|
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 _defineProperty(obj, key, value) {
|
|
10
|
-
if (key in obj) {
|
|
11
|
-
Object.defineProperty(obj, key, {
|
|
12
|
-
value: value,
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true
|
|
16
|
-
});
|
|
17
|
-
} else {
|
|
18
|
-
obj[key] = value;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return obj;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
25
|
-
try {
|
|
26
|
-
var info = gen[key](arg);
|
|
27
|
-
var value = info.value;
|
|
28
|
-
} catch (error) {
|
|
29
|
-
reject(error);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (info.done) {
|
|
34
|
-
resolve(value);
|
|
35
|
-
} else {
|
|
36
|
-
Promise.resolve(value).then(_next, _throw);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _asyncToGenerator(fn) {
|
|
41
|
-
return function () {
|
|
42
|
-
var self = this,
|
|
43
|
-
args = arguments;
|
|
44
|
-
return new Promise(function (resolve, reject) {
|
|
45
|
-
var gen = fn.apply(self, args);
|
|
46
|
-
|
|
47
|
-
function _next(value) {
|
|
48
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _throw(err) {
|
|
52
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
_next(undefined);
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
61
|
-
if (privateCollection.has(obj)) {
|
|
62
|
-
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
67
|
-
_checkPrivateRedeclaration(obj, privateMap);
|
|
68
|
-
privateMap.set(obj, value);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function _classApplyDescriptorGet(receiver, descriptor) {
|
|
72
|
-
if (descriptor.get) {
|
|
73
|
-
return descriptor.get.call(receiver);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return descriptor.value;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) {
|
|
80
|
-
if (!privateMap.has(receiver)) {
|
|
81
|
-
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return privateMap.get(receiver);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function _classPrivateFieldGet(receiver, privateMap) {
|
|
88
|
-
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
89
|
-
return _classApplyDescriptorGet(receiver, descriptor);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) {
|
|
93
|
-
if (descriptor.set) {
|
|
94
|
-
descriptor.set.call(receiver, value);
|
|
95
|
-
} else {
|
|
96
|
-
if (!descriptor.writable) {
|
|
97
|
-
throw new TypeError("attempted to set read only private field");
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
descriptor.value = value;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
105
|
-
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
|
|
106
|
-
_classApplyDescriptorSet(receiver, descriptor, value);
|
|
107
|
-
return value;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Data from Chainlist
|
|
112
|
-
* @see https://chainlist.org
|
|
113
|
-
*/
|
|
114
|
-
var chain = {
|
|
115
|
-
mainnet: {
|
|
116
|
-
id: 1,
|
|
117
|
-
name: 'Mainnet',
|
|
118
|
-
nativeCurrency: {
|
|
119
|
-
name: 'Ether',
|
|
120
|
-
symbol: 'ETH',
|
|
121
|
-
decimals: 18
|
|
122
|
-
},
|
|
123
|
-
rpcUrls: ['https://mainnet.infura.io/v3'],
|
|
124
|
-
blockExplorers: [{
|
|
125
|
-
name: 'Etherscan',
|
|
126
|
-
url: 'https://etherscan.io'
|
|
127
|
-
}]
|
|
128
|
-
},
|
|
129
|
-
ropsten: {
|
|
130
|
-
id: 3,
|
|
131
|
-
name: 'Ropsten',
|
|
132
|
-
nativeCurrency: {
|
|
133
|
-
name: 'Ropsten Ether',
|
|
134
|
-
symbol: 'ropETH',
|
|
135
|
-
decimals: 18
|
|
136
|
-
},
|
|
137
|
-
rpcUrls: ['https://ropsten.infura.io/v3'],
|
|
138
|
-
blockExplorers: [{
|
|
139
|
-
name: 'Etherscan',
|
|
140
|
-
url: 'https://ropsten.etherscan.io'
|
|
141
|
-
}],
|
|
142
|
-
testnet: true
|
|
143
|
-
},
|
|
144
|
-
rinkeby: {
|
|
145
|
-
id: 4,
|
|
146
|
-
name: 'Rinkeby',
|
|
147
|
-
nativeCurrency: {
|
|
148
|
-
name: 'Rinkeby Ether',
|
|
149
|
-
symbol: 'rETH',
|
|
150
|
-
decimals: 18
|
|
151
|
-
},
|
|
152
|
-
rpcUrls: ['https://rinkeby.infura.io/v3'],
|
|
153
|
-
blockExplorers: [{
|
|
154
|
-
name: 'Etherscan',
|
|
155
|
-
url: 'https://rinkeby.etherscan.io'
|
|
156
|
-
}],
|
|
157
|
-
testnet: true
|
|
158
|
-
},
|
|
159
|
-
goerli: {
|
|
160
|
-
id: 5,
|
|
161
|
-
name: 'Goerli',
|
|
162
|
-
nativeCurrency: {
|
|
163
|
-
name: 'Goerli Ether',
|
|
164
|
-
symbol: 'gETH',
|
|
165
|
-
decimals: 18
|
|
166
|
-
},
|
|
167
|
-
rpcUrls: ['https://goerli.infura.io/v3'],
|
|
168
|
-
blockExplorers: [{
|
|
169
|
-
name: 'Etherscan',
|
|
170
|
-
url: 'https://goerli.etherscan.io'
|
|
171
|
-
}],
|
|
172
|
-
testnet: true
|
|
173
|
-
},
|
|
174
|
-
kovan: {
|
|
175
|
-
id: 42,
|
|
176
|
-
name: 'Kovan',
|
|
177
|
-
nativeCurrency: {
|
|
178
|
-
name: 'Kovan Ether',
|
|
179
|
-
symbol: 'kETH',
|
|
180
|
-
decimals: 18
|
|
181
|
-
},
|
|
182
|
-
rpcUrls: ['https://kovan.infura.io/v3'],
|
|
183
|
-
blockExplorers: [{
|
|
184
|
-
name: 'Etherscan',
|
|
185
|
-
url: 'https://kovan.etherscan.io'
|
|
186
|
-
}],
|
|
187
|
-
testnet: true
|
|
188
|
-
},
|
|
189
|
-
optimism: {
|
|
190
|
-
id: 10,
|
|
191
|
-
name: 'Optimism',
|
|
192
|
-
nativeCurrency: {
|
|
193
|
-
name: 'Ether',
|
|
194
|
-
symbol: 'ETH',
|
|
195
|
-
decimals: 18
|
|
196
|
-
},
|
|
197
|
-
rpcUrls: ['https://mainnet.optimism.io'],
|
|
198
|
-
blockExplorers: [{
|
|
199
|
-
name: 'Etherscan',
|
|
200
|
-
url: 'https://optimistic.etherscan.io'
|
|
201
|
-
}]
|
|
202
|
-
},
|
|
203
|
-
optimismKovan: {
|
|
204
|
-
id: 69,
|
|
205
|
-
name: 'Optimism Kovan',
|
|
206
|
-
nativeCurrency: {
|
|
207
|
-
name: 'Kovan Ether',
|
|
208
|
-
symbol: 'KOR',
|
|
209
|
-
decimals: 18
|
|
210
|
-
},
|
|
211
|
-
rpcUrls: ['https://kovan.optimism.io'],
|
|
212
|
-
blockExplorers: [{
|
|
213
|
-
name: 'Etherscan',
|
|
214
|
-
url: 'https://kovan-optimistic.etherscan.io'
|
|
215
|
-
}],
|
|
216
|
-
testnet: true
|
|
217
|
-
},
|
|
218
|
-
polygonMainnet: {
|
|
219
|
-
id: 137,
|
|
220
|
-
name: 'Polygon Mainnet',
|
|
221
|
-
nativeCurrency: {
|
|
222
|
-
name: 'MATIC',
|
|
223
|
-
symbol: 'MATIC',
|
|
224
|
-
decimals: 18
|
|
225
|
-
},
|
|
226
|
-
rpcUrls: ['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'],
|
|
227
|
-
blockExplorers: [{
|
|
228
|
-
name: 'Polygonscan',
|
|
229
|
-
url: 'https://polygonscan.com'
|
|
230
|
-
}]
|
|
231
|
-
},
|
|
232
|
-
polygonTestnetMumbai: {
|
|
233
|
-
id: 80001,
|
|
234
|
-
name: 'Mumbai',
|
|
235
|
-
nativeCurrency: {
|
|
236
|
-
name: 'MATIC',
|
|
237
|
-
symbol: 'MATIC',
|
|
238
|
-
decimals: 18
|
|
239
|
-
},
|
|
240
|
-
rpcUrls: ['https://matic-mumbai.chainstacklabs.com', 'https://rpc-mumbai.maticvigil.com', 'https://matic-testnet-archive-rpc.bwarelabs.com'],
|
|
241
|
-
blockExplorers: [{
|
|
242
|
-
name: 'Polygonscan',
|
|
243
|
-
url: 'https://mumbai.polygonscan.com'
|
|
244
|
-
}],
|
|
245
|
-
testnet: true
|
|
246
|
-
},
|
|
247
|
-
arbitrumOne: {
|
|
248
|
-
id: 42161,
|
|
249
|
-
name: 'Arbitrum One',
|
|
250
|
-
nativeCurrency: {
|
|
251
|
-
name: 'Ether',
|
|
252
|
-
symbol: 'AETH',
|
|
253
|
-
decimals: 18
|
|
254
|
-
},
|
|
255
|
-
rpcUrls: ['https://arb1.arbitrum.io/rpc'],
|
|
256
|
-
blockExplorers: [{
|
|
257
|
-
name: 'Arbiscan',
|
|
258
|
-
url: 'https://arbiscan.io'
|
|
259
|
-
}, {
|
|
260
|
-
name: 'Arbitrum Explorer',
|
|
261
|
-
url: 'https://explorer.arbitrum.io'
|
|
262
|
-
}]
|
|
263
|
-
},
|
|
264
|
-
arbitrumRinkeby: {
|
|
265
|
-
id: 421611,
|
|
266
|
-
name: 'Arbitrum Rinkeby',
|
|
267
|
-
nativeCurrency: {
|
|
268
|
-
name: 'Arbitrum Rinkeby Ether',
|
|
269
|
-
symbol: 'ARETH',
|
|
270
|
-
decimals: 18
|
|
271
|
-
},
|
|
272
|
-
rpcUrls: ['https://rinkeby.arbitrum.io/rpc'],
|
|
273
|
-
blockExplorers: [{
|
|
274
|
-
name: 'Arbitrum Explorer',
|
|
275
|
-
url: 'https://rinkeby-explorer.arbitrum.io'
|
|
276
|
-
}],
|
|
277
|
-
testnet: true
|
|
278
|
-
},
|
|
279
|
-
avalanche: {
|
|
280
|
-
id: 43114,
|
|
281
|
-
name: 'Avalanche Mainnet',
|
|
282
|
-
nativeCurrency: {
|
|
283
|
-
name: 'Avalanche',
|
|
284
|
-
symbol: 'AVAX',
|
|
285
|
-
decimals: 18
|
|
286
|
-
},
|
|
287
|
-
rpcUrls: ['https://api.avax.network/ext/bc/C/rpc'],
|
|
288
|
-
blockExplorers: [{
|
|
289
|
-
name: 'SnowTrace',
|
|
290
|
-
url: 'https://snowtrace.io'
|
|
291
|
-
}],
|
|
292
|
-
testnet: false
|
|
293
|
-
},
|
|
294
|
-
avalancheFuji: {
|
|
295
|
-
id: 43113,
|
|
296
|
-
name: 'Avalanche Fuji Testnet',
|
|
297
|
-
nativeCurrency: {
|
|
298
|
-
name: 'Avalanche',
|
|
299
|
-
symbol: 'AVAX',
|
|
300
|
-
decimals: 18
|
|
301
|
-
},
|
|
302
|
-
rpcUrls: ['https://api.avax-test.network/ext/bc/C/rpc'],
|
|
303
|
-
blockExplorers: [{
|
|
304
|
-
name: 'SnowTrace',
|
|
305
|
-
url: 'https://testnet.snowtrace.io'
|
|
306
|
-
}],
|
|
307
|
-
testnet: true
|
|
308
|
-
},
|
|
309
|
-
localhost: {
|
|
310
|
-
id: 1337,
|
|
311
|
-
name: 'Localhost',
|
|
312
|
-
rpcUrls: ['https://127.0.0.1:8545']
|
|
313
|
-
},
|
|
314
|
-
hardhat: {
|
|
315
|
-
id: 31337,
|
|
316
|
-
name: 'Hardhat',
|
|
317
|
-
rpcUrls: ['http://127.0.0.1:8545']
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
var allChains = Object.values(chain);
|
|
321
|
-
var defaultChains = [chain.mainnet, chain.ropsten, chain.rinkeby, chain.goerli, chain.kovan];
|
|
322
|
-
|
|
323
|
-
function normalizeChainId(chainId) {
|
|
324
|
-
if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
|
|
325
|
-
return chainId;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
class AddChainError extends Error {
|
|
329
|
-
constructor() {
|
|
330
|
-
super(...arguments);
|
|
331
|
-
|
|
332
|
-
_defineProperty(this, "name", 'AddChainError');
|
|
333
|
-
|
|
334
|
-
_defineProperty(this, "message", 'Error adding chain');
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
class ChainNotConfiguredError extends Error {
|
|
339
|
-
constructor() {
|
|
340
|
-
super(...arguments);
|
|
341
|
-
|
|
342
|
-
_defineProperty(this, "name", 'ChainNotConfigured');
|
|
343
|
-
|
|
344
|
-
_defineProperty(this, "message", 'Chain not configured');
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
class ConnectorAlreadyConnectedError extends Error {
|
|
349
|
-
constructor() {
|
|
350
|
-
super(...arguments);
|
|
351
|
-
|
|
352
|
-
_defineProperty(this, "name", 'ConnectorAlreadyConnectedError');
|
|
353
|
-
|
|
354
|
-
_defineProperty(this, "message", 'Connector already connected');
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
class ConnectorNotFoundError extends Error {
|
|
359
|
-
constructor() {
|
|
360
|
-
super(...arguments);
|
|
361
|
-
|
|
362
|
-
_defineProperty(this, "name", 'ConnectorNotFoundError');
|
|
363
|
-
|
|
364
|
-
_defineProperty(this, "message", 'Connector not found');
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
}
|
|
368
|
-
class SwitchChainError extends Error {
|
|
369
|
-
constructor() {
|
|
370
|
-
super(...arguments);
|
|
371
|
-
|
|
372
|
-
_defineProperty(this, "name", 'SwitchChainError');
|
|
373
|
-
|
|
374
|
-
_defineProperty(this, "message", 'Error switching chain');
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
class SwitchChainNotSupportedError extends Error {
|
|
379
|
-
constructor() {
|
|
380
|
-
super(...arguments);
|
|
381
|
-
|
|
382
|
-
_defineProperty(this, "name", 'SwitchChainNotSupportedError');
|
|
383
|
-
|
|
384
|
-
_defineProperty(this, "message", 'Switch chain not supported by connector');
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
class UserRejectedRequestError extends Error {
|
|
389
|
-
constructor() {
|
|
390
|
-
super(...arguments);
|
|
391
|
-
|
|
392
|
-
_defineProperty(this, "name", 'UserRejectedRequestError');
|
|
393
|
-
|
|
394
|
-
_defineProperty(this, "message", 'User rejected request');
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
class Connector extends EventEmitter__default["default"] {
|
|
400
|
-
/** Unique connector id */
|
|
401
|
-
|
|
402
|
-
/** Connector name */
|
|
403
|
-
|
|
404
|
-
/** Chains connector supports */
|
|
405
|
-
|
|
406
|
-
/** Options to use with connector */
|
|
407
|
-
|
|
408
|
-
/** Whether connector is usable */
|
|
409
|
-
constructor(_ref) {
|
|
410
|
-
var {
|
|
411
|
-
chains = defaultChains,
|
|
412
|
-
options
|
|
413
|
-
} = _ref;
|
|
414
|
-
super();
|
|
415
|
-
|
|
416
|
-
_defineProperty(this, "id", void 0);
|
|
417
|
-
|
|
418
|
-
_defineProperty(this, "name", void 0);
|
|
419
|
-
|
|
420
|
-
_defineProperty(this, "chains", void 0);
|
|
421
|
-
|
|
422
|
-
_defineProperty(this, "options", void 0);
|
|
423
|
-
|
|
424
|
-
_defineProperty(this, "ready", void 0);
|
|
425
|
-
|
|
426
|
-
this.chains = chains;
|
|
427
|
-
this.options = options;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
isChainUnsupported(chainId) {
|
|
431
|
-
return !this.chains.some(x => x.id === chainId);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
exports.AddChainError = AddChainError;
|
|
437
|
-
exports.ChainNotConfiguredError = ChainNotConfiguredError;
|
|
438
|
-
exports.Connector = Connector;
|
|
439
|
-
exports.ConnectorAlreadyConnectedError = ConnectorAlreadyConnectedError;
|
|
440
|
-
exports.ConnectorNotFoundError = ConnectorNotFoundError;
|
|
441
|
-
exports.SwitchChainError = SwitchChainError;
|
|
442
|
-
exports.SwitchChainNotSupportedError = SwitchChainNotSupportedError;
|
|
443
|
-
exports.UserRejectedRequestError = UserRejectedRequestError;
|
|
444
|
-
exports._asyncToGenerator = _asyncToGenerator;
|
|
445
|
-
exports._checkPrivateRedeclaration = _checkPrivateRedeclaration;
|
|
446
|
-
exports._classPrivateFieldGet = _classPrivateFieldGet;
|
|
447
|
-
exports._classPrivateFieldInitSpec = _classPrivateFieldInitSpec;
|
|
448
|
-
exports._classPrivateFieldSet = _classPrivateFieldSet;
|
|
449
|
-
exports._defineProperty = _defineProperty;
|
|
450
|
-
exports.allChains = allChains;
|
|
451
|
-
exports.chain = chain;
|
|
452
|
-
exports.defaultChains = defaultChains;
|
|
453
|
-
exports.normalizeChainId = normalizeChainId;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { FetchEnsAddressArgs, FetchEnsAddressResult } from './fetchEnsAddress';
|
|
2
|
-
export declare type WatchEnsAddressCallback = (address: FetchEnsAddressResult) => void;
|
|
3
|
-
export declare function watchEnsAddress(args: FetchEnsAddressArgs, callback: WatchEnsAddressCallback): () => void;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { FetchEnsAvatarArgs, FetchEnsAvatarResult } from './fetchEnsAvatar';
|
|
2
|
-
export declare type WatchEnsAvatarCallback = (addressOrName: FetchEnsAvatarResult) => void;
|
|
3
|
-
export declare function watchEnsAvatar(args: FetchEnsAvatarArgs, callback: WatchEnsAvatarCallback): () => void;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { FetchEnsResolverArgs, FetchEnsResolverResult } from './fetchEnsResolver';
|
|
2
|
-
export declare type WatchEnsResolverCallback = (resolver: FetchEnsResolverResult) => void;
|
|
3
|
-
export declare function watchEnsResolver(args: FetchEnsResolverArgs, callback: WatchEnsResolverCallback): () => void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FetchFeeDataArgs, FetchFeeDataResult } from './fetchFeeData';
|
|
2
|
-
export declare type WatchFeeDataArgs = FetchFeeDataArgs & {
|
|
3
|
-
/** Watch for changes to block number */
|
|
4
|
-
listenToBlock?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare type WatchFeeDataCallback = (feeData: FetchFeeDataResult) => void;
|
|
7
|
-
export declare function watchFeeData(args: WatchFeeDataArgs, callback: WatchFeeDataCallback): () => void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const erc1155ABI: {
|
|
2
|
-
constant: boolean;
|
|
3
|
-
inputs: {
|
|
4
|
-
internalType: string;
|
|
5
|
-
name: string;
|
|
6
|
-
type: string;
|
|
7
|
-
}[];
|
|
8
|
-
name: string;
|
|
9
|
-
outputs: {
|
|
10
|
-
internalType: string;
|
|
11
|
-
name: string;
|
|
12
|
-
type: string;
|
|
13
|
-
}[];
|
|
14
|
-
payable: boolean;
|
|
15
|
-
stateMutability: string;
|
|
16
|
-
type: string;
|
|
17
|
-
}[];
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export declare const erc20ABI: ({
|
|
2
|
-
constant: boolean;
|
|
3
|
-
inputs: {
|
|
4
|
-
name: string;
|
|
5
|
-
type: string;
|
|
6
|
-
}[];
|
|
7
|
-
name: string;
|
|
8
|
-
outputs: {
|
|
9
|
-
name: string;
|
|
10
|
-
type: string;
|
|
11
|
-
}[];
|
|
12
|
-
payable: boolean;
|
|
13
|
-
stateMutability: string;
|
|
14
|
-
type: string;
|
|
15
|
-
anonymous?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
payable: boolean;
|
|
18
|
-
stateMutability: string;
|
|
19
|
-
type: string;
|
|
20
|
-
constant?: undefined;
|
|
21
|
-
inputs?: undefined;
|
|
22
|
-
name?: undefined;
|
|
23
|
-
outputs?: undefined;
|
|
24
|
-
anonymous?: undefined;
|
|
25
|
-
} | {
|
|
26
|
-
anonymous: boolean;
|
|
27
|
-
inputs: {
|
|
28
|
-
indexed: boolean;
|
|
29
|
-
name: string;
|
|
30
|
-
type: string;
|
|
31
|
-
}[];
|
|
32
|
-
name: string;
|
|
33
|
-
type: string;
|
|
34
|
-
constant?: undefined;
|
|
35
|
-
outputs?: undefined;
|
|
36
|
-
payable?: undefined;
|
|
37
|
-
stateMutability?: undefined;
|
|
38
|
-
})[];
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const erc721ABI: {
|
|
2
|
-
inputs: {
|
|
3
|
-
internalType: string;
|
|
4
|
-
name: string;
|
|
5
|
-
type: string;
|
|
6
|
-
}[];
|
|
7
|
-
name: string;
|
|
8
|
-
outputs: {
|
|
9
|
-
internalType: string;
|
|
10
|
-
name: string;
|
|
11
|
-
type: string;
|
|
12
|
-
}[];
|
|
13
|
-
stateMutability: string;
|
|
14
|
-
type: string;
|
|
15
|
-
}[];
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
type AddEthereumChainParameter = {
|
|
2
|
-
chainId: string // A 0x-prefixed hexadecimal string
|
|
3
|
-
chainName: string
|
|
4
|
-
nativeCurrency?: {
|
|
5
|
-
name: string
|
|
6
|
-
symbol: string // 2-6 characters long
|
|
7
|
-
decimals: 18
|
|
8
|
-
}
|
|
9
|
-
rpcUrls: string[]
|
|
10
|
-
blockExplorerUrls?: string[]
|
|
11
|
-
iconUrls?: string[] // Currently ignored.
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type WatchAssetParams = {
|
|
15
|
-
type: 'ERC20' // In the future, other standards will be supported
|
|
16
|
-
options: {
|
|
17
|
-
address: string // The address of the token contract
|
|
18
|
-
decimals: number // The number of token decimals
|
|
19
|
-
image?: string // A string url of the token logo
|
|
20
|
-
symbol: string // A ticker symbol or shorthand, up to 5 characters
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type RequestArguments =
|
|
25
|
-
| { method: 'eth_accounts' }
|
|
26
|
-
| { method: 'eth_chainId' }
|
|
27
|
-
| { method: 'eth_requestAccounts' }
|
|
28
|
-
| { method: 'personal_sign'; params: [string, string] }
|
|
29
|
-
| { method: 'wallet_addEthereumChain'; params: AddEthereumChainParameter[] }
|
|
30
|
-
| { method: 'wallet_switchEthereumChain'; params: [{ chainId: string }] }
|
|
31
|
-
| { method: 'wallet_watchAsset'; params: WatchAssetParams }
|
|
32
|
-
|
|
33
|
-
type InjectedProviders = {
|
|
34
|
-
isCoinbaseWallet?: true
|
|
35
|
-
isFrame?: true
|
|
36
|
-
isMetaMask?: true
|
|
37
|
-
isTally?: true
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface Window {
|
|
41
|
-
ethereum?: InjectedProviders & {
|
|
42
|
-
on?: (...args: any[]) => void
|
|
43
|
-
removeListener?: (...args: any[]) => void
|
|
44
|
-
request<T = any>(args: RequestArguments): Promise<T>
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface ProviderRpcError extends Error {
|
|
49
|
-
code: 4001 | 4902
|
|
50
|
-
data?: unknown
|
|
51
|
-
message: string
|
|
52
|
-
}
|