@wagmi/core 0.10.10 → 0.10.11-cjs
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/dist/chains.d.ts +1 -1
- package/dist/chains.js +187 -171
- package/dist/chunk-BVC4KGLQ.js +8 -8
- package/dist/chunk-EQOEZP46.js +5 -5
- package/dist/chunk-KFW652VN.js +6 -6
- package/dist/chunk-KX4UEHS5.js +1 -0
- package/dist/chunk-MQXBDTVK.js +7 -7
- package/dist/chunk-OL6OIPEP.js +188 -0
- package/dist/chunk-VQG3VKOR.js +243 -243
- package/dist/connectors/coinbaseWallet.js +5 -5
- package/dist/connectors/index.js +9 -9
- package/dist/connectors/injected.js +7 -7
- package/dist/connectors/ledger.js +5 -5
- package/dist/connectors/metaMask.js +5 -5
- package/dist/connectors/mock.js +9 -9
- package/dist/connectors/safe.js +5 -5
- package/dist/connectors/walletConnect.js +5 -5
- package/dist/connectors/walletConnectLegacy.js +5 -5
- package/dist/index.js +166 -166
- package/dist/internal/index.js +8 -8
- package/dist/internal/test.js +25 -25
- package/dist/providers/alchemy.js +11 -11
- package/dist/providers/infura.js +11 -11
- package/dist/providers/jsonRpc.js +8 -8
- package/dist/providers/public.js +7 -7
- package/package.json +4 -5
- package/dist/chunk-RIWXWG4Y.js +0 -172
package/dist/chunk-VQG3VKOR.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkBVC4KGLQjs = require('./chunk-BVC4KGLQ.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkMQXBDTVKjs = require('./chunk-MQXBDTVK.js');
|
|
10
10
|
|
|
11
11
|
// src/utils/configureChains.ts
|
|
12
|
-
|
|
12
|
+
var _ethers = require('ethers');
|
|
13
13
|
function configureChains(defaultChains, providers2, {
|
|
14
14
|
minQuorum = 1,
|
|
15
15
|
pollingInterval = 4e3,
|
|
@@ -58,7 +58,7 @@ function configureChains(defaultChains, providers2, {
|
|
|
58
58
|
return {
|
|
59
59
|
chains,
|
|
60
60
|
provider: ({ chainId }) => {
|
|
61
|
-
const activeChain = chains.find((x) => x.id === chainId)
|
|
61
|
+
const activeChain = _nullishCoalesce(chains.find((x) => x.id === chainId), () => ( defaultChains[0]));
|
|
62
62
|
const chainProviders = providers_[activeChain.id];
|
|
63
63
|
if (!chainProviders || !chainProviders[0])
|
|
64
64
|
throw new Error(`No providers configured for chain "${activeChain.id}"`);
|
|
@@ -83,11 +83,11 @@ function configureChains(defaultChains, providers2, {
|
|
|
83
83
|
});
|
|
84
84
|
},
|
|
85
85
|
webSocketProvider: ({ chainId }) => {
|
|
86
|
-
const activeChain = chains.find((x) => x.id === chainId)
|
|
86
|
+
const activeChain = _nullishCoalesce(chains.find((x) => x.id === chainId), () => ( defaultChains[0]));
|
|
87
87
|
const chainWebSocketProviders = webSocketProviders_[activeChain.id];
|
|
88
88
|
if (!chainWebSocketProviders)
|
|
89
89
|
return void 0;
|
|
90
|
-
const provider = chainWebSocketProviders[0]
|
|
90
|
+
const provider = _optionalChain([chainWebSocketProviders, 'access', _ => _[0], 'optionalCall', _2 => _2()]);
|
|
91
91
|
if (provider && activeChain.id === 42220) {
|
|
92
92
|
provider.formatter.formats.block = {
|
|
93
93
|
...provider.formatter.formats.block,
|
|
@@ -103,22 +103,22 @@ function configureChains(defaultChains, providers2, {
|
|
|
103
103
|
}
|
|
104
104
|
function fallbackProvider(targetQuorum, minQuorum, providers_, { stallTimeout }) {
|
|
105
105
|
try {
|
|
106
|
-
return new providers.FallbackProvider(
|
|
106
|
+
return new _ethers.providers.FallbackProvider(
|
|
107
107
|
providers_.map((chainProvider, index) => {
|
|
108
108
|
const provider = chainProvider();
|
|
109
109
|
return {
|
|
110
110
|
provider,
|
|
111
|
-
priority: provider.priority
|
|
112
|
-
stallTimeout: provider.stallTimeout
|
|
111
|
+
priority: _nullishCoalesce(provider.priority, () => ( index)),
|
|
112
|
+
stallTimeout: _nullishCoalesce(provider.stallTimeout, () => ( stallTimeout)),
|
|
113
113
|
weight: provider.weight
|
|
114
114
|
};
|
|
115
115
|
}),
|
|
116
116
|
targetQuorum
|
|
117
117
|
);
|
|
118
118
|
} catch (error) {
|
|
119
|
-
if (error
|
|
119
|
+
if (_optionalChain([error, 'optionalAccess', _3 => _3.message, 'optionalAccess', _4 => _4.includes, 'call', _5 => _5(
|
|
120
120
|
"quorum will always fail; larger than total weight"
|
|
121
|
-
)) {
|
|
121
|
+
)])) {
|
|
122
122
|
if (targetQuorum === minQuorum)
|
|
123
123
|
throw error;
|
|
124
124
|
return fallbackProvider(targetQuorum - 1, minQuorum, providers_, {
|
|
@@ -130,8 +130,8 @@ function fallbackProvider(targetQuorum, minQuorum, providers_, { stallTimeout })
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// src/client.ts
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
var _middleware = require('zustand/middleware');
|
|
134
|
+
var _vanilla = require('zustand/vanilla');
|
|
135
135
|
|
|
136
136
|
// src/utils/assertActiveChain.ts
|
|
137
137
|
function assertActiveChain({
|
|
@@ -139,20 +139,20 @@ function assertActiveChain({
|
|
|
139
139
|
signer
|
|
140
140
|
}) {
|
|
141
141
|
const { chain: activeChain, chains } = getNetwork();
|
|
142
|
-
const activeChainId = activeChain
|
|
142
|
+
const activeChainId = _optionalChain([activeChain, 'optionalAccess', _6 => _6.id]);
|
|
143
143
|
if (activeChainId && chainId !== activeChainId) {
|
|
144
144
|
throw new ChainMismatchError({
|
|
145
|
-
activeChain: chains.find((x) => x.id === activeChainId)
|
|
146
|
-
targetChain: chains.find((x) => x.id === chainId)
|
|
145
|
+
activeChain: _nullishCoalesce(_optionalChain([chains, 'access', _7 => _7.find, 'call', _8 => _8((x) => x.id === activeChainId), 'optionalAccess', _9 => _9.name]), () => ( `Chain ${activeChainId}`)),
|
|
146
|
+
targetChain: _nullishCoalesce(_optionalChain([chains, 'access', _10 => _10.find, 'call', _11 => _11((x) => x.id === chainId), 'optionalAccess', _12 => _12.name]), () => ( `Chain ${chainId}`))
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
if (signer) {
|
|
150
|
-
const signerChainId = signer.provider
|
|
150
|
+
const signerChainId = _optionalChain([signer, 'access', _13 => _13.provider, 'optionalAccess', _14 => _14.network, 'optionalAccess', _15 => _15.chainId]);
|
|
151
151
|
if (signerChainId && chainId !== signerChainId) {
|
|
152
152
|
const connector = getClient().connector;
|
|
153
153
|
throw new ChainNotConfiguredError({
|
|
154
154
|
chainId,
|
|
155
|
-
connectorId: connector
|
|
155
|
+
connectorId: _nullishCoalesce(_optionalChain([connector, 'optionalAccess', _16 => _16.id]), () => ( "unknown"))
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
}
|
|
@@ -213,7 +213,7 @@ function deepEqual(a, b) {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
// src/utils/deserialize.ts
|
|
216
|
-
|
|
216
|
+
|
|
217
217
|
var findAndReplace = (cacheRef, {
|
|
218
218
|
find,
|
|
219
219
|
replace
|
|
@@ -242,14 +242,14 @@ function deserialize(cachedString) {
|
|
|
242
242
|
const cache = JSON.parse(cachedString);
|
|
243
243
|
const deserializedCacheWithBigNumbers = findAndReplace(cache, {
|
|
244
244
|
find: (data) => data.type === "BigNumber",
|
|
245
|
-
replace: (data) => BigNumber.from(data.hex)
|
|
245
|
+
replace: (data) => _ethers.BigNumber.from(data.hex)
|
|
246
246
|
});
|
|
247
247
|
return deserializedCacheWithBigNumbers;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// src/utils/normalizeFunctionName.ts
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
|
|
252
|
+
var _utilsjs = require('ethers/lib/utils.js');
|
|
253
253
|
function normalizeFunctionName({
|
|
254
254
|
contract,
|
|
255
255
|
functionName,
|
|
@@ -257,8 +257,8 @@ function normalizeFunctionName({
|
|
|
257
257
|
}) {
|
|
258
258
|
if (functionName in contract.functions)
|
|
259
259
|
return functionName;
|
|
260
|
-
const argsLength = args
|
|
261
|
-
const overloadFunctions = Object.keys(contract.functions).filter((x) => x.startsWith(`${functionName}(`)).map((x) => ({ name: x, fragment: FunctionFragment.fromString(x) })).filter((x) => argsLength === x.fragment.inputs.length);
|
|
260
|
+
const argsLength = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _17 => _17.length]), () => ( 0));
|
|
261
|
+
const overloadFunctions = Object.keys(contract.functions).filter((x) => x.startsWith(`${functionName}(`)).map((x) => ({ name: x, fragment: _utilsjs.FunctionFragment.fromString(x) })).filter((x) => argsLength === x.fragment.inputs.length);
|
|
262
262
|
for (const overloadFunction of overloadFunctions) {
|
|
263
263
|
const matched = args.every((arg, index) => {
|
|
264
264
|
const abiParameter = overloadFunction.fragment.inputs[index];
|
|
@@ -274,7 +274,7 @@ function isArgOfType(arg, abiParameter) {
|
|
|
274
274
|
const abiParameterType = abiParameter.type;
|
|
275
275
|
switch (abiParameterType) {
|
|
276
276
|
case "address":
|
|
277
|
-
return isAddress(arg);
|
|
277
|
+
return _utilsjs.isAddress.call(void 0, arg);
|
|
278
278
|
case "bool":
|
|
279
279
|
return argType === "boolean";
|
|
280
280
|
case "function":
|
|
@@ -294,7 +294,7 @@ function isArgOfType(arg, abiParameter) {
|
|
|
294
294
|
if (/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(
|
|
295
295
|
abiParameterType
|
|
296
296
|
))
|
|
297
|
-
return argType === "number" || argType === "bigint" ||
|
|
297
|
+
return argType === "number" || argType === "bigint" || _ethers.BigNumber.isBigNumber(arg);
|
|
298
298
|
if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
|
|
299
299
|
return argType === "string" || arg instanceof Uint8Array;
|
|
300
300
|
if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
|
|
@@ -312,12 +312,12 @@ function isArgOfType(arg, abiParameter) {
|
|
|
312
312
|
|
|
313
313
|
// src/utils/logger.ts
|
|
314
314
|
function logWarn(message) {
|
|
315
|
-
getClient()
|
|
315
|
+
_optionalChain([getClient, 'call', _18 => _18(), 'optionalAccess', _19 => _19.config, 'access', _20 => _20.logger, 'optionalAccess', _21 => _21.warn, 'optionalCall', _22 => _22(message)]);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
// src/utils/minimizeContractInterface.ts
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
|
|
320
|
+
|
|
321
321
|
function minimizeContractInterface(config) {
|
|
322
322
|
try {
|
|
323
323
|
const minimizedAbi = config.abi.filter(
|
|
@@ -327,8 +327,8 @@ function minimizeContractInterface(config) {
|
|
|
327
327
|
throw new Error("Invalid ABI");
|
|
328
328
|
return minimizedAbi;
|
|
329
329
|
} catch (error) {
|
|
330
|
-
const abi = Contract.getInterface(config.abi).format(
|
|
331
|
-
FormatTypes.full
|
|
330
|
+
const abi = _ethers.Contract.getInterface(config.abi).format(
|
|
331
|
+
_utilsjs.FormatTypes.full
|
|
332
332
|
);
|
|
333
333
|
const minimizedInterface = Array.isArray(abi) ? abi : [abi];
|
|
334
334
|
return minimizedInterface.filter((i) => i.includes(config.functionName));
|
|
@@ -348,7 +348,7 @@ function normalizeChainId(chainId) {
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
// src/utils/parseContractResult.ts
|
|
351
|
-
|
|
351
|
+
|
|
352
352
|
function isPlainArray(value) {
|
|
353
353
|
return Array.isArray(value) && Object.keys(value).length === value.length;
|
|
354
354
|
}
|
|
@@ -358,9 +358,9 @@ function parseContractResult({
|
|
|
358
358
|
functionName
|
|
359
359
|
}) {
|
|
360
360
|
if (data && isPlainArray(data)) {
|
|
361
|
-
const iface =
|
|
361
|
+
const iface = _ethers.Contract.getInterface(abi);
|
|
362
362
|
const fragment = iface.getFunction(functionName);
|
|
363
|
-
const isTuple = (fragment.outputs
|
|
363
|
+
const isTuple = (_optionalChain([fragment, 'access', _23 => _23.outputs, 'optionalAccess', _24 => _24.length]) || 0) > 1;
|
|
364
364
|
const data_ = isTuple ? data : [data];
|
|
365
365
|
const encodedResult = iface.encodeFunctionResult(functionName, data_);
|
|
366
366
|
const decodedResult = iface.decodeFunctionResult(
|
|
@@ -422,7 +422,7 @@ function serialize(value, replacer, indent, circularReplacer) {
|
|
|
422
422
|
return JSON.stringify(
|
|
423
423
|
value,
|
|
424
424
|
createReplacer(replacer, circularReplacer),
|
|
425
|
-
indent
|
|
425
|
+
_nullishCoalesce(indent, () => ( void 0))
|
|
426
426
|
);
|
|
427
427
|
}
|
|
428
428
|
|
|
@@ -470,7 +470,7 @@ var _isAutoConnecting, _lastUsedConnector, _addEffects, addEffects_fn;
|
|
|
470
470
|
var Client = class {
|
|
471
471
|
constructor({
|
|
472
472
|
autoConnect = false,
|
|
473
|
-
connectors = [new InjectedConnector()],
|
|
473
|
+
connectors = [new (0, _chunkBVC4KGLQjs.InjectedConnector)()],
|
|
474
474
|
provider,
|
|
475
475
|
storage = createStorage({
|
|
476
476
|
storage: typeof window !== "undefined" ? window.localStorage : noopStorage
|
|
@@ -480,11 +480,11 @@ var Client = class {
|
|
|
480
480
|
},
|
|
481
481
|
webSocketProvider
|
|
482
482
|
}) {
|
|
483
|
-
__privateAdd(this, _addEffects);
|
|
483
|
+
_chunkMQXBDTVKjs.__privateAdd.call(void 0, this, _addEffects);
|
|
484
484
|
this.providers = /* @__PURE__ */ new Map();
|
|
485
485
|
this.webSocketProviders = /* @__PURE__ */ new Map();
|
|
486
|
-
__privateAdd(this, _isAutoConnecting, void 0);
|
|
487
|
-
__privateAdd(this, _lastUsedConnector, void 0);
|
|
486
|
+
_chunkMQXBDTVKjs.__privateAdd.call(void 0, this, _isAutoConnecting, void 0);
|
|
487
|
+
_chunkMQXBDTVKjs.__privateAdd.call(void 0, this, _lastUsedConnector, void 0);
|
|
488
488
|
this.config = {
|
|
489
489
|
autoConnect,
|
|
490
490
|
connectors,
|
|
@@ -498,15 +498,15 @@ var Client = class {
|
|
|
498
498
|
if (autoConnect) {
|
|
499
499
|
try {
|
|
500
500
|
const rawState = storage.getItem(storeKey);
|
|
501
|
-
const data = rawState
|
|
502
|
-
status = data
|
|
503
|
-
chainId = data
|
|
501
|
+
const data = _optionalChain([rawState, 'optionalAccess', _25 => _25.state, 'optionalAccess', _26 => _26.data]);
|
|
502
|
+
status = _optionalChain([data, 'optionalAccess', _27 => _27.account]) ? "reconnecting" : "connecting";
|
|
503
|
+
chainId = _optionalChain([data, 'optionalAccess', _28 => _28.chain, 'optionalAccess', _29 => _29.id]);
|
|
504
504
|
} catch (_error) {
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
this.store = createStore(
|
|
508
|
-
subscribeWithSelector(
|
|
509
|
-
persist(
|
|
507
|
+
this.store = _vanilla.createStore.call(void 0,
|
|
508
|
+
_middleware.subscribeWithSelector.call(void 0,
|
|
509
|
+
_middleware.persist.call(void 0,
|
|
510
510
|
() => ({
|
|
511
511
|
connectors: typeof connectors === "function" ? connectors() : connectors,
|
|
512
512
|
provider: this.getProvider({ chainId }),
|
|
@@ -519,11 +519,11 @@ var Client = class {
|
|
|
519
519
|
partialize: (state) => ({
|
|
520
520
|
...autoConnect && {
|
|
521
521
|
data: {
|
|
522
|
-
account: state
|
|
523
|
-
chain: state
|
|
522
|
+
account: _optionalChain([state, 'optionalAccess', _30 => _30.data, 'optionalAccess', _31 => _31.account]),
|
|
523
|
+
chain: _optionalChain([state, 'optionalAccess', _32 => _32.data, 'optionalAccess', _33 => _33.chain])
|
|
524
524
|
}
|
|
525
525
|
},
|
|
526
|
-
chains: state
|
|
526
|
+
chains: _optionalChain([state, 'optionalAccess', _34 => _34.chains])
|
|
527
527
|
}),
|
|
528
528
|
version: 2
|
|
529
529
|
}
|
|
@@ -531,8 +531,8 @@ var Client = class {
|
|
|
531
531
|
)
|
|
532
532
|
);
|
|
533
533
|
this.storage = storage;
|
|
534
|
-
__privateSet(this, _lastUsedConnector, storage
|
|
535
|
-
__privateMethod(this, _addEffects, addEffects_fn).call(this);
|
|
534
|
+
_chunkMQXBDTVKjs.__privateSet.call(void 0, this, _lastUsedConnector, _optionalChain([storage, 'optionalAccess', _35 => _35.getItem, 'call', _36 => _36("wallet")]));
|
|
535
|
+
_chunkMQXBDTVKjs.__privateMethod.call(void 0, this, _addEffects, addEffects_fn).call(this);
|
|
536
536
|
if (autoConnect && typeof window !== "undefined")
|
|
537
537
|
setTimeout(async () => await this.autoConnect(), 0);
|
|
538
538
|
}
|
|
@@ -552,7 +552,7 @@ var Client = class {
|
|
|
552
552
|
return this.store.getState().error;
|
|
553
553
|
}
|
|
554
554
|
get lastUsedChainId() {
|
|
555
|
-
return this.data
|
|
555
|
+
return _optionalChain([this, 'access', _37 => _37.data, 'optionalAccess', _38 => _38.chain, 'optionalAccess', _39 => _39.id]);
|
|
556
556
|
}
|
|
557
557
|
get provider() {
|
|
558
558
|
return this.store.getState().provider;
|
|
@@ -582,21 +582,21 @@ var Client = class {
|
|
|
582
582
|
}
|
|
583
583
|
async destroy() {
|
|
584
584
|
if (this.connector)
|
|
585
|
-
await this.connector.disconnect
|
|
586
|
-
__privateSet(this, _isAutoConnecting, false);
|
|
585
|
+
await _optionalChain([this, 'access', _40 => _40.connector, 'access', _41 => _41.disconnect, 'optionalCall', _42 => _42()]);
|
|
586
|
+
_chunkMQXBDTVKjs.__privateSet.call(void 0, this, _isAutoConnecting, false);
|
|
587
587
|
this.clearState();
|
|
588
588
|
this.store.destroy();
|
|
589
589
|
}
|
|
590
590
|
async autoConnect() {
|
|
591
|
-
if (__privateGet(this, _isAutoConnecting))
|
|
591
|
+
if (_chunkMQXBDTVKjs.__privateGet.call(void 0, this, _isAutoConnecting))
|
|
592
592
|
return;
|
|
593
|
-
__privateSet(this, _isAutoConnecting, true);
|
|
593
|
+
_chunkMQXBDTVKjs.__privateSet.call(void 0, this, _isAutoConnecting, true);
|
|
594
594
|
this.setState((x) => ({
|
|
595
595
|
...x,
|
|
596
|
-
status: x.data
|
|
596
|
+
status: _optionalChain([x, 'access', _43 => _43.data, 'optionalAccess', _44 => _44.account]) ? "reconnecting" : "connecting"
|
|
597
597
|
}));
|
|
598
|
-
const sorted = __privateGet(this, _lastUsedConnector) ? [...this.connectors].sort(
|
|
599
|
-
(x) => x.id === __privateGet(this, _lastUsedConnector) ? -1 : 1
|
|
598
|
+
const sorted = _chunkMQXBDTVKjs.__privateGet.call(void 0, this, _lastUsedConnector) ? [...this.connectors].sort(
|
|
599
|
+
(x) => x.id === _chunkMQXBDTVKjs.__privateGet.call(void 0, this, _lastUsedConnector) ? -1 : 1
|
|
600
600
|
) : this.connectors;
|
|
601
601
|
let connected = false;
|
|
602
602
|
for (const connector of sorted) {
|
|
@@ -609,7 +609,7 @@ var Client = class {
|
|
|
609
609
|
this.setState((x) => ({
|
|
610
610
|
...x,
|
|
611
611
|
connector,
|
|
612
|
-
chains: connector
|
|
612
|
+
chains: _optionalChain([connector, 'optionalAccess', _45 => _45.chains]),
|
|
613
613
|
data,
|
|
614
614
|
status: "connected"
|
|
615
615
|
}));
|
|
@@ -622,33 +622,33 @@ var Client = class {
|
|
|
622
622
|
data: void 0,
|
|
623
623
|
status: "disconnected"
|
|
624
624
|
}));
|
|
625
|
-
__privateSet(this, _isAutoConnecting, false);
|
|
625
|
+
_chunkMQXBDTVKjs.__privateSet.call(void 0, this, _isAutoConnecting, false);
|
|
626
626
|
return this.data;
|
|
627
627
|
}
|
|
628
628
|
getProvider({ bust, chainId } = {}) {
|
|
629
|
-
let provider_ = this.providers.get(chainId
|
|
629
|
+
let provider_ = this.providers.get(_nullishCoalesce(chainId, () => ( -1)));
|
|
630
630
|
if (provider_ && !bust)
|
|
631
631
|
return provider_;
|
|
632
632
|
const { provider } = this.config;
|
|
633
633
|
provider_ = typeof provider === "function" ? provider({ chainId }) : provider;
|
|
634
|
-
this.providers.set(chainId
|
|
634
|
+
this.providers.set(_nullishCoalesce(chainId, () => ( -1)), provider_);
|
|
635
635
|
return provider_;
|
|
636
636
|
}
|
|
637
637
|
getWebSocketProvider({
|
|
638
638
|
bust,
|
|
639
639
|
chainId
|
|
640
640
|
} = {}) {
|
|
641
|
-
let webSocketProvider_ = this.webSocketProviders.get(chainId
|
|
641
|
+
let webSocketProvider_ = this.webSocketProviders.get(_nullishCoalesce(chainId, () => ( -1)));
|
|
642
642
|
if (webSocketProvider_ && !bust)
|
|
643
643
|
return webSocketProvider_;
|
|
644
644
|
const { webSocketProvider } = this.config;
|
|
645
645
|
webSocketProvider_ = typeof webSocketProvider === "function" ? webSocketProvider({ chainId }) : webSocketProvider;
|
|
646
646
|
if (webSocketProvider_)
|
|
647
|
-
this.webSocketProviders.set(chainId
|
|
647
|
+
this.webSocketProviders.set(_nullishCoalesce(chainId, () => ( -1)), webSocketProvider_);
|
|
648
648
|
return webSocketProvider_;
|
|
649
649
|
}
|
|
650
650
|
setLastUsedConnector(lastUsedConnector = null) {
|
|
651
|
-
this.storage
|
|
651
|
+
_optionalChain([this, 'access', _46 => _46.storage, 'optionalAccess', _47 => _47.setItem, 'call', _48 => _48("wallet", lastUsedConnector)]);
|
|
652
652
|
}
|
|
653
653
|
};
|
|
654
654
|
_isAutoConnecting = new WeakMap();
|
|
@@ -670,14 +670,14 @@ addEffects_fn = function() {
|
|
|
670
670
|
this.store.subscribe(
|
|
671
671
|
({ connector }) => connector,
|
|
672
672
|
(connector, prevConnector) => {
|
|
673
|
-
prevConnector
|
|
674
|
-
prevConnector
|
|
675
|
-
prevConnector
|
|
673
|
+
_optionalChain([prevConnector, 'optionalAccess', _49 => _49.off, 'optionalCall', _50 => _50("change", onChange)]);
|
|
674
|
+
_optionalChain([prevConnector, 'optionalAccess', _51 => _51.off, 'optionalCall', _52 => _52("disconnect", onDisconnect)]);
|
|
675
|
+
_optionalChain([prevConnector, 'optionalAccess', _53 => _53.off, 'optionalCall', _54 => _54("error", onError)]);
|
|
676
676
|
if (!connector)
|
|
677
677
|
return;
|
|
678
|
-
connector.on
|
|
679
|
-
connector.on
|
|
680
|
-
connector.on
|
|
678
|
+
_optionalChain([connector, 'access', _55 => _55.on, 'optionalCall', _56 => _56("change", onChange)]);
|
|
679
|
+
_optionalChain([connector, 'access', _57 => _57.on, 'optionalCall', _58 => _58("disconnect", onDisconnect)]);
|
|
680
|
+
_optionalChain([connector, 'access', _59 => _59.on, 'optionalCall', _60 => _60("error", onError)]);
|
|
681
681
|
}
|
|
682
682
|
);
|
|
683
683
|
const { provider, webSocketProvider } = this.config;
|
|
@@ -685,7 +685,7 @@ addEffects_fn = function() {
|
|
|
685
685
|
const subscribeWebSocketProvider = typeof webSocketProvider === "function";
|
|
686
686
|
if (subscribeProvider || subscribeWebSocketProvider)
|
|
687
687
|
this.store.subscribe(
|
|
688
|
-
({ data }) => data
|
|
688
|
+
({ data }) => _optionalChain([data, 'optionalAccess', _61 => _61.chain, 'optionalAccess', _62 => _62.id]),
|
|
689
689
|
(chainId) => {
|
|
690
690
|
this.setState((x) => ({
|
|
691
691
|
...x,
|
|
@@ -729,7 +729,7 @@ async function connect({
|
|
|
729
729
|
client2.setState((x) => ({
|
|
730
730
|
...x,
|
|
731
731
|
connector,
|
|
732
|
-
chains: connector
|
|
732
|
+
chains: _optionalChain([connector, 'optionalAccess', _63 => _63.chains]),
|
|
733
733
|
data,
|
|
734
734
|
status: "connected"
|
|
735
735
|
}));
|
|
@@ -756,7 +756,7 @@ async function disconnect() {
|
|
|
756
756
|
}
|
|
757
757
|
|
|
758
758
|
// src/actions/accounts/fetchBalance.ts
|
|
759
|
-
|
|
759
|
+
|
|
760
760
|
|
|
761
761
|
// src/constants/abis.ts
|
|
762
762
|
var erc20ABI = [
|
|
@@ -2041,7 +2041,7 @@ var units = [
|
|
|
2041
2041
|
];
|
|
2042
2042
|
|
|
2043
2043
|
// src/actions/contracts/fetchToken.ts
|
|
2044
|
-
|
|
2044
|
+
|
|
2045
2045
|
async function fetchToken({
|
|
2046
2046
|
address,
|
|
2047
2047
|
chainId,
|
|
@@ -2064,7 +2064,7 @@ async function fetchToken({
|
|
|
2064
2064
|
name,
|
|
2065
2065
|
symbol,
|
|
2066
2066
|
totalSupply: {
|
|
2067
|
-
formatted: formatUnits(totalSupply, units2),
|
|
2067
|
+
formatted: _utilsjs.formatUnits.call(void 0, totalSupply, units2),
|
|
2068
2068
|
value: totalSupply
|
|
2069
2069
|
}
|
|
2070
2070
|
};
|
|
@@ -2077,8 +2077,8 @@ async function fetchToken({
|
|
|
2077
2077
|
abi: erc20ABI_bytes32
|
|
2078
2078
|
});
|
|
2079
2079
|
return {
|
|
2080
|
-
name: parseBytes32String(name),
|
|
2081
|
-
symbol: parseBytes32String(symbol),
|
|
2080
|
+
name: _utilsjs.parseBytes32String.call(void 0, name),
|
|
2081
|
+
symbol: _utilsjs.parseBytes32String.call(void 0, symbol),
|
|
2082
2082
|
...rest
|
|
2083
2083
|
};
|
|
2084
2084
|
}
|
|
@@ -2087,13 +2087,13 @@ async function fetchToken({
|
|
|
2087
2087
|
}
|
|
2088
2088
|
|
|
2089
2089
|
// src/actions/contracts/getContract.ts
|
|
2090
|
-
|
|
2090
|
+
|
|
2091
2091
|
function getContract({
|
|
2092
2092
|
address,
|
|
2093
2093
|
abi,
|
|
2094
2094
|
signerOrProvider
|
|
2095
2095
|
}) {
|
|
2096
|
-
return new
|
|
2096
|
+
return new (0, _ethers.Contract)(
|
|
2097
2097
|
address,
|
|
2098
2098
|
abi,
|
|
2099
2099
|
signerOrProvider
|
|
@@ -2110,7 +2110,7 @@ async function prepareWriteContract({
|
|
|
2110
2110
|
signer: signer_,
|
|
2111
2111
|
...config
|
|
2112
2112
|
}) {
|
|
2113
|
-
const signer = signer_
|
|
2113
|
+
const signer = await _asyncNullishCoalesce(signer_, async () => ( await fetchSigner({ chainId })));
|
|
2114
2114
|
if (!signer)
|
|
2115
2115
|
throw new ConnectorNotFoundError();
|
|
2116
2116
|
if (chainId)
|
|
@@ -2132,7 +2132,7 @@ async function prepareWriteContract({
|
|
|
2132
2132
|
address,
|
|
2133
2133
|
functionName: normalizedFunctionName
|
|
2134
2134
|
});
|
|
2135
|
-
const params = [...args
|
|
2135
|
+
const params = [..._nullishCoalesce(args, () => ( [])), ...overrides ? [overrides] : []];
|
|
2136
2136
|
const unsignedTransaction = await populateTransactionFn(
|
|
2137
2137
|
...params
|
|
2138
2138
|
);
|
|
@@ -2201,7 +2201,7 @@ async function multicall({
|
|
|
2201
2201
|
overrides
|
|
2202
2202
|
}) {
|
|
2203
2203
|
const provider = getProvider({ chainId: chainIdOverride });
|
|
2204
|
-
if (!provider.chains
|
|
2204
|
+
if (!_optionalChain([provider, 'access', _64 => _64.chains, 'optionalAccess', _65 => _65[0]]))
|
|
2205
2205
|
throw new ProviderChainsNotFound();
|
|
2206
2206
|
const chainId = provider.network.chainId;
|
|
2207
2207
|
if (typeof chainIdOverride !== "undefined" && chainIdOverride !== chainId)
|
|
@@ -2209,11 +2209,11 @@ async function multicall({
|
|
|
2209
2209
|
const chain = provider.chains.find((chain2) => chain2.id === chainId);
|
|
2210
2210
|
if (!chain)
|
|
2211
2211
|
throw new ChainNotConfiguredError({ chainId });
|
|
2212
|
-
if (!chain
|
|
2212
|
+
if (!_optionalChain([chain, 'optionalAccess', _66 => _66.contracts, 'optionalAccess', _67 => _67.multicall3]))
|
|
2213
2213
|
throw new ChainDoesNotSupportMulticallError({ chain });
|
|
2214
|
-
if (typeof overrides
|
|
2214
|
+
if (typeof _optionalChain([overrides, 'optionalAccess', _68 => _68.blockTag]) === "number" && _optionalChain([overrides, 'optionalAccess', _69 => _69.blockTag]) < (_nullishCoalesce(chain.contracts.multicall3.blockCreated, () => ( 0))))
|
|
2215
2215
|
throw new ChainDoesNotSupportMulticallError({
|
|
2216
|
-
blockNumber: overrides
|
|
2216
|
+
blockNumber: _optionalChain([overrides, 'optionalAccess', _70 => _70.blockTag]),
|
|
2217
2217
|
chain
|
|
2218
2218
|
});
|
|
2219
2219
|
const multicallContract = getContract({
|
|
@@ -2225,7 +2225,7 @@ async function multicall({
|
|
|
2225
2225
|
({ address, abi, functionName, ...config }) => {
|
|
2226
2226
|
const { args } = config || {};
|
|
2227
2227
|
const contract = getContract({ address, abi });
|
|
2228
|
-
const params2 = args
|
|
2228
|
+
const params2 = _nullishCoalesce(args, () => ( []));
|
|
2229
2229
|
const normalizedFunctionName = normalizeFunctionName({
|
|
2230
2230
|
contract,
|
|
2231
2231
|
functionName,
|
|
@@ -2355,8 +2355,8 @@ async function readContract({
|
|
|
2355
2355
|
address,
|
|
2356
2356
|
functionName: normalizedFunctionName
|
|
2357
2357
|
});
|
|
2358
|
-
const params = [...args
|
|
2359
|
-
return contractFunction
|
|
2358
|
+
const params = [..._nullishCoalesce(args, () => ( [])), ...overrides ? [overrides] : []];
|
|
2359
|
+
return _optionalChain([contractFunction, 'optionalCall', _71 => _71(...params)]);
|
|
2360
2360
|
}
|
|
2361
2361
|
|
|
2362
2362
|
// src/actions/contracts/readContracts.ts
|
|
@@ -2368,7 +2368,7 @@ async function readContracts({
|
|
|
2368
2368
|
try {
|
|
2369
2369
|
const provider = getProvider();
|
|
2370
2370
|
const contractsByChainId = contracts.reduce((contracts2, contract, index) => {
|
|
2371
|
-
const chainId = contract.chainId
|
|
2371
|
+
const chainId = _nullishCoalesce(contract.chainId, () => ( provider.network.chainId));
|
|
2372
2372
|
return {
|
|
2373
2373
|
...contracts2,
|
|
2374
2374
|
[chainId]: [...contracts2[chainId] || [], { contract, index }]
|
|
@@ -2420,7 +2420,7 @@ async function readContracts({
|
|
|
2420
2420
|
const error = new ContractMethodRevertedError({
|
|
2421
2421
|
address,
|
|
2422
2422
|
functionName,
|
|
2423
|
-
chainId: chainId
|
|
2423
|
+
chainId: _nullishCoalesce(chainId, () => ( 1)),
|
|
2424
2424
|
args,
|
|
2425
2425
|
errorMessage: result.reason
|
|
2426
2426
|
});
|
|
@@ -2432,7 +2432,7 @@ async function readContracts({
|
|
|
2432
2432
|
}
|
|
2433
2433
|
|
|
2434
2434
|
// src/actions/contracts/watchContractEvent.ts
|
|
2435
|
-
|
|
2435
|
+
var _shallow = require('zustand/shallow');
|
|
2436
2436
|
function watchContractEvent({
|
|
2437
2437
|
address,
|
|
2438
2438
|
abi,
|
|
@@ -2444,7 +2444,7 @@ function watchContractEvent({
|
|
|
2444
2444
|
let contract;
|
|
2445
2445
|
const watchEvent = async () => {
|
|
2446
2446
|
if (contract)
|
|
2447
|
-
contract
|
|
2447
|
+
_optionalChain([contract, 'optionalAccess', _72 => _72.off, 'call', _73 => _73(eventName, handler)]);
|
|
2448
2448
|
const signerOrProvider = getWebSocketProvider({ chainId }) || getProvider({ chainId });
|
|
2449
2449
|
contract = getContract({
|
|
2450
2450
|
address,
|
|
@@ -2464,16 +2464,16 @@ function watchContractEvent({
|
|
|
2464
2464
|
webSocketProvider
|
|
2465
2465
|
}),
|
|
2466
2466
|
watchEvent,
|
|
2467
|
-
{ equalityFn: shallow }
|
|
2467
|
+
{ equalityFn: _shallow.shallow }
|
|
2468
2468
|
);
|
|
2469
2469
|
return () => {
|
|
2470
|
-
contract
|
|
2470
|
+
_optionalChain([contract, 'optionalAccess', _74 => _74.off, 'call', _75 => _75(eventName, handler)]);
|
|
2471
2471
|
unsubscribe();
|
|
2472
2472
|
};
|
|
2473
2473
|
}
|
|
2474
2474
|
|
|
2475
2475
|
// src/actions/network-status/watchBlockNumber.ts
|
|
2476
|
-
|
|
2476
|
+
|
|
2477
2477
|
|
|
2478
2478
|
// src/actions/network-status/fetchBlockNumber.ts
|
|
2479
2479
|
async function fetchBlockNumber({
|
|
@@ -2490,12 +2490,12 @@ function watchBlockNumber(args, callback) {
|
|
|
2490
2490
|
let previousProvider;
|
|
2491
2491
|
const createListener = (provider) => {
|
|
2492
2492
|
if (previousProvider) {
|
|
2493
|
-
previousProvider
|
|
2493
|
+
_optionalChain([previousProvider, 'optionalAccess', _76 => _76.off, 'call', _77 => _77("block", debouncedCallback)]);
|
|
2494
2494
|
}
|
|
2495
2495
|
provider.on("block", debouncedCallback);
|
|
2496
2496
|
previousProvider = provider;
|
|
2497
2497
|
};
|
|
2498
|
-
const provider_ = getWebSocketProvider({ chainId: args.chainId })
|
|
2498
|
+
const provider_ = _nullishCoalesce(getWebSocketProvider({ chainId: args.chainId }), () => ( getProvider({ chainId: args.chainId })));
|
|
2499
2499
|
if (args.listen)
|
|
2500
2500
|
createListener(provider_);
|
|
2501
2501
|
let active = true;
|
|
@@ -2503,7 +2503,7 @@ function watchBlockNumber(args, callback) {
|
|
|
2503
2503
|
const unsubscribe = client2.subscribe(
|
|
2504
2504
|
({ provider, webSocketProvider }) => ({ provider, webSocketProvider }),
|
|
2505
2505
|
async ({ provider, webSocketProvider }) => {
|
|
2506
|
-
const provider_2 = webSocketProvider
|
|
2506
|
+
const provider_2 = _nullishCoalesce(webSocketProvider, () => ( provider));
|
|
2507
2507
|
if (args.listen && !args.chainId && provider_2) {
|
|
2508
2508
|
createListener(provider_2);
|
|
2509
2509
|
}
|
|
@@ -2513,14 +2513,14 @@ function watchBlockNumber(args, callback) {
|
|
|
2513
2513
|
callback(blockNumber);
|
|
2514
2514
|
},
|
|
2515
2515
|
{
|
|
2516
|
-
equalityFn:
|
|
2516
|
+
equalityFn: _shallow.shallow
|
|
2517
2517
|
}
|
|
2518
2518
|
);
|
|
2519
2519
|
return () => {
|
|
2520
2520
|
active = false;
|
|
2521
2521
|
unsubscribe();
|
|
2522
|
-
provider_
|
|
2523
|
-
previousProvider
|
|
2522
|
+
_optionalChain([provider_, 'optionalAccess', _78 => _78.off, 'call', _79 => _79("block", debouncedCallback)]);
|
|
2523
|
+
_optionalChain([previousProvider, 'optionalAccess', _80 => _80.off, 'call', _81 => _81("block", debouncedCallback)]);
|
|
2524
2524
|
};
|
|
2525
2525
|
}
|
|
2526
2526
|
|
|
@@ -2532,7 +2532,7 @@ function watchMulticall(config, callback) {
|
|
|
2532
2532
|
const unsubscribe = client2.subscribe(({ provider }) => provider, handleChange);
|
|
2533
2533
|
return () => {
|
|
2534
2534
|
unsubscribe();
|
|
2535
|
-
unwatch
|
|
2535
|
+
_optionalChain([unwatch, 'optionalCall', _82 => _82()]);
|
|
2536
2536
|
};
|
|
2537
2537
|
}
|
|
2538
2538
|
|
|
@@ -2544,7 +2544,7 @@ function watchReadContract(config, callback) {
|
|
|
2544
2544
|
const unsubscribe = client2.subscribe(({ provider }) => provider, handleChange);
|
|
2545
2545
|
return () => {
|
|
2546
2546
|
unsubscribe();
|
|
2547
|
-
unwatch
|
|
2547
|
+
_optionalChain([unwatch, 'optionalCall', _83 => _83()]);
|
|
2548
2548
|
};
|
|
2549
2549
|
}
|
|
2550
2550
|
|
|
@@ -2556,7 +2556,7 @@ function watchReadContracts(config, callback) {
|
|
|
2556
2556
|
const unsubscribe = client2.subscribe(({ provider }) => provider, handleChange);
|
|
2557
2557
|
return () => {
|
|
2558
2558
|
unsubscribe();
|
|
2559
|
-
unwatch
|
|
2559
|
+
_optionalChain([unwatch, 'optionalCall', _84 => _84()]);
|
|
2560
2560
|
};
|
|
2561
2561
|
}
|
|
2562
2562
|
|
|
@@ -2570,10 +2570,10 @@ async function fetchTransaction({
|
|
|
2570
2570
|
}
|
|
2571
2571
|
|
|
2572
2572
|
// src/actions/transactions/prepareSendTransaction.ts
|
|
2573
|
-
|
|
2573
|
+
|
|
2574
2574
|
|
|
2575
2575
|
// src/actions/ens/fetchEnsAddress.ts
|
|
2576
|
-
|
|
2576
|
+
|
|
2577
2577
|
async function fetchEnsAddress({
|
|
2578
2578
|
chainId,
|
|
2579
2579
|
name
|
|
@@ -2581,7 +2581,7 @@ async function fetchEnsAddress({
|
|
|
2581
2581
|
const provider = getProvider({ chainId });
|
|
2582
2582
|
const address = await provider.resolveName(name);
|
|
2583
2583
|
try {
|
|
2584
|
-
return address ? getAddress(address) : null;
|
|
2584
|
+
return address ? _utilsjs.getAddress.call(void 0, address) : null;
|
|
2585
2585
|
} catch (_error) {
|
|
2586
2586
|
return null;
|
|
2587
2587
|
}
|
|
@@ -2598,13 +2598,13 @@ async function fetchEnsAvatar({
|
|
|
2598
2598
|
}
|
|
2599
2599
|
|
|
2600
2600
|
// src/actions/ens/fetchEnsName.ts
|
|
2601
|
-
|
|
2601
|
+
|
|
2602
2602
|
async function fetchEnsName({
|
|
2603
2603
|
address,
|
|
2604
2604
|
chainId
|
|
2605
2605
|
}) {
|
|
2606
2606
|
const provider = getProvider({ chainId });
|
|
2607
|
-
return provider.lookupAddress(
|
|
2607
|
+
return provider.lookupAddress(_utilsjs.getAddress.call(void 0, address));
|
|
2608
2608
|
}
|
|
2609
2609
|
|
|
2610
2610
|
// src/actions/ens/fetchEnsResolver.ts
|
|
@@ -2623,13 +2623,13 @@ async function prepareSendTransaction({
|
|
|
2623
2623
|
request,
|
|
2624
2624
|
signer: signer_
|
|
2625
2625
|
}) {
|
|
2626
|
-
const signer = signer_
|
|
2626
|
+
const signer = await _asyncNullishCoalesce(signer_, async () => ( await fetchSigner({ chainId })));
|
|
2627
2627
|
if (!signer)
|
|
2628
2628
|
throw new ConnectorNotFoundError();
|
|
2629
2629
|
if (chainId)
|
|
2630
2630
|
assertActiveChain({ chainId, signer });
|
|
2631
2631
|
const [to, gasLimit] = await Promise.all([
|
|
2632
|
-
|
|
2632
|
+
_utilsjs.isAddress.call(void 0, request.to) ? Promise.resolve(request.to) : fetchEnsAddress({ name: request.to }),
|
|
2633
2633
|
request.gasLimit ? Promise.resolve(request.gasLimit) : signer.estimateGas(request)
|
|
2634
2634
|
]);
|
|
2635
2635
|
if (!to)
|
|
@@ -2659,8 +2659,8 @@ async function sendTransaction({
|
|
|
2659
2659
|
if (chainId)
|
|
2660
2660
|
assertActiveChain({ chainId, signer });
|
|
2661
2661
|
try {
|
|
2662
|
-
const uncheckedSigner = signer.connectUnchecked
|
|
2663
|
-
const { hash, wait } = await (uncheckedSigner
|
|
2662
|
+
const uncheckedSigner = _optionalChain([signer, 'access', _85 => _85.connectUnchecked, 'optionalCall', _86 => _86()]);
|
|
2663
|
+
const { hash, wait } = await (_nullishCoalesce(uncheckedSigner, () => ( signer))).sendTransaction(
|
|
2664
2664
|
request
|
|
2665
2665
|
);
|
|
2666
2666
|
return { hash, wait };
|
|
@@ -2672,10 +2672,10 @@ async function sendTransaction({
|
|
|
2672
2672
|
}
|
|
2673
2673
|
|
|
2674
2674
|
// src/actions/transactions/waitForTransaction.ts
|
|
2675
|
-
|
|
2675
|
+
|
|
2676
2676
|
|
|
2677
2677
|
// src/actions/network-status/fetchFeeData.ts
|
|
2678
|
-
|
|
2678
|
+
|
|
2679
2679
|
async function fetchFeeData({
|
|
2680
2680
|
chainId,
|
|
2681
2681
|
formatUnits: units2 = "wei"
|
|
@@ -2683,9 +2683,9 @@ async function fetchFeeData({
|
|
|
2683
2683
|
const provider = getProvider({ chainId });
|
|
2684
2684
|
const feeData = await provider.getFeeData();
|
|
2685
2685
|
const formatted = {
|
|
2686
|
-
gasPrice: feeData.gasPrice ?
|
|
2687
|
-
maxFeePerGas: feeData.maxFeePerGas ?
|
|
2688
|
-
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas ?
|
|
2686
|
+
gasPrice: feeData.gasPrice ? _utilsjs.formatUnits.call(void 0, feeData.gasPrice, units2) : null,
|
|
2687
|
+
maxFeePerGas: feeData.maxFeePerGas ? _utilsjs.formatUnits.call(void 0, feeData.maxFeePerGas, units2) : null,
|
|
2688
|
+
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas ? _utilsjs.formatUnits.call(void 0, feeData.maxPriorityFeePerGas, units2) : null
|
|
2689
2689
|
};
|
|
2690
2690
|
return { ...feeData, formatted };
|
|
2691
2691
|
}
|
|
@@ -2704,7 +2704,7 @@ async function waitForTransaction({
|
|
|
2704
2704
|
fetchTransaction({ hash })
|
|
2705
2705
|
]);
|
|
2706
2706
|
let replaceable = null;
|
|
2707
|
-
if (confirmations !== 0 && transaction
|
|
2707
|
+
if (confirmations !== 0 && _optionalChain([transaction, 'optionalAccess', _87 => _87.to])) {
|
|
2708
2708
|
replaceable = {
|
|
2709
2709
|
data: transaction.data,
|
|
2710
2710
|
from: transaction.from,
|
|
@@ -2723,15 +2723,15 @@ async function waitForTransaction({
|
|
|
2723
2723
|
);
|
|
2724
2724
|
if (receipt.status === 0) {
|
|
2725
2725
|
const code = await provider.call(receipt, receipt.blockNumber);
|
|
2726
|
-
const reason = toUtf8String(`0x${code.substring(138)}`);
|
|
2726
|
+
const reason = _utilsjs.toUtf8String.call(void 0, `0x${code.substring(138)}`);
|
|
2727
2727
|
throw new Error(reason);
|
|
2728
2728
|
}
|
|
2729
2729
|
return receipt;
|
|
2730
2730
|
} catch (err) {
|
|
2731
|
-
if (err
|
|
2732
|
-
onSpeedUp
|
|
2731
|
+
if (_optionalChain([err, 'optionalAccess', _88 => _88.reason]) === "repriced") {
|
|
2732
|
+
_optionalChain([onSpeedUp, 'optionalCall', _89 => _89(err.replacement)]);
|
|
2733
2733
|
return waitForTransaction({
|
|
2734
|
-
hash: err.replacement
|
|
2734
|
+
hash: _optionalChain([err, 'access', _90 => _90.replacement, 'optionalAccess', _91 => _91.hash]),
|
|
2735
2735
|
confirmations,
|
|
2736
2736
|
timeout
|
|
2737
2737
|
});
|
|
@@ -2741,35 +2741,35 @@ async function waitForTransaction({
|
|
|
2741
2741
|
}
|
|
2742
2742
|
|
|
2743
2743
|
// src/actions/transactions/watchPendingTransactions.ts
|
|
2744
|
-
|
|
2744
|
+
|
|
2745
2745
|
function watchPendingTransactions(args, callback) {
|
|
2746
2746
|
let previousProvider;
|
|
2747
2747
|
const createListener = (provider) => {
|
|
2748
2748
|
if (previousProvider) {
|
|
2749
|
-
previousProvider
|
|
2749
|
+
_optionalChain([previousProvider, 'optionalAccess', _92 => _92.off, 'call', _93 => _93("pending", callback)]);
|
|
2750
2750
|
}
|
|
2751
2751
|
provider.on("pending", callback);
|
|
2752
2752
|
previousProvider = provider;
|
|
2753
2753
|
};
|
|
2754
|
-
const provider_ = getWebSocketProvider({ chainId: args.chainId })
|
|
2754
|
+
const provider_ = _nullishCoalesce(getWebSocketProvider({ chainId: args.chainId }), () => ( getProvider({ chainId: args.chainId })));
|
|
2755
2755
|
createListener(provider_);
|
|
2756
2756
|
const client2 = getClient();
|
|
2757
2757
|
const unsubscribe = client2.subscribe(
|
|
2758
2758
|
({ provider, webSocketProvider }) => ({ provider, webSocketProvider }),
|
|
2759
2759
|
async ({ provider, webSocketProvider }) => {
|
|
2760
|
-
const provider_2 = webSocketProvider
|
|
2760
|
+
const provider_2 = _nullishCoalesce(webSocketProvider, () => ( provider));
|
|
2761
2761
|
if (!args.chainId && provider_2) {
|
|
2762
2762
|
createListener(provider_2);
|
|
2763
2763
|
}
|
|
2764
2764
|
},
|
|
2765
2765
|
{
|
|
2766
|
-
equalityFn:
|
|
2766
|
+
equalityFn: _shallow.shallow
|
|
2767
2767
|
}
|
|
2768
2768
|
);
|
|
2769
2769
|
return () => {
|
|
2770
2770
|
unsubscribe();
|
|
2771
|
-
provider_
|
|
2772
|
-
previousProvider
|
|
2771
|
+
_optionalChain([provider_, 'optionalAccess', _94 => _94.off, 'call', _95 => _95("pending", callback)]);
|
|
2772
|
+
_optionalChain([previousProvider, 'optionalAccess', _96 => _96.off, 'call', _97 => _97("pending", callback)]);
|
|
2773
2773
|
};
|
|
2774
2774
|
}
|
|
2775
2775
|
|
|
@@ -2826,7 +2826,7 @@ async function fetchBalance({
|
|
|
2826
2826
|
});
|
|
2827
2827
|
return {
|
|
2828
2828
|
decimals,
|
|
2829
|
-
formatted:
|
|
2829
|
+
formatted: _utilsjs.formatUnits.call(void 0, _nullishCoalesce(value2, () => ( "0")), _nullishCoalesce(unit, () => ( decimals))),
|
|
2830
2830
|
symbol,
|
|
2831
2831
|
value: value2
|
|
2832
2832
|
};
|
|
@@ -2839,20 +2839,20 @@ async function fetchBalance({
|
|
|
2839
2839
|
abi: erc20ABI_bytes32
|
|
2840
2840
|
});
|
|
2841
2841
|
return {
|
|
2842
|
-
symbol:
|
|
2842
|
+
symbol: _utilsjs.parseBytes32String.call(void 0, symbol),
|
|
2843
2843
|
...rest
|
|
2844
2844
|
};
|
|
2845
2845
|
}
|
|
2846
2846
|
throw err;
|
|
2847
2847
|
}
|
|
2848
2848
|
}
|
|
2849
|
-
const chains = [...client2.provider.chains || [], ...client2.chains
|
|
2849
|
+
const chains = [...client2.provider.chains || [], ..._nullishCoalesce(client2.chains, () => ( []))];
|
|
2850
2850
|
const value = await provider.getBalance(address);
|
|
2851
2851
|
const chain = chains.find((x) => x.id === provider.network.chainId);
|
|
2852
2852
|
return {
|
|
2853
|
-
decimals: chain
|
|
2854
|
-
formatted:
|
|
2855
|
-
symbol: chain
|
|
2853
|
+
decimals: _nullishCoalesce(_optionalChain([chain, 'optionalAccess', _98 => _98.nativeCurrency, 'access', _99 => _99.decimals]), () => ( 18)),
|
|
2854
|
+
formatted: _utilsjs.formatUnits.call(void 0, _nullishCoalesce(value, () => ( "0")), _nullishCoalesce(unit, () => ( "ether"))),
|
|
2855
|
+
symbol: _nullishCoalesce(_optionalChain([chain, 'optionalAccess', _100 => _100.nativeCurrency, 'access', _101 => _101.symbol]), () => ( "ETH")),
|
|
2856
2856
|
value
|
|
2857
2857
|
};
|
|
2858
2858
|
}
|
|
@@ -2862,7 +2862,7 @@ async function fetchSigner({
|
|
|
2862
2862
|
chainId
|
|
2863
2863
|
} = {}) {
|
|
2864
2864
|
const client2 = getClient();
|
|
2865
|
-
const signer = await client2.connector
|
|
2865
|
+
const signer = await _optionalChain([client2, 'access', _102 => _102.connector, 'optionalAccess', _103 => _103.getSigner, 'optionalCall', _104 => _104({ chainId })]) || null;
|
|
2866
2866
|
return signer;
|
|
2867
2867
|
}
|
|
2868
2868
|
|
|
@@ -2872,7 +2872,7 @@ function getAccount() {
|
|
|
2872
2872
|
switch (status) {
|
|
2873
2873
|
case "connected":
|
|
2874
2874
|
return {
|
|
2875
|
-
address: data
|
|
2875
|
+
address: _optionalChain([data, 'optionalAccess', _105 => _105.account]),
|
|
2876
2876
|
connector,
|
|
2877
2877
|
isConnected: true,
|
|
2878
2878
|
isConnecting: false,
|
|
@@ -2882,9 +2882,9 @@ function getAccount() {
|
|
|
2882
2882
|
};
|
|
2883
2883
|
case "reconnecting":
|
|
2884
2884
|
return {
|
|
2885
|
-
address: data
|
|
2885
|
+
address: _optionalChain([data, 'optionalAccess', _106 => _106.account]),
|
|
2886
2886
|
connector,
|
|
2887
|
-
isConnected: !!data
|
|
2887
|
+
isConnected: !!_optionalChain([data, 'optionalAccess', _107 => _107.account]),
|
|
2888
2888
|
isConnecting: false,
|
|
2889
2889
|
isDisconnected: false,
|
|
2890
2890
|
isReconnecting: true,
|
|
@@ -2892,7 +2892,7 @@ function getAccount() {
|
|
|
2892
2892
|
};
|
|
2893
2893
|
case "connecting":
|
|
2894
2894
|
return {
|
|
2895
|
-
address: data
|
|
2895
|
+
address: _optionalChain([data, 'optionalAccess', _108 => _108.account]),
|
|
2896
2896
|
connector,
|
|
2897
2897
|
isConnected: false,
|
|
2898
2898
|
isConnecting: true,
|
|
@@ -2916,11 +2916,11 @@ function getAccount() {
|
|
|
2916
2916
|
// src/actions/accounts/getNetwork.ts
|
|
2917
2917
|
function getNetwork() {
|
|
2918
2918
|
const client2 = getClient();
|
|
2919
|
-
const chainId = client2.data
|
|
2920
|
-
const activeChains = client2.chains
|
|
2921
|
-
const activeChain = [...client2.provider.chains || [], ...activeChains].find(
|
|
2919
|
+
const chainId = _optionalChain([client2, 'access', _109 => _109.data, 'optionalAccess', _110 => _110.chain, 'optionalAccess', _111 => _111.id]);
|
|
2920
|
+
const activeChains = _nullishCoalesce(client2.chains, () => ( []));
|
|
2921
|
+
const activeChain = _nullishCoalesce([...client2.provider.chains || [], ...activeChains].find(
|
|
2922
2922
|
(x) => x.id === chainId
|
|
2923
|
-
)
|
|
2923
|
+
), () => ( {
|
|
2924
2924
|
id: chainId,
|
|
2925
2925
|
name: `Chain ${chainId}`,
|
|
2926
2926
|
network: `${chainId}`,
|
|
@@ -2929,11 +2929,11 @@ function getNetwork() {
|
|
|
2929
2929
|
default: { http: [""] },
|
|
2930
2930
|
public: { http: [""] }
|
|
2931
2931
|
}
|
|
2932
|
-
};
|
|
2932
|
+
}));
|
|
2933
2933
|
return {
|
|
2934
2934
|
chain: chainId ? {
|
|
2935
2935
|
...activeChain,
|
|
2936
|
-
...client2.data
|
|
2936
|
+
..._optionalChain([client2, 'access', _112 => _112.data, 'optionalAccess', _113 => _113.chain]),
|
|
2937
2937
|
id: chainId
|
|
2938
2938
|
} : void 0,
|
|
2939
2939
|
chains: activeChains
|
|
@@ -2997,41 +2997,41 @@ async function switchNetwork({
|
|
|
2997
2997
|
}
|
|
2998
2998
|
|
|
2999
2999
|
// src/actions/accounts/watchAccount.ts
|
|
3000
|
-
|
|
3000
|
+
|
|
3001
3001
|
function watchAccount(callback, { selector = (x) => x } = {}) {
|
|
3002
3002
|
const client2 = getClient();
|
|
3003
3003
|
const handleChange = () => callback(getAccount());
|
|
3004
3004
|
const unsubscribe = client2.subscribe(
|
|
3005
3005
|
({ data, connector, status }) => selector({
|
|
3006
|
-
address: data
|
|
3006
|
+
address: _optionalChain([data, 'optionalAccess', _114 => _114.account]),
|
|
3007
3007
|
connector,
|
|
3008
3008
|
status
|
|
3009
3009
|
}),
|
|
3010
3010
|
handleChange,
|
|
3011
3011
|
{
|
|
3012
|
-
equalityFn:
|
|
3012
|
+
equalityFn: _shallow.shallow
|
|
3013
3013
|
}
|
|
3014
3014
|
);
|
|
3015
3015
|
return unsubscribe;
|
|
3016
3016
|
}
|
|
3017
3017
|
|
|
3018
3018
|
// src/actions/accounts/watchNetwork.ts
|
|
3019
|
-
|
|
3019
|
+
|
|
3020
3020
|
function watchNetwork(callback, { selector = (x) => x } = {}) {
|
|
3021
3021
|
const client2 = getClient();
|
|
3022
3022
|
const handleChange = () => callback(getNetwork());
|
|
3023
3023
|
const unsubscribe = client2.subscribe(
|
|
3024
|
-
({ data, chains }) => selector({ chainId: data
|
|
3024
|
+
({ data, chains }) => selector({ chainId: _optionalChain([data, 'optionalAccess', _115 => _115.chain, 'optionalAccess', _116 => _116.id]), chains }),
|
|
3025
3025
|
handleChange,
|
|
3026
3026
|
{
|
|
3027
|
-
equalityFn:
|
|
3027
|
+
equalityFn: _shallow.shallow
|
|
3028
3028
|
}
|
|
3029
3029
|
);
|
|
3030
3030
|
return unsubscribe;
|
|
3031
3031
|
}
|
|
3032
3032
|
|
|
3033
3033
|
// src/actions/accounts/watchSigner.ts
|
|
3034
|
-
|
|
3034
|
+
|
|
3035
3035
|
function watchSigner({ chainId }, callback) {
|
|
3036
3036
|
const client2 = getClient();
|
|
3037
3037
|
const handleChange = async () => {
|
|
@@ -3042,13 +3042,13 @@ function watchSigner({ chainId }, callback) {
|
|
|
3042
3042
|
};
|
|
3043
3043
|
const unsubscribe = client2.subscribe(
|
|
3044
3044
|
({ data, connector }) => ({
|
|
3045
|
-
account: data
|
|
3046
|
-
chainId: data
|
|
3045
|
+
account: _optionalChain([data, 'optionalAccess', _117 => _117.account]),
|
|
3046
|
+
chainId: _optionalChain([data, 'optionalAccess', _118 => _118.chain, 'optionalAccess', _119 => _119.id]),
|
|
3047
3047
|
connector
|
|
3048
3048
|
}),
|
|
3049
3049
|
handleChange,
|
|
3050
3050
|
{
|
|
3051
|
-
equalityFn:
|
|
3051
|
+
equalityFn: _shallow.shallow
|
|
3052
3052
|
}
|
|
3053
3053
|
);
|
|
3054
3054
|
return unsubscribe;
|
|
@@ -3136,14 +3136,14 @@ var ContractMethodDoesNotExistError = class extends Error {
|
|
|
3136
3136
|
functionName
|
|
3137
3137
|
}) {
|
|
3138
3138
|
const { chains, network } = getProvider();
|
|
3139
|
-
const chain = chains
|
|
3140
|
-
const blockExplorer = chain
|
|
3139
|
+
const chain = _optionalChain([chains, 'optionalAccess', _120 => _120.find, 'call', _121 => _121(({ id }) => id === (chainId || network.chainId))]);
|
|
3140
|
+
const blockExplorer = _optionalChain([chain, 'optionalAccess', _122 => _122.blockExplorers, 'optionalAccess', _123 => _123.default]);
|
|
3141
3141
|
super(
|
|
3142
3142
|
[
|
|
3143
3143
|
`Function "${functionName}" on contract "${address}" does not exist.`,
|
|
3144
3144
|
...blockExplorer ? [
|
|
3145
3145
|
"",
|
|
3146
|
-
`${blockExplorer
|
|
3146
|
+
`${_optionalChain([blockExplorer, 'optionalAccess', _124 => _124.name])}: ${_optionalChain([blockExplorer, 'optionalAccess', _125 => _125.url])}/address/${address}#readContract`
|
|
3147
3147
|
] : []
|
|
3148
3148
|
].join("\n")
|
|
3149
3149
|
);
|
|
@@ -3290,78 +3290,78 @@ var UserRejectedRequestError = class extends ProviderRpcError {
|
|
|
3290
3290
|
}
|
|
3291
3291
|
};
|
|
3292
3292
|
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3293
|
+
|
|
3294
|
+
|
|
3295
|
+
|
|
3296
|
+
|
|
3297
|
+
|
|
3298
|
+
|
|
3299
|
+
|
|
3300
|
+
|
|
3301
|
+
|
|
3302
|
+
|
|
3303
|
+
|
|
3304
|
+
|
|
3305
|
+
|
|
3306
|
+
|
|
3307
|
+
|
|
3308
|
+
|
|
3309
|
+
|
|
3310
|
+
|
|
3311
|
+
|
|
3312
|
+
|
|
3313
|
+
|
|
3314
|
+
|
|
3315
|
+
|
|
3316
|
+
|
|
3317
|
+
|
|
3318
|
+
|
|
3319
|
+
|
|
3320
|
+
|
|
3321
|
+
|
|
3322
|
+
|
|
3323
|
+
|
|
3324
|
+
|
|
3325
|
+
|
|
3326
|
+
|
|
3327
|
+
|
|
3328
|
+
|
|
3329
|
+
|
|
3330
|
+
|
|
3331
|
+
|
|
3332
|
+
|
|
3333
|
+
|
|
3334
|
+
|
|
3335
|
+
|
|
3336
|
+
|
|
3337
|
+
|
|
3338
|
+
|
|
3339
|
+
|
|
3340
|
+
|
|
3341
|
+
|
|
3342
|
+
|
|
3343
|
+
|
|
3344
|
+
|
|
3345
|
+
|
|
3346
|
+
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
|
|
3350
|
+
|
|
3351
|
+
|
|
3352
|
+
|
|
3353
|
+
|
|
3354
|
+
|
|
3355
|
+
|
|
3356
|
+
|
|
3357
|
+
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
|
|
3361
|
+
|
|
3362
|
+
|
|
3363
|
+
|
|
3364
|
+
|
|
3365
|
+
|
|
3366
|
+
|
|
3367
|
+
exports.configureChains = configureChains; exports.RpcError = RpcError; exports.ProviderRpcError = ProviderRpcError; exports.AddChainError = AddChainError; exports.ChainDoesNotSupportMulticallError = ChainDoesNotSupportMulticallError; exports.ChainMismatchError = ChainMismatchError; exports.ChainNotConfiguredError = ChainNotConfiguredError; exports.ConnectorAlreadyConnectedError = ConnectorAlreadyConnectedError; exports.ConnectorNotFoundError = ConnectorNotFoundError; exports.ContractMethodDoesNotExistError = ContractMethodDoesNotExistError; exports.ContractMethodNoResultError = ContractMethodNoResultError; exports.ContractMethodRevertedError = ContractMethodRevertedError; exports.ContractResultDecodeError = ContractResultDecodeError; exports.ProviderChainsNotFound = ProviderChainsNotFound; exports.ResourceUnavailableError = ResourceUnavailableError; exports.SwitchChainError = SwitchChainError; exports.SwitchChainNotSupportedError = SwitchChainNotSupportedError; exports.UserRejectedRequestError = UserRejectedRequestError; exports.debounce = debounce; exports.deepEqual = deepEqual; exports.deserialize = deserialize; exports.minimizeContractInterface = minimizeContractInterface; exports.normalizeChainId = normalizeChainId; exports.parseContractResult = parseContractResult; exports.serialize = serialize; exports.noopStorage = noopStorage; exports.createStorage = createStorage; exports.Client = Client; exports.createClient = createClient; exports.getClient = getClient; exports.connect = connect; exports.disconnect = disconnect; exports.erc20ABI = erc20ABI; exports.erc721ABI = erc721ABI; exports.erc4626ABI = erc4626ABI; exports.units = units; exports.fetchToken = fetchToken; exports.getContract = getContract; exports.prepareWriteContract = prepareWriteContract; exports.getProvider = getProvider; exports.getWebSocketProvider = getWebSocketProvider; exports.watchProvider = watchProvider; exports.watchWebSocketProvider = watchWebSocketProvider; exports.multicall = multicall; exports.readContract = readContract; exports.readContracts = readContracts; exports.watchContractEvent = watchContractEvent; exports.fetchBlockNumber = fetchBlockNumber; exports.watchBlockNumber = watchBlockNumber; exports.watchMulticall = watchMulticall; exports.watchReadContract = watchReadContract; exports.watchReadContracts = watchReadContracts; exports.fetchTransaction = fetchTransaction; exports.fetchEnsAddress = fetchEnsAddress; exports.fetchEnsAvatar = fetchEnsAvatar; exports.fetchEnsName = fetchEnsName; exports.fetchEnsResolver = fetchEnsResolver; exports.prepareSendTransaction = prepareSendTransaction; exports.sendTransaction = sendTransaction; exports.fetchFeeData = fetchFeeData; exports.waitForTransaction = waitForTransaction; exports.watchPendingTransactions = watchPendingTransactions; exports.writeContract = writeContract; exports.fetchBalance = fetchBalance; exports.fetchSigner = fetchSigner; exports.getAccount = getAccount; exports.getNetwork = getNetwork; exports.signMessage = signMessage; exports.signTypedData = signTypedData; exports.switchNetwork = switchNetwork; exports.watchAccount = watchAccount; exports.watchNetwork = watchNetwork; exports.watchSigner = watchSigner;
|