@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,453 @@
|
|
|
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;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var base = require('./base-d8123d5f.cjs.prod.js');
|
|
4
|
+
|
|
5
|
+
function _classPrivateMethodInitSpec(obj, privateSet) {
|
|
6
|
+
base._checkPrivateRedeclaration(obj, privateSet);
|
|
7
|
+
privateSet.add(obj);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) {
|
|
11
|
+
if (!privateSet.has(receiver)) {
|
|
12
|
+
throw new TypeError("attempted to get private field on non-instance");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return fn;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports._classPrivateMethodGet = _classPrivateMethodGet;
|
|
19
|
+
exports._classPrivateMethodInitSpec = _classPrivateMethodInitSpec;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var base = require('./base-09a653f3.cjs.dev.js');
|
|
4
|
+
|
|
5
|
+
function _classPrivateMethodInitSpec(obj, privateSet) {
|
|
6
|
+
base._checkPrivateRedeclaration(obj, privateSet);
|
|
7
|
+
privateSet.add(obj);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) {
|
|
11
|
+
if (!privateSet.has(receiver)) {
|
|
12
|
+
throw new TypeError("attempted to get private field on non-instance");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return fn;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports._classPrivateMethodGet = _classPrivateMethodGet;
|
|
19
|
+
exports._classPrivateMethodInitSpec = _classPrivateMethodInitSpec;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { l as _checkPrivateRedeclaration } from './base-824c3b6d.esm.js';
|
|
2
|
+
|
|
3
|
+
function _classPrivateMethodInitSpec(obj, privateSet) {
|
|
4
|
+
_checkPrivateRedeclaration(obj, privateSet);
|
|
5
|
+
privateSet.add(obj);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) {
|
|
9
|
+
if (!privateSet.has(receiver)) {
|
|
10
|
+
throw new TypeError("attempted to get private field on non-instance");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return fn;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { _classPrivateMethodInitSpec as _, _classPrivateMethodGet as a };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Client } from '../../client';
|
|
2
|
+
import { Connector } from '../../connectors';
|
|
3
|
+
export declare type ConnectResult = {
|
|
4
|
+
data: Client['data'];
|
|
5
|
+
connector: Client['connector'];
|
|
6
|
+
};
|
|
7
|
+
export declare function connect(connector: Connector): Promise<ConnectResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function disconnect(): Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers/lib/ethers';
|
|
2
|
+
import { Unit } from '../../types';
|
|
3
|
+
export declare type FetchBalanceArgs = {
|
|
4
|
+
/** Address or ENS name */
|
|
5
|
+
addressOrName: string;
|
|
6
|
+
/** Units for formatting output */
|
|
7
|
+
formatUnits?: Unit | number;
|
|
8
|
+
/** ERC-20 address */
|
|
9
|
+
token?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare type FetchBalanceResult = {
|
|
12
|
+
decimals: number;
|
|
13
|
+
formatted: string;
|
|
14
|
+
symbol: string;
|
|
15
|
+
unit: Unit | number;
|
|
16
|
+
value: BigNumber;
|
|
17
|
+
};
|
|
18
|
+
export declare function fetchBalance({ addressOrName, formatUnits: unit, token, }: FetchBalanceArgs): Promise<FetchBalanceResult>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { connect, type ConnectResult } from './connect';
|
|
2
|
+
export { disconnect } from './disconnect';
|
|
3
|
+
export { fetchBalance, type FetchBalanceArgs, type FetchBalanceResult, } from './fetchBalance';
|
|
4
|
+
export { fetchSigner, type FetchSignerResult } from './fetchSigner';
|
|
5
|
+
export { getAccount, type GetAccountResult } from './getAccount';
|
|
6
|
+
export { getNetwork, type GetNetworkResult } from './getNetwork';
|
|
7
|
+
export { signMessage, type SignMessageArgs, type SignMessageResult, } from './signMessage';
|
|
8
|
+
export { signTypedData, type SignTypedDataArgs, type SignTypedDataResult, } from './signTypedData';
|
|
9
|
+
export { switchNetwork, type SwitchNetworkArgs, type SwitchNetworkResult, } from './switchNetwork';
|
|
10
|
+
export { watchAccount, type WatchAccountCallback } from './watchAccount';
|
|
11
|
+
export { watchBalance, type WatchBalanceCallback } from './watchBalance';
|
|
12
|
+
export { watchNetwork, type WatchNetworkCallback } from './watchNetwork';
|
|
13
|
+
export { watchSigner, type WatchSignerCallback } from './watchSigner';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Bytes } from 'ethers/lib/utils';
|
|
2
|
+
export declare type SignMessageArgs = {
|
|
3
|
+
/** Message to sign with wallet */
|
|
4
|
+
message: Bytes | string;
|
|
5
|
+
};
|
|
6
|
+
declare type Signature = string;
|
|
7
|
+
export declare type SignMessageResult = Signature;
|
|
8
|
+
export declare function signMessage(args: SignMessageArgs): Promise<SignMessageResult>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { providers } from 'ethers';
|
|
2
|
+
declare type SignTypedData = Parameters<providers.JsonRpcSigner['_signTypedData']>;
|
|
3
|
+
export declare type SignTypedDataArgs = {
|
|
4
|
+
/** Domain or domain signature for origin or contract */
|
|
5
|
+
domain: SignTypedData[0];
|
|
6
|
+
/** Named list of all type definitions */
|
|
7
|
+
types: SignTypedData[1];
|
|
8
|
+
/** Data to sign */
|
|
9
|
+
value: SignTypedData[2];
|
|
10
|
+
};
|
|
11
|
+
export declare type SignTypedDataResult = string;
|
|
12
|
+
export declare function signTypedData(args: SignTypedDataArgs): Promise<SignTypedDataResult>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Provider } from '@ethersproject/providers';
|
|
2
|
+
import { Contract, ContractInterface, Signer } from 'ethers/lib/ethers';
|
|
3
|
+
export declare type GetContractArgs = {
|
|
4
|
+
/** Contract address or ENS name */
|
|
5
|
+
addressOrName: string;
|
|
6
|
+
/** Contract interface or ABI */
|
|
7
|
+
contractInterface: ContractInterface;
|
|
8
|
+
/** Signer or provider to attach to contract */
|
|
9
|
+
signerOrProvider?: Signer | Provider;
|
|
10
|
+
};
|
|
11
|
+
export declare function getContract<T = Contract>({ addressOrName, contractInterface, signerOrProvider, }: GetContractArgs): T;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { getContract, type GetContractArgs } from './getContract';
|
|
2
|
+
export { readContract, type ReadContractArgs, type ReadContractConfig, type ReadContractResult, } from './readContract';
|
|
3
|
+
export { watchContractEvent } from './watchContractEvent';
|
|
4
|
+
export { watchReadContract, type WatchReadContractArgs, type WatchReadContractConfig, type WatchReadContractResult, } from './watchReadContract';
|
|
5
|
+
export { writeContract, type WriteContractArgs, type WriteContractConfig, type WriteContractResult, } from './writeContract';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CallOverrides, Contract as EthersContract } from 'ethers/lib/ethers';
|
|
2
|
+
import { Result } from 'ethers/lib/utils';
|
|
3
|
+
import { GetContractArgs } from './getContract';
|
|
4
|
+
export declare type ReadContractArgs = GetContractArgs;
|
|
5
|
+
export declare type ReadContractConfig = {
|
|
6
|
+
/** Arguments to pass contract method */
|
|
7
|
+
args?: any | any[];
|
|
8
|
+
overrides?: CallOverrides;
|
|
9
|
+
};
|
|
10
|
+
export declare type ReadContractResult = Result;
|
|
11
|
+
export declare function readContract<Contract extends EthersContract = EthersContract>(contractConfig: ReadContractArgs, functionName: string, { args, overrides }?: ReadContractConfig): Promise<Result>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Contract as EthersContract } from 'ethers/lib/ethers';
|
|
2
|
+
import { GetContractArgs } from './getContract';
|
|
3
|
+
declare type Config = {
|
|
4
|
+
/** Receive only a single event */
|
|
5
|
+
once?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function watchContractEvent<Contract extends EthersContract = EthersContract>(
|
|
8
|
+
/** Contract configuration */
|
|
9
|
+
contractArgs: GetContractArgs,
|
|
10
|
+
/** Event name to listen to */
|
|
11
|
+
eventName: Parameters<Contract['on']>[0], callback: Parameters<Contract['on']>[1], { once }?: Config): () => void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReadContractArgs, ReadContractConfig, ReadContractResult } from './readContract';
|
|
2
|
+
export declare type WatchReadContractArgs = ReadContractArgs;
|
|
3
|
+
export declare type WatchReadContractConfig = ReadContractConfig & {
|
|
4
|
+
listenToBlock?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare type WatchReadContractResult = (result: ReadContractResult) => void;
|
|
7
|
+
export declare function watchReadContract(contractConfig: WatchReadContractArgs, functionName: string, config: WatchReadContractConfig | undefined, callback: WatchReadContractResult): () => void;
|