@wagmi/core 0.2.0-next.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 +21 -0
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.d.ts +1 -0
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +252 -0
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.js +7 -0
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +252 -0
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +230 -0
- package/connectors/coinbaseWallet/package.json +4 -0
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.d.ts +1 -0
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +304 -0
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.js +7 -0
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +304 -0
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +295 -0
- package/connectors/mock/package.json +4 -0
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.d.ts +1 -0
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +216 -0
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.js +7 -0
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +216 -0
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +194 -0
- package/connectors/walletConnect/package.json +4 -0
- package/dist/base-09a653f3.cjs.dev.js +453 -0
- package/dist/base-824c3b6d.esm.js +430 -0
- package/dist/base-d8123d5f.cjs.prod.js +453 -0
- package/dist/classPrivateMethodGet-0e9a7925.cjs.prod.js +19 -0
- package/dist/classPrivateMethodGet-38b54c7a.cjs.dev.js +19 -0
- package/dist/classPrivateMethodGet-c9db96d6.esm.js +16 -0
- package/dist/declarations/src/actions/accounts/connect.d.ts +7 -0
- package/dist/declarations/src/actions/accounts/disconnect.d.ts +1 -0
- package/dist/declarations/src/actions/accounts/fetchBalance.d.ts +18 -0
- package/dist/declarations/src/actions/accounts/fetchSigner.d.ts +3 -0
- package/dist/declarations/src/actions/accounts/getAccount.d.ts +6 -0
- package/dist/declarations/src/actions/accounts/getNetwork.d.ts +9 -0
- package/dist/declarations/src/actions/accounts/index.d.ts +13 -0
- package/dist/declarations/src/actions/accounts/signMessage.d.ts +9 -0
- package/dist/declarations/src/actions/accounts/signTypedData.d.ts +13 -0
- package/dist/declarations/src/actions/accounts/switchNetwork.d.ts +6 -0
- package/dist/declarations/src/actions/accounts/watchAccount.d.ts +3 -0
- package/dist/declarations/src/actions/accounts/watchBalance.d.ts +3 -0
- package/dist/declarations/src/actions/accounts/watchNetwork.d.ts +3 -0
- package/dist/declarations/src/actions/accounts/watchSigner.d.ts +3 -0
- package/dist/declarations/src/actions/contracts/getContract.d.ts +11 -0
- package/dist/declarations/src/actions/contracts/index.d.ts +5 -0
- package/dist/declarations/src/actions/contracts/readContract.d.ts +11 -0
- package/dist/declarations/src/actions/contracts/watchContractEvent.d.ts +12 -0
- package/dist/declarations/src/actions/contracts/watchReadContract.d.ts +7 -0
- package/dist/declarations/src/actions/contracts/writeContract.d.ts +11 -0
- package/dist/declarations/src/actions/ens/fetchEnsAddress.d.ts +6 -0
- package/dist/declarations/src/actions/ens/fetchEnsAvatar.d.ts +6 -0
- package/dist/declarations/src/actions/ens/fetchEnsName.d.ts +6 -0
- package/dist/declarations/src/actions/ens/fetchEnsResolver.d.ts +7 -0
- package/dist/declarations/src/actions/ens/index.d.ts +8 -0
- package/dist/declarations/src/actions/ens/watchEnsAddress.d.ts +3 -0
- package/dist/declarations/src/actions/ens/watchEnsAvatar.d.ts +3 -0
- package/dist/declarations/src/actions/ens/watchEnsName.d.ts +3 -0
- package/dist/declarations/src/actions/ens/watchEnsResolver.d.ts +3 -0
- package/dist/declarations/src/actions/index.d.ts +7 -0
- package/dist/declarations/src/actions/network-status/fetchBlockNumber.d.ts +2 -0
- package/dist/declarations/src/actions/network-status/fetchFeeData.d.ts +14 -0
- package/dist/declarations/src/actions/network-status/index.d.ts +4 -0
- package/dist/declarations/src/actions/network-status/watchBlockNumber.d.ts +6 -0
- package/dist/declarations/src/actions/network-status/watchFeeData.d.ts +7 -0
- package/dist/declarations/src/actions/providers/getProvider.d.ts +3 -0
- package/dist/declarations/src/actions/providers/getWebSocketProvider.d.ts +3 -0
- package/dist/declarations/src/actions/providers/index.d.ts +4 -0
- package/dist/declarations/src/actions/providers/watchProvider.d.ts +3 -0
- package/dist/declarations/src/actions/providers/watchWebSocketProvider.d.ts +3 -0
- package/dist/declarations/src/actions/tokens/fetchToken.d.ts +24 -0
- package/dist/declarations/src/actions/tokens/index.d.ts +2 -0
- package/dist/declarations/src/actions/tokens/watchToken.d.ts +3 -0
- package/dist/declarations/src/actions/transactions/index.d.ts +2 -0
- package/dist/declarations/src/actions/transactions/sendTransaction.d.ts +7 -0
- package/dist/declarations/src/actions/transactions/waitForTransaction.d.ts +15 -0
- package/dist/declarations/src/client.d.ts +78 -0
- package/dist/declarations/src/connectors/base.d.ts +50 -0
- package/dist/declarations/src/connectors/coinbaseWallet.d.ts +43 -0
- package/dist/declarations/src/connectors/index.d.ts +2 -0
- package/dist/declarations/src/connectors/injected.d.ts +55 -0
- package/dist/declarations/src/connectors/mock/connector.d.ts +37 -0
- package/dist/declarations/src/connectors/mock/index.d.ts +2 -0
- package/dist/declarations/src/connectors/mock/provider.d.ts +40 -0
- package/dist/declarations/src/connectors/walletConnect.d.ts +32 -0
- package/dist/declarations/src/constants/abis/erc1155.d.ts +17 -0
- package/dist/declarations/src/constants/abis/erc20.d.ts +38 -0
- package/dist/declarations/src/constants/abis/erc721.d.ts +15 -0
- package/dist/declarations/src/constants/abis/index.d.ts +3 -0
- package/dist/declarations/src/constants/chains.d.ts +10 -0
- package/dist/declarations/src/constants/index.d.ts +3 -0
- package/dist/declarations/src/constants/units.d.ts +1 -0
- package/dist/declarations/src/errors.d.ts +28 -0
- package/dist/declarations/src/index.d.ts +9 -0
- package/dist/declarations/src/storage.d.ts +12 -0
- package/dist/declarations/src/types/declarations.d.ts +52 -0
- package/dist/declarations/src/types/index.d.ts +14 -0
- package/dist/declarations/src/utils/getInjectedName.d.ts +1 -0
- package/dist/declarations/src/utils/index.d.ts +2 -0
- package/dist/declarations/src/utils/normalizeChainId.d.ts +1 -0
- package/dist/wagmi-core.cjs.d.ts +1 -0
- package/dist/wagmi-core.cjs.dev.js +1689 -0
- package/dist/wagmi-core.cjs.js +7 -0
- package/dist/wagmi-core.cjs.prod.js +1689 -0
- package/dist/wagmi-core.esm.js +1623 -0
- package/package.json +67 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
|
|
3
|
+
function _defineProperty(obj, key, value) {
|
|
4
|
+
if (key in obj) {
|
|
5
|
+
Object.defineProperty(obj, key, {
|
|
6
|
+
value: value,
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true
|
|
10
|
+
});
|
|
11
|
+
} else {
|
|
12
|
+
obj[key] = value;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
19
|
+
try {
|
|
20
|
+
var info = gen[key](arg);
|
|
21
|
+
var value = info.value;
|
|
22
|
+
} catch (error) {
|
|
23
|
+
reject(error);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (info.done) {
|
|
28
|
+
resolve(value);
|
|
29
|
+
} else {
|
|
30
|
+
Promise.resolve(value).then(_next, _throw);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function _asyncToGenerator(fn) {
|
|
35
|
+
return function () {
|
|
36
|
+
var self = this,
|
|
37
|
+
args = arguments;
|
|
38
|
+
return new Promise(function (resolve, reject) {
|
|
39
|
+
var gen = fn.apply(self, args);
|
|
40
|
+
|
|
41
|
+
function _next(value) {
|
|
42
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function _throw(err) {
|
|
46
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_next(undefined);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
55
|
+
if (privateCollection.has(obj)) {
|
|
56
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
61
|
+
_checkPrivateRedeclaration(obj, privateMap);
|
|
62
|
+
privateMap.set(obj, value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function _classApplyDescriptorGet(receiver, descriptor) {
|
|
66
|
+
if (descriptor.get) {
|
|
67
|
+
return descriptor.get.call(receiver);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return descriptor.value;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) {
|
|
74
|
+
if (!privateMap.has(receiver)) {
|
|
75
|
+
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return privateMap.get(receiver);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function _classPrivateFieldGet(receiver, privateMap) {
|
|
82
|
+
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
83
|
+
return _classApplyDescriptorGet(receiver, descriptor);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) {
|
|
87
|
+
if (descriptor.set) {
|
|
88
|
+
descriptor.set.call(receiver, value);
|
|
89
|
+
} else {
|
|
90
|
+
if (!descriptor.writable) {
|
|
91
|
+
throw new TypeError("attempted to set read only private field");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
descriptor.value = value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
99
|
+
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
|
|
100
|
+
_classApplyDescriptorSet(receiver, descriptor, value);
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Data from Chainlist
|
|
106
|
+
* @see https://chainlist.org
|
|
107
|
+
*/
|
|
108
|
+
var chain = {
|
|
109
|
+
mainnet: {
|
|
110
|
+
id: 1,
|
|
111
|
+
name: 'Mainnet',
|
|
112
|
+
nativeCurrency: {
|
|
113
|
+
name: 'Ether',
|
|
114
|
+
symbol: 'ETH',
|
|
115
|
+
decimals: 18
|
|
116
|
+
},
|
|
117
|
+
rpcUrls: ['https://mainnet.infura.io/v3'],
|
|
118
|
+
blockExplorers: [{
|
|
119
|
+
name: 'Etherscan',
|
|
120
|
+
url: 'https://etherscan.io'
|
|
121
|
+
}]
|
|
122
|
+
},
|
|
123
|
+
ropsten: {
|
|
124
|
+
id: 3,
|
|
125
|
+
name: 'Ropsten',
|
|
126
|
+
nativeCurrency: {
|
|
127
|
+
name: 'Ropsten Ether',
|
|
128
|
+
symbol: 'ropETH',
|
|
129
|
+
decimals: 18
|
|
130
|
+
},
|
|
131
|
+
rpcUrls: ['https://ropsten.infura.io/v3'],
|
|
132
|
+
blockExplorers: [{
|
|
133
|
+
name: 'Etherscan',
|
|
134
|
+
url: 'https://ropsten.etherscan.io'
|
|
135
|
+
}],
|
|
136
|
+
testnet: true
|
|
137
|
+
},
|
|
138
|
+
rinkeby: {
|
|
139
|
+
id: 4,
|
|
140
|
+
name: 'Rinkeby',
|
|
141
|
+
nativeCurrency: {
|
|
142
|
+
name: 'Rinkeby Ether',
|
|
143
|
+
symbol: 'rETH',
|
|
144
|
+
decimals: 18
|
|
145
|
+
},
|
|
146
|
+
rpcUrls: ['https://rinkeby.infura.io/v3'],
|
|
147
|
+
blockExplorers: [{
|
|
148
|
+
name: 'Etherscan',
|
|
149
|
+
url: 'https://rinkeby.etherscan.io'
|
|
150
|
+
}],
|
|
151
|
+
testnet: true
|
|
152
|
+
},
|
|
153
|
+
goerli: {
|
|
154
|
+
id: 5,
|
|
155
|
+
name: 'Goerli',
|
|
156
|
+
nativeCurrency: {
|
|
157
|
+
name: 'Goerli Ether',
|
|
158
|
+
symbol: 'gETH',
|
|
159
|
+
decimals: 18
|
|
160
|
+
},
|
|
161
|
+
rpcUrls: ['https://goerli.infura.io/v3'],
|
|
162
|
+
blockExplorers: [{
|
|
163
|
+
name: 'Etherscan',
|
|
164
|
+
url: 'https://goerli.etherscan.io'
|
|
165
|
+
}],
|
|
166
|
+
testnet: true
|
|
167
|
+
},
|
|
168
|
+
kovan: {
|
|
169
|
+
id: 42,
|
|
170
|
+
name: 'Kovan',
|
|
171
|
+
nativeCurrency: {
|
|
172
|
+
name: 'Kovan Ether',
|
|
173
|
+
symbol: 'kETH',
|
|
174
|
+
decimals: 18
|
|
175
|
+
},
|
|
176
|
+
rpcUrls: ['https://kovan.infura.io/v3'],
|
|
177
|
+
blockExplorers: [{
|
|
178
|
+
name: 'Etherscan',
|
|
179
|
+
url: 'https://kovan.etherscan.io'
|
|
180
|
+
}],
|
|
181
|
+
testnet: true
|
|
182
|
+
},
|
|
183
|
+
optimism: {
|
|
184
|
+
id: 10,
|
|
185
|
+
name: 'Optimism',
|
|
186
|
+
nativeCurrency: {
|
|
187
|
+
name: 'Ether',
|
|
188
|
+
symbol: 'ETH',
|
|
189
|
+
decimals: 18
|
|
190
|
+
},
|
|
191
|
+
rpcUrls: ['https://mainnet.optimism.io'],
|
|
192
|
+
blockExplorers: [{
|
|
193
|
+
name: 'Etherscan',
|
|
194
|
+
url: 'https://optimistic.etherscan.io'
|
|
195
|
+
}]
|
|
196
|
+
},
|
|
197
|
+
optimismKovan: {
|
|
198
|
+
id: 69,
|
|
199
|
+
name: 'Optimism Kovan',
|
|
200
|
+
nativeCurrency: {
|
|
201
|
+
name: 'Kovan Ether',
|
|
202
|
+
symbol: 'KOR',
|
|
203
|
+
decimals: 18
|
|
204
|
+
},
|
|
205
|
+
rpcUrls: ['https://kovan.optimism.io'],
|
|
206
|
+
blockExplorers: [{
|
|
207
|
+
name: 'Etherscan',
|
|
208
|
+
url: 'https://kovan-optimistic.etherscan.io'
|
|
209
|
+
}],
|
|
210
|
+
testnet: true
|
|
211
|
+
},
|
|
212
|
+
polygonMainnet: {
|
|
213
|
+
id: 137,
|
|
214
|
+
name: 'Polygon Mainnet',
|
|
215
|
+
nativeCurrency: {
|
|
216
|
+
name: 'MATIC',
|
|
217
|
+
symbol: 'MATIC',
|
|
218
|
+
decimals: 18
|
|
219
|
+
},
|
|
220
|
+
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'],
|
|
221
|
+
blockExplorers: [{
|
|
222
|
+
name: 'Polygonscan',
|
|
223
|
+
url: 'https://polygonscan.com'
|
|
224
|
+
}]
|
|
225
|
+
},
|
|
226
|
+
polygonTestnetMumbai: {
|
|
227
|
+
id: 80001,
|
|
228
|
+
name: 'Mumbai',
|
|
229
|
+
nativeCurrency: {
|
|
230
|
+
name: 'MATIC',
|
|
231
|
+
symbol: 'MATIC',
|
|
232
|
+
decimals: 18
|
|
233
|
+
},
|
|
234
|
+
rpcUrls: ['https://matic-mumbai.chainstacklabs.com', 'https://rpc-mumbai.maticvigil.com', 'https://matic-testnet-archive-rpc.bwarelabs.com'],
|
|
235
|
+
blockExplorers: [{
|
|
236
|
+
name: 'Polygonscan',
|
|
237
|
+
url: 'https://mumbai.polygonscan.com'
|
|
238
|
+
}],
|
|
239
|
+
testnet: true
|
|
240
|
+
},
|
|
241
|
+
arbitrumOne: {
|
|
242
|
+
id: 42161,
|
|
243
|
+
name: 'Arbitrum One',
|
|
244
|
+
nativeCurrency: {
|
|
245
|
+
name: 'Ether',
|
|
246
|
+
symbol: 'AETH',
|
|
247
|
+
decimals: 18
|
|
248
|
+
},
|
|
249
|
+
rpcUrls: ['https://arb1.arbitrum.io/rpc'],
|
|
250
|
+
blockExplorers: [{
|
|
251
|
+
name: 'Arbiscan',
|
|
252
|
+
url: 'https://arbiscan.io'
|
|
253
|
+
}, {
|
|
254
|
+
name: 'Arbitrum Explorer',
|
|
255
|
+
url: 'https://explorer.arbitrum.io'
|
|
256
|
+
}]
|
|
257
|
+
},
|
|
258
|
+
arbitrumRinkeby: {
|
|
259
|
+
id: 421611,
|
|
260
|
+
name: 'Arbitrum Rinkeby',
|
|
261
|
+
nativeCurrency: {
|
|
262
|
+
name: 'Arbitrum Rinkeby Ether',
|
|
263
|
+
symbol: 'ARETH',
|
|
264
|
+
decimals: 18
|
|
265
|
+
},
|
|
266
|
+
rpcUrls: ['https://rinkeby.arbitrum.io/rpc'],
|
|
267
|
+
blockExplorers: [{
|
|
268
|
+
name: 'Arbitrum Explorer',
|
|
269
|
+
url: 'https://rinkeby-explorer.arbitrum.io'
|
|
270
|
+
}],
|
|
271
|
+
testnet: true
|
|
272
|
+
},
|
|
273
|
+
avalanche: {
|
|
274
|
+
id: 43114,
|
|
275
|
+
name: 'Avalanche Mainnet',
|
|
276
|
+
nativeCurrency: {
|
|
277
|
+
name: 'Avalanche',
|
|
278
|
+
symbol: 'AVAX',
|
|
279
|
+
decimals: 18
|
|
280
|
+
},
|
|
281
|
+
rpcUrls: ['https://api.avax.network/ext/bc/C/rpc'],
|
|
282
|
+
blockExplorers: [{
|
|
283
|
+
name: 'SnowTrace',
|
|
284
|
+
url: 'https://snowtrace.io'
|
|
285
|
+
}],
|
|
286
|
+
testnet: false
|
|
287
|
+
},
|
|
288
|
+
avalancheFuji: {
|
|
289
|
+
id: 43113,
|
|
290
|
+
name: 'Avalanche Fuji Testnet',
|
|
291
|
+
nativeCurrency: {
|
|
292
|
+
name: 'Avalanche',
|
|
293
|
+
symbol: 'AVAX',
|
|
294
|
+
decimals: 18
|
|
295
|
+
},
|
|
296
|
+
rpcUrls: ['https://api.avax-test.network/ext/bc/C/rpc'],
|
|
297
|
+
blockExplorers: [{
|
|
298
|
+
name: 'SnowTrace',
|
|
299
|
+
url: 'https://testnet.snowtrace.io'
|
|
300
|
+
}],
|
|
301
|
+
testnet: true
|
|
302
|
+
},
|
|
303
|
+
localhost: {
|
|
304
|
+
id: 1337,
|
|
305
|
+
name: 'Localhost',
|
|
306
|
+
rpcUrls: ['https://127.0.0.1:8545']
|
|
307
|
+
},
|
|
308
|
+
hardhat: {
|
|
309
|
+
id: 31337,
|
|
310
|
+
name: 'Hardhat',
|
|
311
|
+
rpcUrls: ['http://127.0.0.1:8545']
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
var allChains = Object.values(chain);
|
|
315
|
+
var defaultChains = [chain.mainnet, chain.ropsten, chain.rinkeby, chain.goerli, chain.kovan];
|
|
316
|
+
|
|
317
|
+
function normalizeChainId(chainId) {
|
|
318
|
+
if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
|
|
319
|
+
return chainId;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
class AddChainError extends Error {
|
|
323
|
+
constructor() {
|
|
324
|
+
super(...arguments);
|
|
325
|
+
|
|
326
|
+
_defineProperty(this, "name", 'AddChainError');
|
|
327
|
+
|
|
328
|
+
_defineProperty(this, "message", 'Error adding chain');
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
}
|
|
332
|
+
class ChainNotConfiguredError extends Error {
|
|
333
|
+
constructor() {
|
|
334
|
+
super(...arguments);
|
|
335
|
+
|
|
336
|
+
_defineProperty(this, "name", 'ChainNotConfigured');
|
|
337
|
+
|
|
338
|
+
_defineProperty(this, "message", 'Chain not configured');
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
}
|
|
342
|
+
class ConnectorAlreadyConnectedError extends Error {
|
|
343
|
+
constructor() {
|
|
344
|
+
super(...arguments);
|
|
345
|
+
|
|
346
|
+
_defineProperty(this, "name", 'ConnectorAlreadyConnectedError');
|
|
347
|
+
|
|
348
|
+
_defineProperty(this, "message", 'Connector already connected');
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
}
|
|
352
|
+
class ConnectorNotFoundError extends Error {
|
|
353
|
+
constructor() {
|
|
354
|
+
super(...arguments);
|
|
355
|
+
|
|
356
|
+
_defineProperty(this, "name", 'ConnectorNotFoundError');
|
|
357
|
+
|
|
358
|
+
_defineProperty(this, "message", 'Connector not found');
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
}
|
|
362
|
+
class SwitchChainError extends Error {
|
|
363
|
+
constructor() {
|
|
364
|
+
super(...arguments);
|
|
365
|
+
|
|
366
|
+
_defineProperty(this, "name", 'SwitchChainError');
|
|
367
|
+
|
|
368
|
+
_defineProperty(this, "message", 'Error switching chain');
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
}
|
|
372
|
+
class SwitchChainNotSupportedError extends Error {
|
|
373
|
+
constructor() {
|
|
374
|
+
super(...arguments);
|
|
375
|
+
|
|
376
|
+
_defineProperty(this, "name", 'SwitchChainNotSupportedError');
|
|
377
|
+
|
|
378
|
+
_defineProperty(this, "message", 'Switch chain not supported by connector');
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
}
|
|
382
|
+
class UserRejectedRequestError extends Error {
|
|
383
|
+
constructor() {
|
|
384
|
+
super(...arguments);
|
|
385
|
+
|
|
386
|
+
_defineProperty(this, "name", 'UserRejectedRequestError');
|
|
387
|
+
|
|
388
|
+
_defineProperty(this, "message", 'User rejected request');
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
class Connector extends EventEmitter {
|
|
394
|
+
/** Unique connector id */
|
|
395
|
+
|
|
396
|
+
/** Connector name */
|
|
397
|
+
|
|
398
|
+
/** Chains connector supports */
|
|
399
|
+
|
|
400
|
+
/** Options to use with connector */
|
|
401
|
+
|
|
402
|
+
/** Whether connector is usable */
|
|
403
|
+
constructor(_ref) {
|
|
404
|
+
var {
|
|
405
|
+
chains = defaultChains,
|
|
406
|
+
options
|
|
407
|
+
} = _ref;
|
|
408
|
+
super();
|
|
409
|
+
|
|
410
|
+
_defineProperty(this, "id", void 0);
|
|
411
|
+
|
|
412
|
+
_defineProperty(this, "name", void 0);
|
|
413
|
+
|
|
414
|
+
_defineProperty(this, "chains", void 0);
|
|
415
|
+
|
|
416
|
+
_defineProperty(this, "options", void 0);
|
|
417
|
+
|
|
418
|
+
_defineProperty(this, "ready", void 0);
|
|
419
|
+
|
|
420
|
+
this.chains = chains;
|
|
421
|
+
this.options = options;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
isChainUnsupported(chainId) {
|
|
425
|
+
return !this.chains.some(x => x.id === chainId);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export { AddChainError as A, Connector as C, SwitchChainError as S, UserRejectedRequestError as U, _defineProperty as _, _classPrivateFieldInitSpec as a, _asyncToGenerator as b, ConnectorNotFoundError as c, _classPrivateFieldSet as d, _classPrivateFieldGet as e, allChains as f, ChainNotConfiguredError as g, ConnectorAlreadyConnectedError as h, SwitchChainNotSupportedError as i, chain as j, defaultChains as k, _checkPrivateRedeclaration as l, normalizeChainId as n };
|