@wagmi/core 0.10.7 → 0.10.8-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.
Files changed (39) hide show
  1. package/connectors/walletConnectV1/package.json +4 -0
  2. package/dist/chains.d.ts +1 -1
  3. package/dist/chains.js +171 -163
  4. package/dist/chunk-BVC4KGLQ.js +8 -8
  5. package/dist/chunk-EQOEZP46.js +5 -5
  6. package/dist/chunk-KFW652VN.js +6 -6
  7. package/dist/chunk-KX4UEHS5.js +1 -0
  8. package/dist/chunk-MQXBDTVK.js +7 -7
  9. package/dist/chunk-RIWXWG4Y.js +172 -0
  10. package/dist/{chunk-55IO54NW.js → chunk-VQG3VKOR.js} +253 -248
  11. package/dist/connectors/coinbaseWallet.js +5 -5
  12. package/dist/connectors/index.js +9 -9
  13. package/dist/connectors/injected.js +7 -7
  14. package/dist/connectors/ledger.js +5 -5
  15. package/dist/connectors/metaMask.js +5 -5
  16. package/dist/connectors/mock.js +9 -9
  17. package/dist/connectors/safe.js +5 -5
  18. package/dist/connectors/walletConnect.js +5 -5
  19. package/dist/connectors/walletConnectLegacy.js +5 -5
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +164 -164
  22. package/dist/internal/index.js +8 -8
  23. package/dist/internal/test.js +25 -25
  24. package/dist/providers/alchemy.js +11 -11
  25. package/dist/providers/infura.js +11 -11
  26. package/dist/providers/jsonRpc.js +8 -8
  27. package/dist/providers/public.js +7 -7
  28. package/internal/dist/wagmi-core-internal.cjs.d.ts +11 -0
  29. package/internal/dist/wagmi-core-internal.cjs.js +16 -0
  30. package/package.json +4 -5
  31. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.d.ts +11 -0
  32. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.js +16 -0
  33. package/providers/infura/dist/wagmi-core-providers-infura.cjs.d.ts +11 -0
  34. package/providers/infura/dist/wagmi-core-providers-infura.cjs.js +16 -0
  35. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.d.ts +11 -0
  36. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.js +16 -0
  37. package/providers/public/dist/wagmi-core-providers-public.cjs.d.ts +11 -0
  38. package/providers/public/dist/wagmi-core-providers-public.cjs.js +16 -0
  39. package/dist/chunk-FBIU3RX4.js +0 -164
@@ -1,15 +1,15 @@
1
- import {
2
- InjectedConnector
3
- } from "./chunk-BVC4KGLQ.js";
4
- import {
5
- __privateAdd,
6
- __privateGet,
7
- __privateMethod,
8
- __privateSet
9
- } from "./chunk-MQXBDTVK.js";
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
- import { providers } from "ethers";
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) ?? defaultChains[0];
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) ?? defaultChains[0];
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 ?? index,
112
- stallTimeout: provider.stallTimeout ?? 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?.message?.includes(
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
- import { persist, subscribeWithSelector } from "zustand/middleware";
134
- import { createStore } from "zustand/vanilla";
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?.id;
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)?.name ?? `Chain ${activeChainId}`,
146
- targetChain: chains.find((x) => x.id === chainId)?.name ?? `Chain ${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?.network?.chainId;
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?.id ?? "unknown"
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
- import { BigNumber } from "ethers";
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
- import { BigNumber as BigNumber2 } from "ethers";
252
- import { FunctionFragment, isAddress } from "ethers/lib/utils.js";
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?.length ?? 0;
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" || BigNumber2.isBigNumber(arg);
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()?.config.logger?.warn?.(message);
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
- import { Contract } from "ethers";
320
- import { FormatTypes } from "ethers/lib/utils.js";
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
- import { Contract as Contract2 } from "ethers";
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 = Contract2.getInterface(abi);
361
+ const iface = _ethers.Contract.getInterface(abi);
362
362
  const fragment = iface.getFunction(functionName);
363
- const isTuple = (fragment.outputs?.length || 0) > 1;
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 ?? void 0
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?.state?.data;
502
- status = data?.account ? "reconnecting" : "connecting";
503
- chainId = data?.chain?.id;
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?.data?.account,
523
- chain: state?.data?.chain
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?.chains
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?.getItem("wallet"));
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?.chain?.id;
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?.account ? "reconnecting" : "connecting"
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?.chains,
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 ?? -1);
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 ?? -1, provider_);
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 ?? -1);
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 ?? -1, webSocketProvider_);
647
+ this.webSocketProviders.set(_nullishCoalesce(chainId, () => ( -1)), webSocketProvider_);
648
648
  return webSocketProvider_;
649
649
  }
650
650
  setLastUsedConnector(lastUsedConnector = null) {
651
- this.storage?.setItem("wallet", lastUsedConnector);
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?.off?.("change", onChange);
674
- prevConnector?.off?.("disconnect", onDisconnect);
675
- prevConnector?.off?.("error", onError);
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?.("change", onChange);
679
- connector.on?.("disconnect", onDisconnect);
680
- connector.on?.("error", onError);
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?.chain?.id,
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?.chains,
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
- import { formatUnits as formatUnits3, parseBytes32String as parseBytes32String2 } from "ethers/lib/utils.js";
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
- import { formatUnits, parseBytes32String } from "ethers/lib/utils.js";
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
- import { Contract as EthersContract } from "ethers";
2090
+
2091
2091
  function getContract({
2092
2092
  address,
2093
2093
  abi,
2094
2094
  signerOrProvider
2095
2095
  }) {
2096
- return new EthersContract(
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_ ?? await fetchSigner({ chainId });
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 ?? [], ...overrides ? [overrides] : []];
2135
+ const params = [..._nullishCoalesce(args, () => ( [])), ...overrides ? [overrides] : []];
2136
2136
  const unsignedTransaction = await populateTransactionFn(
2137
2137
  ...params
2138
2138
  );
@@ -2196,21 +2196,24 @@ function watchWebSocketProvider(args, callback) {
2196
2196
  // src/actions/contracts/multicall.ts
2197
2197
  async function multicall({
2198
2198
  allowFailure = true,
2199
- chainId,
2199
+ chainId: chainIdOverride,
2200
2200
  contracts,
2201
2201
  overrides
2202
2202
  }) {
2203
- const provider = getProvider({ chainId });
2204
- if (!provider.chains)
2203
+ const provider = getProvider({ chainId: chainIdOverride });
2204
+ if (!_optionalChain([provider, 'access', _64 => _64.chains, 'optionalAccess', _65 => _65[0]]))
2205
2205
  throw new ProviderChainsNotFound();
2206
- const chain = provider.chains.find((chain2) => chain2.id === chainId) || provider.chains[0];
2206
+ const chainId = provider.network.chainId;
2207
+ if (typeof chainIdOverride !== "undefined" && chainIdOverride !== chainId)
2208
+ throw new ChainNotConfiguredError({ chainId: chainIdOverride });
2209
+ const chain = provider.chains.find((chain2) => chain2.id === chainId);
2207
2210
  if (!chain)
2208
- throw new ProviderChainsNotFound();
2209
- if (!chain?.contracts?.multicall3)
2211
+ throw new ChainNotConfiguredError({ chainId });
2212
+ if (!_optionalChain([chain, 'optionalAccess', _66 => _66.contracts, 'optionalAccess', _67 => _67.multicall3]))
2210
2213
  throw new ChainDoesNotSupportMulticallError({ chain });
2211
- if (typeof overrides?.blockTag === "number" && overrides?.blockTag < (chain.contracts.multicall3.blockCreated ?? 0))
2214
+ if (typeof _optionalChain([overrides, 'optionalAccess', _68 => _68.blockTag]) === "number" && _optionalChain([overrides, 'optionalAccess', _69 => _69.blockTag]) < (_nullishCoalesce(chain.contracts.multicall3.blockCreated, () => ( 0))))
2212
2215
  throw new ChainDoesNotSupportMulticallError({
2213
- blockNumber: overrides?.blockTag,
2216
+ blockNumber: _optionalChain([overrides, 'optionalAccess', _70 => _70.blockTag]),
2214
2217
  chain
2215
2218
  });
2216
2219
  const multicallContract = getContract({
@@ -2222,7 +2225,7 @@ async function multicall({
2222
2225
  ({ address, abi, functionName, ...config }) => {
2223
2226
  const { args } = config || {};
2224
2227
  const contract = getContract({ address, abi });
2225
- const params2 = args ?? [];
2228
+ const params2 = _nullishCoalesce(args, () => ( []));
2226
2229
  const normalizedFunctionName = normalizeFunctionName({
2227
2230
  contract,
2228
2231
  functionName,
@@ -2352,8 +2355,8 @@ async function readContract({
2352
2355
  address,
2353
2356
  functionName: normalizedFunctionName
2354
2357
  });
2355
- const params = [...args ?? [], ...overrides ? [overrides] : []];
2356
- return contractFunction?.(...params);
2358
+ const params = [..._nullishCoalesce(args, () => ( [])), ...overrides ? [overrides] : []];
2359
+ return _optionalChain([contractFunction, 'optionalCall', _71 => _71(...params)]);
2357
2360
  }
2358
2361
 
2359
2362
  // src/actions/contracts/readContracts.ts
@@ -2365,7 +2368,7 @@ async function readContracts({
2365
2368
  try {
2366
2369
  const provider = getProvider();
2367
2370
  const contractsByChainId = contracts.reduce((contracts2, contract, index) => {
2368
- const chainId = contract.chainId ?? provider.network.chainId;
2371
+ const chainId = _nullishCoalesce(contract.chainId, () => ( provider.network.chainId));
2369
2372
  return {
2370
2373
  ...contracts2,
2371
2374
  [chainId]: [...contracts2[chainId] || [], { contract, index }]
@@ -2417,7 +2420,7 @@ async function readContracts({
2417
2420
  const error = new ContractMethodRevertedError({
2418
2421
  address,
2419
2422
  functionName,
2420
- chainId: chainId ?? 1,
2423
+ chainId: _nullishCoalesce(chainId, () => ( 1)),
2421
2424
  args,
2422
2425
  errorMessage: result.reason
2423
2426
  });
@@ -2429,7 +2432,7 @@ async function readContracts({
2429
2432
  }
2430
2433
 
2431
2434
  // src/actions/contracts/watchContractEvent.ts
2432
- import { shallow } from "zustand/shallow";
2435
+ var _shallow = require('zustand/shallow');
2433
2436
  function watchContractEvent({
2434
2437
  address,
2435
2438
  abi,
@@ -2441,7 +2444,7 @@ function watchContractEvent({
2441
2444
  let contract;
2442
2445
  const watchEvent = async () => {
2443
2446
  if (contract)
2444
- contract?.off(eventName, handler);
2447
+ _optionalChain([contract, 'optionalAccess', _72 => _72.off, 'call', _73 => _73(eventName, handler)]);
2445
2448
  const signerOrProvider = getWebSocketProvider({ chainId }) || getProvider({ chainId });
2446
2449
  contract = getContract({
2447
2450
  address,
@@ -2461,16 +2464,16 @@ function watchContractEvent({
2461
2464
  webSocketProvider
2462
2465
  }),
2463
2466
  watchEvent,
2464
- { equalityFn: shallow }
2467
+ { equalityFn: _shallow.shallow }
2465
2468
  );
2466
2469
  return () => {
2467
- contract?.off(eventName, handler);
2470
+ _optionalChain([contract, 'optionalAccess', _74 => _74.off, 'call', _75 => _75(eventName, handler)]);
2468
2471
  unsubscribe();
2469
2472
  };
2470
2473
  }
2471
2474
 
2472
2475
  // src/actions/network-status/watchBlockNumber.ts
2473
- import { shallow as shallow2 } from "zustand/shallow";
2476
+
2474
2477
 
2475
2478
  // src/actions/network-status/fetchBlockNumber.ts
2476
2479
  async function fetchBlockNumber({
@@ -2487,12 +2490,12 @@ function watchBlockNumber(args, callback) {
2487
2490
  let previousProvider;
2488
2491
  const createListener = (provider) => {
2489
2492
  if (previousProvider) {
2490
- previousProvider?.off("block", debouncedCallback);
2493
+ _optionalChain([previousProvider, 'optionalAccess', _76 => _76.off, 'call', _77 => _77("block", debouncedCallback)]);
2491
2494
  }
2492
2495
  provider.on("block", debouncedCallback);
2493
2496
  previousProvider = provider;
2494
2497
  };
2495
- const provider_ = getWebSocketProvider({ chainId: args.chainId }) ?? getProvider({ chainId: args.chainId });
2498
+ const provider_ = _nullishCoalesce(getWebSocketProvider({ chainId: args.chainId }), () => ( getProvider({ chainId: args.chainId })));
2496
2499
  if (args.listen)
2497
2500
  createListener(provider_);
2498
2501
  let active = true;
@@ -2500,7 +2503,7 @@ function watchBlockNumber(args, callback) {
2500
2503
  const unsubscribe = client2.subscribe(
2501
2504
  ({ provider, webSocketProvider }) => ({ provider, webSocketProvider }),
2502
2505
  async ({ provider, webSocketProvider }) => {
2503
- const provider_2 = webSocketProvider ?? provider;
2506
+ const provider_2 = _nullishCoalesce(webSocketProvider, () => ( provider));
2504
2507
  if (args.listen && !args.chainId && provider_2) {
2505
2508
  createListener(provider_2);
2506
2509
  }
@@ -2510,14 +2513,14 @@ function watchBlockNumber(args, callback) {
2510
2513
  callback(blockNumber);
2511
2514
  },
2512
2515
  {
2513
- equalityFn: shallow2
2516
+ equalityFn: _shallow.shallow
2514
2517
  }
2515
2518
  );
2516
2519
  return () => {
2517
2520
  active = false;
2518
2521
  unsubscribe();
2519
- provider_?.off("block", debouncedCallback);
2520
- previousProvider?.off("block", debouncedCallback);
2522
+ _optionalChain([provider_, 'optionalAccess', _78 => _78.off, 'call', _79 => _79("block", debouncedCallback)]);
2523
+ _optionalChain([previousProvider, 'optionalAccess', _80 => _80.off, 'call', _81 => _81("block", debouncedCallback)]);
2521
2524
  };
2522
2525
  }
2523
2526
 
@@ -2529,7 +2532,7 @@ function watchMulticall(config, callback) {
2529
2532
  const unsubscribe = client2.subscribe(({ provider }) => provider, handleChange);
2530
2533
  return () => {
2531
2534
  unsubscribe();
2532
- unwatch?.();
2535
+ _optionalChain([unwatch, 'optionalCall', _82 => _82()]);
2533
2536
  };
2534
2537
  }
2535
2538
 
@@ -2541,7 +2544,7 @@ function watchReadContract(config, callback) {
2541
2544
  const unsubscribe = client2.subscribe(({ provider }) => provider, handleChange);
2542
2545
  return () => {
2543
2546
  unsubscribe();
2544
- unwatch?.();
2547
+ _optionalChain([unwatch, 'optionalCall', _83 => _83()]);
2545
2548
  };
2546
2549
  }
2547
2550
 
@@ -2553,7 +2556,7 @@ function watchReadContracts(config, callback) {
2553
2556
  const unsubscribe = client2.subscribe(({ provider }) => provider, handleChange);
2554
2557
  return () => {
2555
2558
  unsubscribe();
2556
- unwatch?.();
2559
+ _optionalChain([unwatch, 'optionalCall', _84 => _84()]);
2557
2560
  };
2558
2561
  }
2559
2562
 
@@ -2567,10 +2570,10 @@ async function fetchTransaction({
2567
2570
  }
2568
2571
 
2569
2572
  // src/actions/transactions/prepareSendTransaction.ts
2570
- import { isAddress as isAddress2 } from "ethers/lib/utils.js";
2573
+
2571
2574
 
2572
2575
  // src/actions/ens/fetchEnsAddress.ts
2573
- import { getAddress } from "ethers/lib/utils.js";
2576
+
2574
2577
  async function fetchEnsAddress({
2575
2578
  chainId,
2576
2579
  name
@@ -2578,7 +2581,7 @@ async function fetchEnsAddress({
2578
2581
  const provider = getProvider({ chainId });
2579
2582
  const address = await provider.resolveName(name);
2580
2583
  try {
2581
- return address ? getAddress(address) : null;
2584
+ return address ? _utilsjs.getAddress.call(void 0, address) : null;
2582
2585
  } catch (_error) {
2583
2586
  return null;
2584
2587
  }
@@ -2595,13 +2598,13 @@ async function fetchEnsAvatar({
2595
2598
  }
2596
2599
 
2597
2600
  // src/actions/ens/fetchEnsName.ts
2598
- import { getAddress as getAddress2 } from "ethers/lib/utils.js";
2601
+
2599
2602
  async function fetchEnsName({
2600
2603
  address,
2601
2604
  chainId
2602
2605
  }) {
2603
2606
  const provider = getProvider({ chainId });
2604
- return provider.lookupAddress(getAddress2(address));
2607
+ return provider.lookupAddress(_utilsjs.getAddress.call(void 0, address));
2605
2608
  }
2606
2609
 
2607
2610
  // src/actions/ens/fetchEnsResolver.ts
@@ -2620,13 +2623,13 @@ async function prepareSendTransaction({
2620
2623
  request,
2621
2624
  signer: signer_
2622
2625
  }) {
2623
- const signer = signer_ ?? await fetchSigner({ chainId });
2626
+ const signer = await _asyncNullishCoalesce(signer_, async () => ( await fetchSigner({ chainId })));
2624
2627
  if (!signer)
2625
2628
  throw new ConnectorNotFoundError();
2626
2629
  if (chainId)
2627
2630
  assertActiveChain({ chainId, signer });
2628
2631
  const [to, gasLimit] = await Promise.all([
2629
- isAddress2(request.to) ? Promise.resolve(request.to) : fetchEnsAddress({ name: request.to }),
2632
+ _utilsjs.isAddress.call(void 0, request.to) ? Promise.resolve(request.to) : fetchEnsAddress({ name: request.to }),
2630
2633
  request.gasLimit ? Promise.resolve(request.gasLimit) : signer.estimateGas(request)
2631
2634
  ]);
2632
2635
  if (!to)
@@ -2656,8 +2659,8 @@ async function sendTransaction({
2656
2659
  if (chainId)
2657
2660
  assertActiveChain({ chainId, signer });
2658
2661
  try {
2659
- const uncheckedSigner = signer.connectUnchecked?.();
2660
- const { hash, wait } = await (uncheckedSigner ?? signer).sendTransaction(
2662
+ const uncheckedSigner = _optionalChain([signer, 'access', _85 => _85.connectUnchecked, 'optionalCall', _86 => _86()]);
2663
+ const { hash, wait } = await (_nullishCoalesce(uncheckedSigner, () => ( signer))).sendTransaction(
2661
2664
  request
2662
2665
  );
2663
2666
  return { hash, wait };
@@ -2669,10 +2672,10 @@ async function sendTransaction({
2669
2672
  }
2670
2673
 
2671
2674
  // src/actions/transactions/waitForTransaction.ts
2672
- import { toUtf8String } from "ethers/lib/utils.js";
2675
+
2673
2676
 
2674
2677
  // src/actions/network-status/fetchFeeData.ts
2675
- import { formatUnits as formatUnits2 } from "ethers/lib/utils.js";
2678
+
2676
2679
  async function fetchFeeData({
2677
2680
  chainId,
2678
2681
  formatUnits: units2 = "wei"
@@ -2680,9 +2683,9 @@ async function fetchFeeData({
2680
2683
  const provider = getProvider({ chainId });
2681
2684
  const feeData = await provider.getFeeData();
2682
2685
  const formatted = {
2683
- gasPrice: feeData.gasPrice ? formatUnits2(feeData.gasPrice, units2) : null,
2684
- maxFeePerGas: feeData.maxFeePerGas ? formatUnits2(feeData.maxFeePerGas, units2) : null,
2685
- maxPriorityFeePerGas: feeData.maxPriorityFeePerGas ? formatUnits2(feeData.maxPriorityFeePerGas, units2) : null
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
2686
2689
  };
2687
2690
  return { ...feeData, formatted };
2688
2691
  }
@@ -2701,7 +2704,7 @@ async function waitForTransaction({
2701
2704
  fetchTransaction({ hash })
2702
2705
  ]);
2703
2706
  let replaceable = null;
2704
- if (confirmations !== 0 && transaction?.to) {
2707
+ if (confirmations !== 0 && _optionalChain([transaction, 'optionalAccess', _87 => _87.to])) {
2705
2708
  replaceable = {
2706
2709
  data: transaction.data,
2707
2710
  from: transaction.from,
@@ -2720,15 +2723,15 @@ async function waitForTransaction({
2720
2723
  );
2721
2724
  if (receipt.status === 0) {
2722
2725
  const code = await provider.call(receipt, receipt.blockNumber);
2723
- const reason = toUtf8String(`0x${code.substring(138)}`);
2726
+ const reason = _utilsjs.toUtf8String.call(void 0, `0x${code.substring(138)}`);
2724
2727
  throw new Error(reason);
2725
2728
  }
2726
2729
  return receipt;
2727
2730
  } catch (err) {
2728
- if (err?.reason === "repriced") {
2729
- onSpeedUp?.(err.replacement);
2731
+ if (_optionalChain([err, 'optionalAccess', _88 => _88.reason]) === "repriced") {
2732
+ _optionalChain([onSpeedUp, 'optionalCall', _89 => _89(err.replacement)]);
2730
2733
  return waitForTransaction({
2731
- hash: err.replacement?.hash,
2734
+ hash: _optionalChain([err, 'access', _90 => _90.replacement, 'optionalAccess', _91 => _91.hash]),
2732
2735
  confirmations,
2733
2736
  timeout
2734
2737
  });
@@ -2738,35 +2741,35 @@ async function waitForTransaction({
2738
2741
  }
2739
2742
 
2740
2743
  // src/actions/transactions/watchPendingTransactions.ts
2741
- import { shallow as shallow3 } from "zustand/shallow";
2744
+
2742
2745
  function watchPendingTransactions(args, callback) {
2743
2746
  let previousProvider;
2744
2747
  const createListener = (provider) => {
2745
2748
  if (previousProvider) {
2746
- previousProvider?.off("pending", callback);
2749
+ _optionalChain([previousProvider, 'optionalAccess', _92 => _92.off, 'call', _93 => _93("pending", callback)]);
2747
2750
  }
2748
2751
  provider.on("pending", callback);
2749
2752
  previousProvider = provider;
2750
2753
  };
2751
- const provider_ = getWebSocketProvider({ chainId: args.chainId }) ?? getProvider({ chainId: args.chainId });
2754
+ const provider_ = _nullishCoalesce(getWebSocketProvider({ chainId: args.chainId }), () => ( getProvider({ chainId: args.chainId })));
2752
2755
  createListener(provider_);
2753
2756
  const client2 = getClient();
2754
2757
  const unsubscribe = client2.subscribe(
2755
2758
  ({ provider, webSocketProvider }) => ({ provider, webSocketProvider }),
2756
2759
  async ({ provider, webSocketProvider }) => {
2757
- const provider_2 = webSocketProvider ?? provider;
2760
+ const provider_2 = _nullishCoalesce(webSocketProvider, () => ( provider));
2758
2761
  if (!args.chainId && provider_2) {
2759
2762
  createListener(provider_2);
2760
2763
  }
2761
2764
  },
2762
2765
  {
2763
- equalityFn: shallow3
2766
+ equalityFn: _shallow.shallow
2764
2767
  }
2765
2768
  );
2766
2769
  return () => {
2767
2770
  unsubscribe();
2768
- provider_?.off("pending", callback);
2769
- previousProvider?.off("pending", callback);
2771
+ _optionalChain([provider_, 'optionalAccess', _94 => _94.off, 'call', _95 => _95("pending", callback)]);
2772
+ _optionalChain([previousProvider, 'optionalAccess', _96 => _96.off, 'call', _97 => _97("pending", callback)]);
2770
2773
  };
2771
2774
  }
2772
2775
 
@@ -2823,7 +2826,7 @@ async function fetchBalance({
2823
2826
  });
2824
2827
  return {
2825
2828
  decimals,
2826
- formatted: formatUnits3(value2 ?? "0", unit ?? decimals),
2829
+ formatted: _utilsjs.formatUnits.call(void 0, _nullishCoalesce(value2, () => ( "0")), _nullishCoalesce(unit, () => ( decimals))),
2827
2830
  symbol,
2828
2831
  value: value2
2829
2832
  };
@@ -2836,20 +2839,20 @@ async function fetchBalance({
2836
2839
  abi: erc20ABI_bytes32
2837
2840
  });
2838
2841
  return {
2839
- symbol: parseBytes32String2(symbol),
2842
+ symbol: _utilsjs.parseBytes32String.call(void 0, symbol),
2840
2843
  ...rest
2841
2844
  };
2842
2845
  }
2843
2846
  throw err;
2844
2847
  }
2845
2848
  }
2846
- const chains = [...client2.provider.chains || [], ...client2.chains ?? []];
2849
+ const chains = [...client2.provider.chains || [], ..._nullishCoalesce(client2.chains, () => ( []))];
2847
2850
  const value = await provider.getBalance(address);
2848
2851
  const chain = chains.find((x) => x.id === provider.network.chainId);
2849
2852
  return {
2850
- decimals: chain?.nativeCurrency.decimals ?? 18,
2851
- formatted: formatUnits3(value ?? "0", unit ?? "ether"),
2852
- symbol: chain?.nativeCurrency.symbol ?? "ETH",
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")),
2853
2856
  value
2854
2857
  };
2855
2858
  }
@@ -2859,7 +2862,7 @@ async function fetchSigner({
2859
2862
  chainId
2860
2863
  } = {}) {
2861
2864
  const client2 = getClient();
2862
- const signer = await client2.connector?.getSigner?.({ chainId }) || null;
2865
+ const signer = await _optionalChain([client2, 'access', _102 => _102.connector, 'optionalAccess', _103 => _103.getSigner, 'optionalCall', _104 => _104({ chainId })]) || null;
2863
2866
  return signer;
2864
2867
  }
2865
2868
 
@@ -2869,7 +2872,7 @@ function getAccount() {
2869
2872
  switch (status) {
2870
2873
  case "connected":
2871
2874
  return {
2872
- address: data?.account,
2875
+ address: _optionalChain([data, 'optionalAccess', _105 => _105.account]),
2873
2876
  connector,
2874
2877
  isConnected: true,
2875
2878
  isConnecting: false,
@@ -2879,9 +2882,9 @@ function getAccount() {
2879
2882
  };
2880
2883
  case "reconnecting":
2881
2884
  return {
2882
- address: data?.account,
2885
+ address: _optionalChain([data, 'optionalAccess', _106 => _106.account]),
2883
2886
  connector,
2884
- isConnected: !!data?.account,
2887
+ isConnected: !!_optionalChain([data, 'optionalAccess', _107 => _107.account]),
2885
2888
  isConnecting: false,
2886
2889
  isDisconnected: false,
2887
2890
  isReconnecting: true,
@@ -2889,7 +2892,7 @@ function getAccount() {
2889
2892
  };
2890
2893
  case "connecting":
2891
2894
  return {
2892
- address: data?.account,
2895
+ address: _optionalChain([data, 'optionalAccess', _108 => _108.account]),
2893
2896
  connector,
2894
2897
  isConnected: false,
2895
2898
  isConnecting: true,
@@ -2913,11 +2916,11 @@ function getAccount() {
2913
2916
  // src/actions/accounts/getNetwork.ts
2914
2917
  function getNetwork() {
2915
2918
  const client2 = getClient();
2916
- const chainId = client2.data?.chain?.id;
2917
- const activeChains = client2.chains ?? [];
2918
- 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(
2919
2922
  (x) => x.id === chainId
2920
- ) ?? {
2923
+ ), () => ( {
2921
2924
  id: chainId,
2922
2925
  name: `Chain ${chainId}`,
2923
2926
  network: `${chainId}`,
@@ -2926,11 +2929,11 @@ function getNetwork() {
2926
2929
  default: { http: [""] },
2927
2930
  public: { http: [""] }
2928
2931
  }
2929
- };
2932
+ }));
2930
2933
  return {
2931
2934
  chain: chainId ? {
2932
2935
  ...activeChain,
2933
- ...client2.data?.chain,
2936
+ ..._optionalChain([client2, 'access', _112 => _112.data, 'optionalAccess', _113 => _113.chain]),
2934
2937
  id: chainId
2935
2938
  } : void 0,
2936
2939
  chains: activeChains
@@ -2994,41 +2997,41 @@ async function switchNetwork({
2994
2997
  }
2995
2998
 
2996
2999
  // src/actions/accounts/watchAccount.ts
2997
- import { shallow as shallow4 } from "zustand/shallow";
3000
+
2998
3001
  function watchAccount(callback, { selector = (x) => x } = {}) {
2999
3002
  const client2 = getClient();
3000
3003
  const handleChange = () => callback(getAccount());
3001
3004
  const unsubscribe = client2.subscribe(
3002
3005
  ({ data, connector, status }) => selector({
3003
- address: data?.account,
3006
+ address: _optionalChain([data, 'optionalAccess', _114 => _114.account]),
3004
3007
  connector,
3005
3008
  status
3006
3009
  }),
3007
3010
  handleChange,
3008
3011
  {
3009
- equalityFn: shallow4
3012
+ equalityFn: _shallow.shallow
3010
3013
  }
3011
3014
  );
3012
3015
  return unsubscribe;
3013
3016
  }
3014
3017
 
3015
3018
  // src/actions/accounts/watchNetwork.ts
3016
- import { shallow as shallow5 } from "zustand/shallow";
3019
+
3017
3020
  function watchNetwork(callback, { selector = (x) => x } = {}) {
3018
3021
  const client2 = getClient();
3019
3022
  const handleChange = () => callback(getNetwork());
3020
3023
  const unsubscribe = client2.subscribe(
3021
- ({ data, chains }) => selector({ chainId: data?.chain?.id, chains }),
3024
+ ({ data, chains }) => selector({ chainId: _optionalChain([data, 'optionalAccess', _115 => _115.chain, 'optionalAccess', _116 => _116.id]), chains }),
3022
3025
  handleChange,
3023
3026
  {
3024
- equalityFn: shallow5
3027
+ equalityFn: _shallow.shallow
3025
3028
  }
3026
3029
  );
3027
3030
  return unsubscribe;
3028
3031
  }
3029
3032
 
3030
3033
  // src/actions/accounts/watchSigner.ts
3031
- import { shallow as shallow6 } from "zustand/shallow";
3034
+
3032
3035
  function watchSigner({ chainId }, callback) {
3033
3036
  const client2 = getClient();
3034
3037
  const handleChange = async () => {
@@ -3039,13 +3042,13 @@ function watchSigner({ chainId }, callback) {
3039
3042
  };
3040
3043
  const unsubscribe = client2.subscribe(
3041
3044
  ({ data, connector }) => ({
3042
- account: data?.account,
3043
- chainId: data?.chain?.id,
3045
+ account: _optionalChain([data, 'optionalAccess', _117 => _117.account]),
3046
+ chainId: _optionalChain([data, 'optionalAccess', _118 => _118.chain, 'optionalAccess', _119 => _119.id]),
3044
3047
  connector
3045
3048
  }),
3046
3049
  handleChange,
3047
3050
  {
3048
- equalityFn: shallow6
3051
+ equalityFn: _shallow.shallow
3049
3052
  }
3050
3053
  );
3051
3054
  return unsubscribe;
@@ -3106,7 +3109,9 @@ var ChainNotConfiguredError = class extends Error {
3106
3109
  chainId,
3107
3110
  connectorId
3108
3111
  }) {
3109
- super(`Chain "${chainId}" not configured for connector "${connectorId}".`);
3112
+ super(
3113
+ `Chain "${chainId}" not configured${connectorId ? ` for connector "${connectorId}"` : ""}.`
3114
+ );
3110
3115
  this.name = "ChainNotConfigured";
3111
3116
  }
3112
3117
  };
@@ -3131,14 +3136,14 @@ var ContractMethodDoesNotExistError = class extends Error {
3131
3136
  functionName
3132
3137
  }) {
3133
3138
  const { chains, network } = getProvider();
3134
- const chain = chains?.find(({ id }) => id === (chainId || network.chainId));
3135
- const blockExplorer = chain?.blockExplorers?.default;
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]);
3136
3141
  super(
3137
3142
  [
3138
3143
  `Function "${functionName}" on contract "${address}" does not exist.`,
3139
3144
  ...blockExplorer ? [
3140
3145
  "",
3141
- `${blockExplorer?.name}: ${blockExplorer?.url}/address/${address}#readContract`
3146
+ `${_optionalChain([blockExplorer, 'optionalAccess', _124 => _124.name])}: ${_optionalChain([blockExplorer, 'optionalAccess', _125 => _125.url])}/address/${address}#readContract`
3142
3147
  ] : []
3143
3148
  ].join("\n")
3144
3149
  );
@@ -3285,78 +3290,78 @@ var UserRejectedRequestError = class extends ProviderRpcError {
3285
3290
  }
3286
3291
  };
3287
3292
 
3288
- export {
3289
- configureChains,
3290
- RpcError,
3291
- ProviderRpcError,
3292
- AddChainError,
3293
- ChainDoesNotSupportMulticallError,
3294
- ChainMismatchError,
3295
- ChainNotConfiguredError,
3296
- ConnectorAlreadyConnectedError,
3297
- ConnectorNotFoundError,
3298
- ContractMethodDoesNotExistError,
3299
- ContractMethodNoResultError,
3300
- ContractMethodRevertedError,
3301
- ContractResultDecodeError,
3302
- ProviderChainsNotFound,
3303
- ResourceUnavailableError,
3304
- SwitchChainError,
3305
- SwitchChainNotSupportedError,
3306
- UserRejectedRequestError,
3307
- debounce,
3308
- deepEqual,
3309
- deserialize,
3310
- minimizeContractInterface,
3311
- normalizeChainId,
3312
- parseContractResult,
3313
- serialize,
3314
- noopStorage,
3315
- createStorage,
3316
- Client,
3317
- createClient,
3318
- getClient,
3319
- connect,
3320
- disconnect,
3321
- erc20ABI,
3322
- erc721ABI,
3323
- erc4626ABI,
3324
- units,
3325
- fetchToken,
3326
- getContract,
3327
- prepareWriteContract,
3328
- getProvider,
3329
- getWebSocketProvider,
3330
- watchProvider,
3331
- watchWebSocketProvider,
3332
- multicall,
3333
- readContract,
3334
- readContracts,
3335
- watchContractEvent,
3336
- fetchBlockNumber,
3337
- watchBlockNumber,
3338
- watchMulticall,
3339
- watchReadContract,
3340
- watchReadContracts,
3341
- fetchTransaction,
3342
- fetchEnsAddress,
3343
- fetchEnsAvatar,
3344
- fetchEnsName,
3345
- fetchEnsResolver,
3346
- prepareSendTransaction,
3347
- sendTransaction,
3348
- fetchFeeData,
3349
- waitForTransaction,
3350
- watchPendingTransactions,
3351
- writeContract,
3352
- fetchBalance,
3353
- fetchSigner,
3354
- getAccount,
3355
- getNetwork,
3356
- signMessage,
3357
- signTypedData,
3358
- switchNetwork,
3359
- watchAccount,
3360
- watchNetwork,
3361
- watchSigner
3362
- };
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;