@wagmi/core 1.4.10-cjs → 1.4.10

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.
@@ -1,15 +1,15 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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');
1
+ import {
2
+ InjectedConnector
3
+ } from "./chunk-BVC4KGLQ.js";
4
+ import {
5
+ __privateAdd,
6
+ __privateGet,
7
+ __privateMethod,
8
+ __privateSet
9
+ } from "./chunk-MQXBDTVK.js";
10
10
 
11
11
  // src/utils/configureChains.ts
12
- var _viem = require('viem');
12
+ import { createPublicClient, fallback, http, webSocket } from "viem";
13
13
  function configureChains(defaultChains, providers, {
14
14
  batch = { multicall: { wait: 32 } },
15
15
  pollingInterval = 4e3,
@@ -58,15 +58,15 @@ function configureChains(defaultChains, providers, {
58
58
  return {
59
59
  chains,
60
60
  publicClient: ({ chainId }) => {
61
- const activeChain = _nullishCoalesce(chains.find((x) => x.id === chainId), () => ( defaultChains[0]));
61
+ const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];
62
62
  const chainHttpUrls = httpUrls[activeChain.id];
63
63
  if (!chainHttpUrls || !chainHttpUrls[0])
64
64
  throw new Error(`No providers configured for chain "${activeChain.id}"`);
65
- const publicClient = _viem.createPublicClient.call(void 0, {
65
+ const publicClient = createPublicClient({
66
66
  batch,
67
67
  chain: activeChain,
68
- transport: _viem.fallback.call(void 0,
69
- chainHttpUrls.map((url) => _viem.http.call(void 0, url, { timeout: stallTimeout })),
68
+ transport: fallback(
69
+ chainHttpUrls.map((url) => http(url, { timeout: stallTimeout })),
70
70
  { rank, retryCount, retryDelay }
71
71
  ),
72
72
  pollingInterval
@@ -76,15 +76,15 @@ function configureChains(defaultChains, providers, {
76
76
  });
77
77
  },
78
78
  webSocketPublicClient: ({ chainId }) => {
79
- const activeChain = _nullishCoalesce(chains.find((x) => x.id === chainId), () => ( defaultChains[0]));
79
+ const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];
80
80
  const chainWsUrls = wsUrls[activeChain.id];
81
81
  if (!chainWsUrls || !chainWsUrls[0])
82
82
  return void 0;
83
- const publicClient = _viem.createPublicClient.call(void 0, {
83
+ const publicClient = createPublicClient({
84
84
  batch,
85
85
  chain: activeChain,
86
- transport: _viem.fallback.call(void 0,
87
- chainWsUrls.map((url) => _viem.webSocket.call(void 0, url, { timeout: stallTimeout })),
86
+ transport: fallback(
87
+ chainWsUrls.map((url) => webSocket(url, { timeout: stallTimeout })),
88
88
  { rank, retryCount, retryDelay }
89
89
  ),
90
90
  pollingInterval
@@ -97,7 +97,7 @@ function configureChains(defaultChains, providers, {
97
97
  }
98
98
 
99
99
  // src/errors.ts
100
- var _connectors = require('@wagmi/connectors');
100
+ import { ConnectorNotFoundError } from "@wagmi/connectors";
101
101
  var ChainMismatchError = class extends Error {
102
102
  constructor({
103
103
  activeChain,
@@ -247,13 +247,13 @@ function getSendTransactionParameters(args) {
247
247
  }
248
248
 
249
249
  // src/utils/getUnit.ts
250
-
250
+ import { weiUnits } from "viem";
251
251
  function getUnit(unit) {
252
252
  if (typeof unit === "number")
253
253
  return unit;
254
254
  if (unit === "wei")
255
255
  return 0;
256
- return Math.abs(_viem.weiUnits[unit]);
256
+ return Math.abs(weiUnits[unit]);
257
257
  }
258
258
 
259
259
  // src/utils/serialize.ts
@@ -307,15 +307,15 @@ function serialize(value, replacer, indent, circularReplacer) {
307
307
  value,
308
308
  createReplacer((key, value_) => {
309
309
  const value2 = typeof value_ === "bigint" ? `#bigint.${value_.toString()}` : value_;
310
- return _optionalChain([replacer, 'optionalCall', _2 => _2(key, value2)]) || value2;
310
+ return replacer?.(key, value2) || value2;
311
311
  }, circularReplacer),
312
- _nullishCoalesce(indent, () => ( void 0))
312
+ indent ?? void 0
313
313
  );
314
314
  }
315
315
 
316
316
  // src/config.ts
317
- var _middleware = require('zustand/middleware');
318
- var _vanilla = require('zustand/vanilla');
317
+ import { persist, subscribeWithSelector } from "zustand/middleware";
318
+ import { createStore } from "zustand/vanilla";
319
319
 
320
320
  // src/storage.ts
321
321
  var noopStorage = {
@@ -361,7 +361,7 @@ var _isAutoConnecting, _lastUsedConnector, _addEffects, addEffects_fn;
361
361
  var Config = class {
362
362
  constructor({
363
363
  autoConnect = false,
364
- connectors = [new (0, _chunkBVC4KGLQjs.InjectedConnector)()],
364
+ connectors = [new InjectedConnector()],
365
365
  publicClient,
366
366
  storage = createStorage({
367
367
  storage: typeof window !== "undefined" ? window.localStorage : noopStorage
@@ -371,11 +371,11 @@ var Config = class {
371
371
  },
372
372
  webSocketPublicClient
373
373
  }) {
374
- _chunkMQXBDTVKjs.__privateAdd.call(void 0, this, _addEffects);
374
+ __privateAdd(this, _addEffects);
375
375
  this.publicClients = /* @__PURE__ */ new Map();
376
376
  this.webSocketPublicClients = /* @__PURE__ */ new Map();
377
- _chunkMQXBDTVKjs.__privateAdd.call(void 0, this, _isAutoConnecting, void 0);
378
- _chunkMQXBDTVKjs.__privateAdd.call(void 0, this, _lastUsedConnector, void 0);
377
+ __privateAdd(this, _isAutoConnecting, void 0);
378
+ __privateAdd(this, _lastUsedConnector, void 0);
379
379
  this.args = {
380
380
  autoConnect,
381
381
  connectors,
@@ -389,17 +389,17 @@ var Config = class {
389
389
  if (autoConnect) {
390
390
  try {
391
391
  const rawState = storage.getItem(storeKey);
392
- const data = _optionalChain([rawState, 'optionalAccess', _3 => _3.state, 'optionalAccess', _4 => _4.data]);
393
- status = _optionalChain([data, 'optionalAccess', _5 => _5.account]) ? "reconnecting" : "connecting";
394
- chainId = _optionalChain([data, 'optionalAccess', _6 => _6.chain, 'optionalAccess', _7 => _7.id]);
392
+ const data = rawState?.state?.data;
393
+ status = data?.account ? "reconnecting" : "connecting";
394
+ chainId = data?.chain?.id;
395
395
  } catch (_error) {
396
396
  }
397
397
  }
398
398
  const connectors_ = typeof connectors === "function" ? connectors() : connectors;
399
399
  connectors_.forEach((connector) => connector.setStorage(storage));
400
- this.store = _vanilla.createStore.call(void 0,
401
- _middleware.subscribeWithSelector.call(void 0,
402
- _middleware.persist.call(void 0,
400
+ this.store = createStore(
401
+ subscribeWithSelector(
402
+ persist(
403
403
  () => ({
404
404
  connectors: connectors_,
405
405
  publicClient: this.getPublicClient({ chainId }),
@@ -412,11 +412,11 @@ var Config = class {
412
412
  partialize: (state) => ({
413
413
  ...autoConnect && {
414
414
  data: {
415
- account: _optionalChain([state, 'optionalAccess', _8 => _8.data, 'optionalAccess', _9 => _9.account]),
416
- chain: _optionalChain([state, 'optionalAccess', _10 => _10.data, 'optionalAccess', _11 => _11.chain])
415
+ account: state?.data?.account,
416
+ chain: state?.data?.chain
417
417
  }
418
418
  },
419
- chains: _optionalChain([state, 'optionalAccess', _12 => _12.chains])
419
+ chains: state?.chains
420
420
  }),
421
421
  version: 2
422
422
  }
@@ -424,8 +424,8 @@ var Config = class {
424
424
  )
425
425
  );
426
426
  this.storage = storage;
427
- _chunkMQXBDTVKjs.__privateSet.call(void 0, this, _lastUsedConnector, _optionalChain([storage, 'optionalAccess', _13 => _13.getItem, 'call', _14 => _14("wallet")]));
428
- _chunkMQXBDTVKjs.__privateMethod.call(void 0, this, _addEffects, addEffects_fn).call(this);
427
+ __privateSet(this, _lastUsedConnector, storage?.getItem("wallet"));
428
+ __privateMethod(this, _addEffects, addEffects_fn).call(this);
429
429
  if (autoConnect && typeof window !== "undefined")
430
430
  setTimeout(async () => await this.autoConnect(), 0);
431
431
  }
@@ -445,7 +445,7 @@ var Config = class {
445
445
  return this.store.getState().error;
446
446
  }
447
447
  get lastUsedChainId() {
448
- return _optionalChain([this, 'access', _15 => _15.data, 'optionalAccess', _16 => _16.chain, 'optionalAccess', _17 => _17.id]);
448
+ return this.data?.chain?.id;
449
449
  }
450
450
  get publicClient() {
451
451
  return this.store.getState().publicClient;
@@ -475,21 +475,21 @@ var Config = class {
475
475
  }
476
476
  async destroy() {
477
477
  if (this.connector)
478
- await _optionalChain([this, 'access', _18 => _18.connector, 'access', _19 => _19.disconnect, 'optionalCall', _20 => _20()]);
479
- _chunkMQXBDTVKjs.__privateSet.call(void 0, this, _isAutoConnecting, false);
478
+ await this.connector.disconnect?.();
479
+ __privateSet(this, _isAutoConnecting, false);
480
480
  this.clearState();
481
481
  this.store.destroy();
482
482
  }
483
483
  async autoConnect() {
484
- if (_chunkMQXBDTVKjs.__privateGet.call(void 0, this, _isAutoConnecting))
484
+ if (__privateGet(this, _isAutoConnecting))
485
485
  return;
486
- _chunkMQXBDTVKjs.__privateSet.call(void 0, this, _isAutoConnecting, true);
486
+ __privateSet(this, _isAutoConnecting, true);
487
487
  this.setState((x) => ({
488
488
  ...x,
489
- status: _optionalChain([x, 'access', _21 => _21.data, 'optionalAccess', _22 => _22.account]) ? "reconnecting" : "connecting"
489
+ status: x.data?.account ? "reconnecting" : "connecting"
490
490
  }));
491
- const sorted = _chunkMQXBDTVKjs.__privateGet.call(void 0, this, _lastUsedConnector) ? [...this.connectors].sort(
492
- (x) => x.id === _chunkMQXBDTVKjs.__privateGet.call(void 0, this, _lastUsedConnector) ? -1 : 1
491
+ const sorted = __privateGet(this, _lastUsedConnector) ? [...this.connectors].sort(
492
+ (x) => x.id === __privateGet(this, _lastUsedConnector) ? -1 : 1
493
493
  ) : this.connectors;
494
494
  let connected = false;
495
495
  for (const connector of sorted) {
@@ -502,7 +502,7 @@ var Config = class {
502
502
  this.setState((x) => ({
503
503
  ...x,
504
504
  connector,
505
- chains: _optionalChain([connector, 'optionalAccess', _23 => _23.chains]),
505
+ chains: connector?.chains,
506
506
  data,
507
507
  status: "connected"
508
508
  }));
@@ -515,7 +515,7 @@ var Config = class {
515
515
  data: void 0,
516
516
  status: "disconnected"
517
517
  }));
518
- _chunkMQXBDTVKjs.__privateSet.call(void 0, this, _isAutoConnecting, false);
518
+ __privateSet(this, _isAutoConnecting, false);
519
519
  return this.data;
520
520
  }
521
521
  setConnectors(connectors) {
@@ -532,18 +532,18 @@ var Config = class {
532
532
  }
533
533
  getPublicClient({ chainId } = {}) {
534
534
  let publicClient_ = this.publicClients.get(-1);
535
- if (publicClient_ && _optionalChain([publicClient_, 'optionalAccess', _24 => _24.chain, 'access', _25 => _25.id]) === chainId)
535
+ if (publicClient_ && publicClient_?.chain.id === chainId)
536
536
  return publicClient_;
537
- publicClient_ = this.publicClients.get(_nullishCoalesce(chainId, () => ( -1)));
537
+ publicClient_ = this.publicClients.get(chainId ?? -1);
538
538
  if (publicClient_)
539
539
  return publicClient_;
540
540
  const { publicClient } = this.args;
541
541
  publicClient_ = typeof publicClient === "function" ? publicClient({ chainId }) : publicClient;
542
- this.publicClients.set(_nullishCoalesce(chainId, () => ( -1)), publicClient_);
542
+ this.publicClients.set(chainId ?? -1, publicClient_);
543
543
  return publicClient_;
544
544
  }
545
545
  setPublicClient(publicClient) {
546
- const chainId = _optionalChain([this, 'access', _26 => _26.data, 'optionalAccess', _27 => _27.chain, 'optionalAccess', _28 => _28.id]);
546
+ const chainId = this.data?.chain?.id;
547
547
  this.args = {
548
548
  ...this.args,
549
549
  publicClient
@@ -556,19 +556,19 @@ var Config = class {
556
556
  }
557
557
  getWebSocketPublicClient({ chainId } = {}) {
558
558
  let webSocketPublicClient_ = this.webSocketPublicClients.get(-1);
559
- if (webSocketPublicClient_ && _optionalChain([webSocketPublicClient_, 'optionalAccess', _29 => _29.chain, 'access', _30 => _30.id]) === chainId)
559
+ if (webSocketPublicClient_ && webSocketPublicClient_?.chain.id === chainId)
560
560
  return webSocketPublicClient_;
561
- webSocketPublicClient_ = this.webSocketPublicClients.get(_nullishCoalesce(chainId, () => ( -1)));
561
+ webSocketPublicClient_ = this.webSocketPublicClients.get(chainId ?? -1);
562
562
  if (webSocketPublicClient_)
563
563
  return webSocketPublicClient_;
564
564
  const { webSocketPublicClient } = this.args;
565
565
  webSocketPublicClient_ = typeof webSocketPublicClient === "function" ? webSocketPublicClient({ chainId }) : webSocketPublicClient;
566
566
  if (webSocketPublicClient_)
567
- this.webSocketPublicClients.set(_nullishCoalesce(chainId, () => ( -1)), webSocketPublicClient_);
567
+ this.webSocketPublicClients.set(chainId ?? -1, webSocketPublicClient_);
568
568
  return webSocketPublicClient_;
569
569
  }
570
570
  setWebSocketPublicClient(webSocketPublicClient) {
571
- const chainId = _optionalChain([this, 'access', _31 => _31.data, 'optionalAccess', _32 => _32.chain, 'optionalAccess', _33 => _33.id]);
571
+ const chainId = this.data?.chain?.id;
572
572
  this.args = {
573
573
  ...this.args,
574
574
  webSocketPublicClient
@@ -582,7 +582,7 @@ var Config = class {
582
582
  }));
583
583
  }
584
584
  setLastUsedConnector(lastUsedConnector = null) {
585
- _optionalChain([this, 'access', _34 => _34.storage, 'optionalAccess', _35 => _35.setItem, 'call', _36 => _36("wallet", lastUsedConnector)]);
585
+ this.storage?.setItem("wallet", lastUsedConnector);
586
586
  }
587
587
  };
588
588
  _isAutoConnecting = new WeakMap();
@@ -604,14 +604,14 @@ addEffects_fn = function() {
604
604
  this.store.subscribe(
605
605
  ({ connector }) => connector,
606
606
  (connector, prevConnector) => {
607
- _optionalChain([prevConnector, 'optionalAccess', _37 => _37.off, 'optionalCall', _38 => _38("change", onChange)]);
608
- _optionalChain([prevConnector, 'optionalAccess', _39 => _39.off, 'optionalCall', _40 => _40("disconnect", onDisconnect)]);
609
- _optionalChain([prevConnector, 'optionalAccess', _41 => _41.off, 'optionalCall', _42 => _42("error", onError)]);
607
+ prevConnector?.off?.("change", onChange);
608
+ prevConnector?.off?.("disconnect", onDisconnect);
609
+ prevConnector?.off?.("error", onError);
610
610
  if (!connector)
611
611
  return;
612
- _optionalChain([connector, 'access', _43 => _43.on, 'optionalCall', _44 => _44("change", onChange)]);
613
- _optionalChain([connector, 'access', _45 => _45.on, 'optionalCall', _46 => _46("disconnect", onDisconnect)]);
614
- _optionalChain([connector, 'access', _47 => _47.on, 'optionalCall', _48 => _48("error", onError)]);
612
+ connector.on?.("change", onChange);
613
+ connector.on?.("disconnect", onDisconnect);
614
+ connector.on?.("error", onError);
615
615
  }
616
616
  );
617
617
  const { publicClient, webSocketPublicClient } = this.args;
@@ -619,7 +619,7 @@ addEffects_fn = function() {
619
619
  const subscribeWebSocketPublicClient = typeof webSocketPublicClient === "function";
620
620
  if (subscribePublicClient || subscribeWebSocketPublicClient)
621
621
  this.store.subscribe(
622
- ({ data }) => _optionalChain([data, 'optionalAccess', _49 => _49.chain, 'optionalAccess', _50 => _50.id]),
622
+ ({ data }) => data?.chain?.id,
623
623
  (chainId) => {
624
624
  this.setState((x) => ({
625
625
  ...x,
@@ -659,7 +659,7 @@ async function connect({ chainId, connector }) {
659
659
  config2.setState((x) => ({
660
660
  ...x,
661
661
  connector,
662
- chains: _optionalChain([connector, 'optionalAccess', _51 => _51.chains]),
662
+ chains: connector?.chains,
663
663
  data,
664
664
  status: "connected"
665
665
  }));
@@ -686,12 +686,12 @@ async function disconnect() {
686
686
  }
687
687
 
688
688
  // src/actions/accounts/fetchBalance.ts
689
-
690
-
691
-
692
-
693
-
694
-
689
+ import {
690
+ ContractFunctionExecutionError as ContractFunctionExecutionError3,
691
+ formatUnits as formatUnits2,
692
+ hexToString as hexToString2,
693
+ trim as trim2
694
+ } from "viem";
695
695
 
696
696
  // src/constants/abis.ts
697
697
  var erc20ABI = [
@@ -1922,12 +1922,12 @@ var erc4626ABI = [
1922
1922
  ];
1923
1923
 
1924
1924
  // src/actions/contracts/fetchToken.ts
1925
-
1926
-
1927
-
1928
-
1929
-
1930
-
1925
+ import {
1926
+ ContractFunctionExecutionError,
1927
+ formatUnits,
1928
+ hexToString,
1929
+ trim
1930
+ } from "viem";
1931
1931
  async function fetchToken({
1932
1932
  address,
1933
1933
  chainId,
@@ -1950,7 +1950,7 @@ async function fetchToken({
1950
1950
  name,
1951
1951
  symbol,
1952
1952
  totalSupply: {
1953
- formatted: _viem.formatUnits.call(void 0, totalSupply, getUnit(unit)),
1953
+ formatted: formatUnits(totalSupply, getUnit(unit)),
1954
1954
  value: totalSupply
1955
1955
  }
1956
1956
  };
@@ -1958,13 +1958,13 @@ async function fetchToken({
1958
1958
  try {
1959
1959
  return await fetchToken_({ abi: erc20ABI });
1960
1960
  } catch (err) {
1961
- if (err instanceof _viem.ContractFunctionExecutionError) {
1961
+ if (err instanceof ContractFunctionExecutionError) {
1962
1962
  const { name, symbol, ...rest } = await fetchToken_({
1963
1963
  abi: erc20ABI_bytes32
1964
1964
  });
1965
1965
  return {
1966
- name: _viem.hexToString.call(void 0, _viem.trim.call(void 0, name, { dir: "right" })),
1967
- symbol: _viem.hexToString.call(void 0, _viem.trim.call(void 0, symbol, { dir: "right" })),
1966
+ name: hexToString(trim(name, { dir: "right" })),
1967
+ symbol: hexToString(trim(symbol, { dir: "right" })),
1968
1968
  ...rest
1969
1969
  };
1970
1970
  }
@@ -1985,7 +1985,7 @@ async function getWalletClient({
1985
1985
  chainId
1986
1986
  } = {}) {
1987
1987
  const config2 = getConfig();
1988
- const walletClient = await _optionalChain([config2, 'access', _52 => _52.connector, 'optionalAccess', _53 => _53.getWalletClient, 'optionalCall', _54 => _54({ chainId })]) || null;
1988
+ const walletClient = await config2.connector?.getWalletClient?.({ chainId }) || null;
1989
1989
  return walletClient;
1990
1990
  }
1991
1991
 
@@ -2011,7 +2011,7 @@ function watchPublicClient(args, callback) {
2011
2011
  }
2012
2012
 
2013
2013
  // src/actions/viem/watchWalletClient.ts
2014
- var _shallow = require('zustand/shallow');
2014
+ import { shallow } from "zustand/shallow";
2015
2015
  function watchWalletClient({ chainId }, callback) {
2016
2016
  const config2 = getConfig();
2017
2017
  const handleChange = async ({ chainId: chainId_ }) => {
@@ -2024,13 +2024,13 @@ function watchWalletClient({ chainId }, callback) {
2024
2024
  };
2025
2025
  const unsubscribe = config2.subscribe(
2026
2026
  ({ data, connector }) => ({
2027
- account: _optionalChain([data, 'optionalAccess', _55 => _55.account]),
2028
- chainId: _optionalChain([data, 'optionalAccess', _56 => _56.chain, 'optionalAccess', _57 => _57.id]),
2027
+ account: data?.account,
2028
+ chainId: data?.chain?.id,
2029
2029
  connector
2030
2030
  }),
2031
2031
  handleChange,
2032
2032
  {
2033
- equalityFn: _shallow.shallow
2033
+ equalityFn: shallow
2034
2034
  }
2035
2035
  );
2036
2036
  return unsubscribe;
@@ -2059,9 +2059,9 @@ async function prepareWriteContract({
2059
2059
  ...config2
2060
2060
  }) {
2061
2061
  const publicClient = getPublicClient({ chainId });
2062
- const walletClient = await _asyncNullishCoalesce(walletClient_, async () => ( await getWalletClient({ chainId })));
2062
+ const walletClient = walletClient_ ?? await getWalletClient({ chainId });
2063
2063
  if (!walletClient)
2064
- throw new (0, _connectors.ConnectorNotFoundError)();
2064
+ throw new ConnectorNotFoundError();
2065
2065
  if (chainId)
2066
2066
  assertActiveChain({ chainId });
2067
2067
  const {
@@ -2108,7 +2108,7 @@ async function prepareWriteContract({
2108
2108
  }
2109
2109
 
2110
2110
  // src/actions/contracts/getContract.ts
2111
-
2111
+ import { getContract as getContract_ } from "viem";
2112
2112
  function getContract({
2113
2113
  address,
2114
2114
  abi,
@@ -2116,7 +2116,7 @@ function getContract({
2116
2116
  walletClient
2117
2117
  }) {
2118
2118
  const publicClient = getPublicClient({ chainId });
2119
- return _viem.getContract.call(void 0, {
2119
+ return getContract_({
2120
2120
  address,
2121
2121
  abi,
2122
2122
  publicClient,
@@ -2138,7 +2138,7 @@ async function multicall({
2138
2138
  if (chainId && publicClient.chain.id !== chainId)
2139
2139
  throw new ChainNotConfiguredError({ chainId });
2140
2140
  return publicClient.multicall({
2141
- allowFailure: _nullishCoalesce(args.allowFailure, () => ( true)),
2141
+ allowFailure: args.allowFailure ?? true,
2142
2142
  blockNumber,
2143
2143
  blockTag,
2144
2144
  contracts
@@ -2169,7 +2169,7 @@ async function readContract({
2169
2169
  }
2170
2170
 
2171
2171
  // src/actions/contracts/readContracts.ts
2172
-
2172
+ import { ContractFunctionExecutionError as ContractFunctionExecutionError2 } from "viem";
2173
2173
  async function readContracts({
2174
2174
  contracts,
2175
2175
  blockNumber,
@@ -2180,7 +2180,7 @@ async function readContracts({
2180
2180
  try {
2181
2181
  const publicClient = getPublicClient();
2182
2182
  const contractsByChainId = contracts.reduce((contracts2, contract, index) => {
2183
- const chainId = _nullishCoalesce(contract.chainId, () => ( publicClient.chain.id));
2183
+ const chainId = contract.chainId ?? publicClient.chain.id;
2184
2184
  return {
2185
2185
  ...contracts2,
2186
2186
  [chainId]: [...contracts2[chainId] || [], { contract, index }]
@@ -2207,7 +2207,7 @@ async function readContracts({
2207
2207
  return results;
2208
2208
  }, []);
2209
2209
  } catch (err) {
2210
- if (err instanceof _viem.ContractFunctionExecutionError)
2210
+ if (err instanceof ContractFunctionExecutionError2)
2211
2211
  throw err;
2212
2212
  const promises = () => contracts.map(
2213
2213
  (contract) => readContract({ ...contract, blockNumber, blockTag })
@@ -2223,7 +2223,7 @@ async function readContracts({
2223
2223
  }
2224
2224
 
2225
2225
  // src/actions/contracts/watchContractEvent.ts
2226
-
2226
+ import { shallow as shallow2 } from "zustand/shallow";
2227
2227
  function watchContractEvent({
2228
2228
  address,
2229
2229
  abi,
@@ -2250,16 +2250,16 @@ function watchContractEvent({
2250
2250
  webSocketPublicClient
2251
2251
  }),
2252
2252
  watchEvent,
2253
- { equalityFn: _shallow.shallow }
2253
+ { equalityFn: shallow2 }
2254
2254
  );
2255
2255
  return () => {
2256
- _optionalChain([unwatch, 'optionalCall', _58 => _58()]);
2256
+ unwatch?.();
2257
2257
  unsubscribe();
2258
2258
  };
2259
2259
  }
2260
2260
 
2261
2261
  // src/actions/network-status/watchBlockNumber.ts
2262
-
2262
+ import { shallow as shallow3 } from "zustand/shallow";
2263
2263
  function watchBlockNumber(args, callback) {
2264
2264
  let unwatch;
2265
2265
  const createListener = (publicClient) => {
@@ -2271,7 +2271,7 @@ function watchBlockNumber(args, callback) {
2271
2271
  poll: true
2272
2272
  });
2273
2273
  };
2274
- const publicClient_ = _nullishCoalesce(getWebSocketPublicClient({ chainId: args.chainId }), () => ( getPublicClient({ chainId: args.chainId })));
2274
+ const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });
2275
2275
  if (args.listen)
2276
2276
  createListener(publicClient_);
2277
2277
  const config2 = getConfig();
@@ -2281,18 +2281,18 @@ function watchBlockNumber(args, callback) {
2281
2281
  webSocketPublicClient
2282
2282
  }),
2283
2283
  async ({ publicClient, webSocketPublicClient }) => {
2284
- const publicClient_2 = _nullishCoalesce(webSocketPublicClient, () => ( publicClient));
2284
+ const publicClient_2 = webSocketPublicClient ?? publicClient;
2285
2285
  if (args.listen && !args.chainId && publicClient_2) {
2286
2286
  createListener(publicClient_2);
2287
2287
  }
2288
2288
  },
2289
2289
  {
2290
- equalityFn: _shallow.shallow
2290
+ equalityFn: shallow3
2291
2291
  }
2292
2292
  );
2293
2293
  return () => {
2294
2294
  unsubscribe();
2295
- _optionalChain([unwatch, 'optionalCall', _59 => _59()]);
2295
+ unwatch?.();
2296
2296
  };
2297
2297
  }
2298
2298
 
@@ -2307,7 +2307,7 @@ function watchMulticall(args, callback) {
2307
2307
  );
2308
2308
  return () => {
2309
2309
  unsubscribe();
2310
- _optionalChain([unwatch, 'optionalCall', _60 => _60()]);
2310
+ unwatch?.();
2311
2311
  };
2312
2312
  }
2313
2313
 
@@ -2322,7 +2322,7 @@ function watchReadContract(args, callback) {
2322
2322
  );
2323
2323
  return () => {
2324
2324
  unsubscribe();
2325
- _optionalChain([unwatch, 'optionalCall', _61 => _61()]);
2325
+ unwatch?.();
2326
2326
  };
2327
2327
  }
2328
2328
 
@@ -2337,7 +2337,7 @@ function watchReadContracts(args, callback) {
2337
2337
  );
2338
2338
  return () => {
2339
2339
  unsubscribe();
2340
- _optionalChain([unwatch, 'optionalCall', _62 => _62()]);
2340
+ unwatch?.();
2341
2341
  };
2342
2342
  }
2343
2343
 
@@ -2345,7 +2345,7 @@ function watchReadContracts(args, callback) {
2345
2345
  async function writeContract(config2) {
2346
2346
  const walletClient = await getWalletClient({ chainId: config2.chainId });
2347
2347
  if (!walletClient)
2348
- throw new (0, _connectors.ConnectorNotFoundError)();
2348
+ throw new ConnectorNotFoundError();
2349
2349
  if (config2.chainId)
2350
2350
  assertActiveChain({ chainId: config2.chainId });
2351
2351
  let request;
@@ -2389,7 +2389,7 @@ async function fetchBalance({
2389
2389
  });
2390
2390
  return {
2391
2391
  decimals,
2392
- formatted: _viem.formatUnits.call(void 0, _nullishCoalesce(value2, () => ( "0")), getUnit(_nullishCoalesce(unit, () => ( decimals)))),
2392
+ formatted: formatUnits2(value2 ?? "0", getUnit(unit ?? decimals)),
2393
2393
  symbol,
2394
2394
  value: value2
2395
2395
  };
@@ -2397,12 +2397,12 @@ async function fetchBalance({
2397
2397
  try {
2398
2398
  return await fetchContractBalance({ abi: erc20ABI });
2399
2399
  } catch (err) {
2400
- if (err instanceof _viem.ContractFunctionExecutionError) {
2400
+ if (err instanceof ContractFunctionExecutionError3) {
2401
2401
  const { symbol, ...rest } = await fetchContractBalance({
2402
2402
  abi: erc20ABI_bytes32
2403
2403
  });
2404
2404
  return {
2405
- symbol: _viem.hexToString.call(void 0, _viem.trim.call(void 0, symbol, { dir: "right" })),
2405
+ symbol: hexToString2(trim2(symbol, { dir: "right" })),
2406
2406
  ...rest
2407
2407
  };
2408
2408
  }
@@ -2411,14 +2411,14 @@ async function fetchBalance({
2411
2411
  }
2412
2412
  const chains = [
2413
2413
  ...config2.publicClient.chains || [],
2414
- ..._nullishCoalesce(config2.chains, () => ( []))
2414
+ ...config2.chains ?? []
2415
2415
  ];
2416
2416
  const value = await publicClient.getBalance({ address });
2417
2417
  const chain = chains.find((x) => x.id === publicClient.chain.id);
2418
2418
  return {
2419
- decimals: _nullishCoalesce(_optionalChain([chain, 'optionalAccess', _63 => _63.nativeCurrency, 'access', _64 => _64.decimals]), () => ( 18)),
2420
- formatted: _viem.formatUnits.call(void 0, _nullishCoalesce(value, () => ( "0")), getUnit(_nullishCoalesce(unit, () => ( 18)))),
2421
- symbol: _nullishCoalesce(_optionalChain([chain, 'optionalAccess', _65 => _65.nativeCurrency, 'access', _66 => _66.symbol]), () => ( "ETH")),
2419
+ decimals: chain?.nativeCurrency.decimals ?? 18,
2420
+ formatted: formatUnits2(value ?? "0", getUnit(unit ?? 18)),
2421
+ symbol: chain?.nativeCurrency.symbol ?? "ETH",
2422
2422
  value
2423
2423
  };
2424
2424
  }
@@ -2429,7 +2429,7 @@ function getAccount() {
2429
2429
  switch (status) {
2430
2430
  case "connected":
2431
2431
  return {
2432
- address: _optionalChain([data, 'optionalAccess', _67 => _67.account]),
2432
+ address: data?.account,
2433
2433
  connector,
2434
2434
  isConnected: true,
2435
2435
  isConnecting: false,
@@ -2439,9 +2439,9 @@ function getAccount() {
2439
2439
  };
2440
2440
  case "reconnecting":
2441
2441
  return {
2442
- address: _optionalChain([data, 'optionalAccess', _68 => _68.account]),
2442
+ address: data?.account,
2443
2443
  connector,
2444
- isConnected: !!_optionalChain([data, 'optionalAccess', _69 => _69.account]),
2444
+ isConnected: !!data?.account,
2445
2445
  isConnecting: false,
2446
2446
  isDisconnected: false,
2447
2447
  isReconnecting: true,
@@ -2449,7 +2449,7 @@ function getAccount() {
2449
2449
  };
2450
2450
  case "connecting":
2451
2451
  return {
2452
- address: _optionalChain([data, 'optionalAccess', _70 => _70.account]),
2452
+ address: data?.account,
2453
2453
  connector,
2454
2454
  isConnected: false,
2455
2455
  isConnecting: true,
@@ -2473,12 +2473,12 @@ function getAccount() {
2473
2473
  // src/actions/accounts/getNetwork.ts
2474
2474
  function getNetwork() {
2475
2475
  const config2 = getConfig();
2476
- const chainId = _optionalChain([config2, 'access', _71 => _71.data, 'optionalAccess', _72 => _72.chain, 'optionalAccess', _73 => _73.id]);
2477
- const activeChains = _nullishCoalesce(config2.chains, () => ( []));
2478
- const activeChain = _nullishCoalesce([
2479
- ..._optionalChain([config2, 'access', _74 => _74.publicClient, 'optionalAccess', _75 => _75.chains]) || [],
2476
+ const chainId = config2.data?.chain?.id;
2477
+ const activeChains = config2.chains ?? [];
2478
+ const activeChain = [
2479
+ ...config2.publicClient?.chains || [],
2480
2480
  ...activeChains
2481
- ].find((x) => x.id === chainId), () => ( {
2481
+ ].find((x) => x.id === chainId) ?? {
2482
2482
  id: chainId,
2483
2483
  name: `Chain ${chainId}`,
2484
2484
  network: `${chainId}`,
@@ -2487,11 +2487,11 @@ function getNetwork() {
2487
2487
  default: { http: [""] },
2488
2488
  public: { http: [""] }
2489
2489
  }
2490
- }));
2490
+ };
2491
2491
  return {
2492
2492
  chain: chainId ? {
2493
2493
  ...activeChain,
2494
- ..._optionalChain([config2, 'access', _76 => _76.data, 'optionalAccess', _77 => _77.chain]),
2494
+ ...config2.data?.chain,
2495
2495
  id: chainId
2496
2496
  } : void 0,
2497
2497
  chains: activeChains
@@ -2502,7 +2502,7 @@ function getNetwork() {
2502
2502
  async function signMessage(args) {
2503
2503
  const walletClient = await getWalletClient();
2504
2504
  if (!walletClient)
2505
- throw new (0, _connectors.ConnectorNotFoundError)();
2505
+ throw new ConnectorNotFoundError();
2506
2506
  return await walletClient.signMessage({
2507
2507
  message: args.message
2508
2508
  });
@@ -2517,7 +2517,7 @@ async function signTypedData({
2517
2517
  }) {
2518
2518
  const walletClient = await getWalletClient();
2519
2519
  if (!walletClient)
2520
- throw new (0, _connectors.ConnectorNotFoundError)();
2520
+ throw new ConnectorNotFoundError();
2521
2521
  const { chainId } = domain;
2522
2522
  if (chainId)
2523
2523
  assertActiveChain({ chainId });
@@ -2535,7 +2535,7 @@ async function switchNetwork({
2535
2535
  }) {
2536
2536
  const { connector } = getConfig();
2537
2537
  if (!connector)
2538
- throw new (0, _connectors.ConnectorNotFoundError)();
2538
+ throw new ConnectorNotFoundError();
2539
2539
  if (!connector.switchChain)
2540
2540
  throw new SwitchChainNotSupportedError({
2541
2541
  connector
@@ -2544,46 +2544,46 @@ async function switchNetwork({
2544
2544
  }
2545
2545
 
2546
2546
  // src/actions/accounts/watchAccount.ts
2547
-
2547
+ import { shallow as shallow4 } from "zustand/shallow";
2548
2548
  function watchAccount(callback, { selector = (x) => x } = {}) {
2549
2549
  const config2 = getConfig();
2550
2550
  const handleChange = () => callback(getAccount());
2551
2551
  const unsubscribe = config2.subscribe(
2552
2552
  ({ data, connector, status }) => selector({
2553
- address: _optionalChain([data, 'optionalAccess', _78 => _78.account]),
2553
+ address: data?.account,
2554
2554
  connector,
2555
2555
  status
2556
2556
  }),
2557
2557
  handleChange,
2558
2558
  {
2559
- equalityFn: _shallow.shallow
2559
+ equalityFn: shallow4
2560
2560
  }
2561
2561
  );
2562
2562
  return unsubscribe;
2563
2563
  }
2564
2564
 
2565
2565
  // src/actions/accounts/watchNetwork.ts
2566
-
2566
+ import { shallow as shallow5 } from "zustand/shallow";
2567
2567
  function watchNetwork(callback, { selector = (x) => x } = {}) {
2568
2568
  const config2 = getConfig();
2569
2569
  const handleChange = () => callback(getNetwork());
2570
2570
  const unsubscribe = config2.subscribe(
2571
- ({ data, chains }) => selector({ chainId: _optionalChain([data, 'optionalAccess', _79 => _79.chain, 'optionalAccess', _80 => _80.id]), chains }),
2571
+ ({ data, chains }) => selector({ chainId: data?.chain?.id, chains }),
2572
2572
  handleChange,
2573
2573
  {
2574
- equalityFn: _shallow.shallow
2574
+ equalityFn: shallow5
2575
2575
  }
2576
2576
  );
2577
2577
  return unsubscribe;
2578
2578
  }
2579
2579
 
2580
2580
  // src/actions/ens/fetchEnsAddress.ts
2581
-
2581
+ import { getAddress } from "viem";
2582
2582
  async function fetchEnsAddress({
2583
2583
  chainId,
2584
2584
  name
2585
2585
  }) {
2586
- const { normalize } = await Promise.resolve().then(() => _interopRequireWildcard(require("viem/ens")));
2586
+ const { normalize } = await import("viem/ens");
2587
2587
  const publicClient = getPublicClient({ chainId });
2588
2588
  const address = await publicClient.getEnsAddress({
2589
2589
  name: normalize(name)
@@ -2591,7 +2591,7 @@ async function fetchEnsAddress({
2591
2591
  try {
2592
2592
  if (address === "0x0000000000000000000000000000000000000000")
2593
2593
  return null;
2594
- return address ? _viem.getAddress.call(void 0, address) : null;
2594
+ return address ? getAddress(address) : null;
2595
2595
  } catch (_error) {
2596
2596
  return null;
2597
2597
  }
@@ -2602,21 +2602,21 @@ async function fetchEnsAvatar({
2602
2602
  name,
2603
2603
  chainId
2604
2604
  }) {
2605
- const { normalize } = await Promise.resolve().then(() => _interopRequireWildcard(require("viem/ens")));
2605
+ const { normalize } = await import("viem/ens");
2606
2606
  const publicClient = getPublicClient({ chainId });
2607
2607
  const avatar = await publicClient.getEnsAvatar({ name: normalize(name) });
2608
2608
  return avatar;
2609
2609
  }
2610
2610
 
2611
2611
  // src/actions/ens/fetchEnsName.ts
2612
-
2612
+ import { getAddress as getAddress2 } from "viem";
2613
2613
  async function fetchEnsName({
2614
2614
  address,
2615
2615
  chainId
2616
2616
  }) {
2617
2617
  const publicClient = getPublicClient({ chainId });
2618
2618
  return publicClient.getEnsName({
2619
- address: _viem.getAddress.call(void 0, address)
2619
+ address: getAddress2(address)
2620
2620
  });
2621
2621
  }
2622
2622
 
@@ -2625,7 +2625,7 @@ async function fetchEnsResolver({
2625
2625
  chainId,
2626
2626
  name
2627
2627
  }) {
2628
- const { normalize } = await Promise.resolve().then(() => _interopRequireWildcard(require("viem/ens")));
2628
+ const { normalize } = await import("viem/ens");
2629
2629
  const publicClient = getPublicClient({ chainId });
2630
2630
  const resolver = await publicClient.getEnsResolver({ name: normalize(name) });
2631
2631
  return resolver;
@@ -2641,7 +2641,7 @@ async function fetchBlockNumber({
2641
2641
  }
2642
2642
 
2643
2643
  // src/actions/network-status/fetchFeeData.ts
2644
-
2644
+ import { formatUnits as formatUnits3, parseGwei } from "viem";
2645
2645
  async function fetchFeeData({
2646
2646
  chainId,
2647
2647
  formatUnits: units = "gwei"
@@ -2651,21 +2651,21 @@ async function fetchFeeData({
2651
2651
  let gasPrice = null;
2652
2652
  try {
2653
2653
  gasPrice = await publicClient.getGasPrice();
2654
- } catch (e) {
2654
+ } catch {
2655
2655
  }
2656
2656
  let lastBaseFeePerGas = null;
2657
2657
  let maxFeePerGas = null;
2658
2658
  let maxPriorityFeePerGas = null;
2659
- if (_optionalChain([block, 'optionalAccess', _81 => _81.baseFeePerGas])) {
2659
+ if (block?.baseFeePerGas) {
2660
2660
  lastBaseFeePerGas = block.baseFeePerGas;
2661
- maxPriorityFeePerGas = _viem.parseGwei.call(void 0, "1");
2661
+ maxPriorityFeePerGas = parseGwei("1");
2662
2662
  maxFeePerGas = block.baseFeePerGas * 2n + maxPriorityFeePerGas;
2663
2663
  }
2664
2664
  const unit = getUnit(units);
2665
2665
  const formatted = {
2666
- gasPrice: gasPrice ? _viem.formatUnits.call(void 0, gasPrice, unit) : null,
2667
- maxFeePerGas: maxFeePerGas ? _viem.formatUnits.call(void 0, maxFeePerGas, unit) : null,
2668
- maxPriorityFeePerGas: maxPriorityFeePerGas ? _viem.formatUnits.call(void 0, maxPriorityFeePerGas, unit) : null
2666
+ gasPrice: gasPrice ? formatUnits3(gasPrice, unit) : null,
2667
+ maxFeePerGas: maxFeePerGas ? formatUnits3(maxFeePerGas, unit) : null,
2668
+ maxPriorityFeePerGas: maxPriorityFeePerGas ? formatUnits3(maxPriorityFeePerGas, unit) : null
2669
2669
  };
2670
2670
  return {
2671
2671
  lastBaseFeePerGas,
@@ -2686,7 +2686,7 @@ async function fetchTransaction({
2686
2686
  }
2687
2687
 
2688
2688
  // src/actions/transactions/prepareSendTransaction.ts
2689
-
2689
+ import { isAddress } from "viem";
2690
2690
  async function prepareSendTransaction({
2691
2691
  accessList,
2692
2692
  account,
@@ -2702,19 +2702,19 @@ async function prepareSendTransaction({
2702
2702
  walletClient: walletClient_
2703
2703
  }) {
2704
2704
  const publicClient = getPublicClient({ chainId });
2705
- const walletClient = await _asyncNullishCoalesce(walletClient_, async () => ( await getWalletClient({ chainId })));
2705
+ const walletClient = walletClient_ ?? await getWalletClient({ chainId });
2706
2706
  if (!walletClient)
2707
- throw new (0, _connectors.ConnectorNotFoundError)();
2707
+ throw new ConnectorNotFoundError();
2708
2708
  if (chainId)
2709
2709
  assertActiveChain({ chainId });
2710
- const to = (to_ && !_viem.isAddress.call(void 0, to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;
2711
- if (to && !_viem.isAddress.call(void 0, to))
2710
+ const to = (to_ && !isAddress(to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;
2711
+ if (to && !isAddress(to))
2712
2712
  throw new Error("Invalid address");
2713
2713
  const gas = typeof gas_ === "undefined" ? await publicClient.estimateGas({
2714
2714
  accessList,
2715
2715
  account: walletClient.account,
2716
2716
  data,
2717
- gas: _nullishCoalesce(gas_, () => ( void 0)),
2717
+ gas: gas_ ?? void 0,
2718
2718
  gasPrice,
2719
2719
  maxFeePerGas,
2720
2720
  maxPriorityFeePerGas,
@@ -2755,7 +2755,7 @@ async function sendTransaction({
2755
2755
  }) {
2756
2756
  const walletClient = await getWalletClient({ chainId });
2757
2757
  if (!walletClient)
2758
- throw new (0, _connectors.ConnectorNotFoundError)();
2758
+ throw new ConnectorNotFoundError();
2759
2759
  if (chainId)
2760
2760
  assertActiveChain({ chainId });
2761
2761
  let args;
@@ -2796,7 +2796,7 @@ async function sendTransaction({
2796
2796
  }
2797
2797
 
2798
2798
  // src/actions/transactions/waitForTransaction.ts
2799
-
2799
+ import { hexToString as hexToString3 } from "viem";
2800
2800
  async function waitForTransaction({
2801
2801
  chainId,
2802
2802
  confirmations = 1,
@@ -2821,14 +2821,14 @@ async function waitForTransaction({
2821
2821
  maxFeePerGas: txn.type === "eip1559" ? txn.maxFeePerGas : void 0,
2822
2822
  maxPriorityFeePerGas: txn.type === "eip1559" ? txn.maxPriorityFeePerGas : void 0
2823
2823
  });
2824
- const reason = _viem.hexToString.call(void 0, `0x${code.substring(138)}`);
2824
+ const reason = hexToString3(`0x${code.substring(138)}`);
2825
2825
  throw new Error(reason);
2826
2826
  }
2827
2827
  return receipt;
2828
2828
  }
2829
2829
 
2830
2830
  // src/actions/transactions/watchPendingTransactions.ts
2831
-
2831
+ import { shallow as shallow6 } from "zustand/shallow";
2832
2832
  function watchPendingTransactions(args, callback) {
2833
2833
  let unwatch;
2834
2834
  const createListener = (publicClient) => {
@@ -2839,7 +2839,7 @@ function watchPendingTransactions(args, callback) {
2839
2839
  poll: true
2840
2840
  });
2841
2841
  };
2842
- const publicClient_ = _nullishCoalesce(getWebSocketPublicClient({ chainId: args.chainId }), () => ( getPublicClient({ chainId: args.chainId })));
2842
+ const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });
2843
2843
  createListener(publicClient_);
2844
2844
  const config2 = getConfig();
2845
2845
  const unsubscribe = config2.subscribe(
@@ -2848,92 +2848,92 @@ function watchPendingTransactions(args, callback) {
2848
2848
  webSocketPublicClient
2849
2849
  }),
2850
2850
  async ({ publicClient, webSocketPublicClient }) => {
2851
- const publicClient_2 = _nullishCoalesce(webSocketPublicClient, () => ( publicClient));
2851
+ const publicClient_2 = webSocketPublicClient ?? publicClient;
2852
2852
  if (!args.chainId && publicClient_2) {
2853
2853
  createListener(publicClient_2);
2854
2854
  }
2855
2855
  },
2856
2856
  {
2857
- equalityFn: _shallow.shallow
2857
+ equalityFn: shallow6
2858
2858
  }
2859
2859
  );
2860
2860
  return () => {
2861
2861
  unsubscribe();
2862
- _optionalChain([unwatch, 'optionalCall', _82 => _82()]);
2862
+ unwatch?.();
2863
2863
  };
2864
2864
  }
2865
2865
 
2866
2866
  // src/utils/assertActiveChain.ts
2867
2867
  function assertActiveChain({ chainId }) {
2868
2868
  const { chain: activeChain, chains } = getNetwork();
2869
- const activeChainId = _optionalChain([activeChain, 'optionalAccess', _83 => _83.id]);
2869
+ const activeChainId = activeChain?.id;
2870
2870
  if (activeChainId && chainId !== activeChainId) {
2871
2871
  throw new ChainMismatchError({
2872
- activeChain: _nullishCoalesce(_optionalChain([chains, 'access', _84 => _84.find, 'call', _85 => _85((x) => x.id === activeChainId), 'optionalAccess', _86 => _86.name]), () => ( `Chain ${activeChainId}`)),
2873
- targetChain: _nullishCoalesce(_optionalChain([chains, 'access', _87 => _87.find, 'call', _88 => _88((x) => x.id === chainId), 'optionalAccess', _89 => _89.name]), () => ( `Chain ${chainId}`))
2872
+ activeChain: chains.find((x) => x.id === activeChainId)?.name ?? `Chain ${activeChainId}`,
2873
+ targetChain: chains.find((x) => x.id === chainId)?.name ?? `Chain ${chainId}`
2874
2874
  });
2875
2875
  }
2876
2876
  }
2877
2877
 
2878
-
2879
-
2880
-
2881
-
2882
-
2883
-
2884
-
2885
-
2886
-
2887
-
2888
-
2889
-
2890
-
2891
-
2892
-
2893
-
2894
-
2895
-
2896
-
2897
-
2898
-
2899
-
2900
-
2901
-
2902
-
2903
-
2904
-
2905
-
2906
-
2907
-
2908
-
2909
-
2910
-
2911
-
2912
-
2913
-
2914
-
2915
-
2916
-
2917
-
2918
-
2919
-
2920
-
2921
-
2922
-
2923
-
2924
-
2925
-
2926
-
2927
-
2928
-
2929
-
2930
-
2931
-
2932
-
2933
-
2934
-
2935
-
2936
-
2937
-
2938
-
2939
- exports.configureChains = configureChains; exports.ChainMismatchError = ChainMismatchError; exports.ChainNotConfiguredError = ChainNotConfiguredError; exports.ConnectorAlreadyConnectedError = ConnectorAlreadyConnectedError; exports.ConfigChainsNotFound = ConfigChainsNotFound; exports.SwitchChainNotSupportedError = SwitchChainNotSupportedError; exports.ConnectorNotFoundError = _connectors.ConnectorNotFoundError; exports.deepEqual = deepEqual; exports.deserialize = deserialize; exports.getCallParameters = getCallParameters; exports.getSendTransactionParameters = getSendTransactionParameters; exports.getUnit = getUnit; exports.serialize = serialize; exports.noopStorage = noopStorage; exports.createStorage = createStorage; exports.Config = Config; exports.createConfig = createConfig; exports.getConfig = getConfig; exports.connect = connect; exports.disconnect = disconnect; exports.erc20ABI = erc20ABI; exports.erc721ABI = erc721ABI; exports.erc4626ABI = erc4626ABI; exports.fetchToken = fetchToken; exports.getPublicClient = getPublicClient; exports.getWalletClient = getWalletClient; exports.getWebSocketPublicClient = getWebSocketPublicClient; exports.watchPublicClient = watchPublicClient; exports.watchWalletClient = watchWalletClient; exports.watchWebSocketPublicClient = watchWebSocketPublicClient; exports.prepareWriteContract = prepareWriteContract; exports.getContract = getContract; exports.multicall = multicall; exports.readContract = readContract; exports.readContracts = readContracts; exports.watchContractEvent = watchContractEvent; exports.watchBlockNumber = watchBlockNumber; exports.watchMulticall = watchMulticall; exports.watchReadContract = watchReadContract; exports.watchReadContracts = watchReadContracts; exports.writeContract = writeContract; exports.fetchBalance = fetchBalance; exports.getAccount = getAccount; exports.getNetwork = getNetwork; exports.signMessage = signMessage; exports.signTypedData = signTypedData; exports.switchNetwork = switchNetwork; exports.watchAccount = watchAccount; exports.watchNetwork = watchNetwork; exports.fetchEnsAddress = fetchEnsAddress; exports.fetchEnsAvatar = fetchEnsAvatar; exports.fetchEnsName = fetchEnsName; exports.fetchEnsResolver = fetchEnsResolver; exports.fetchBlockNumber = fetchBlockNumber; exports.fetchFeeData = fetchFeeData; exports.fetchTransaction = fetchTransaction; exports.prepareSendTransaction = prepareSendTransaction; exports.sendTransaction = sendTransaction; exports.waitForTransaction = waitForTransaction; exports.watchPendingTransactions = watchPendingTransactions;
2878
+ export {
2879
+ configureChains,
2880
+ ChainMismatchError,
2881
+ ChainNotConfiguredError,
2882
+ ConnectorAlreadyConnectedError,
2883
+ ConfigChainsNotFound,
2884
+ SwitchChainNotSupportedError,
2885
+ ConnectorNotFoundError,
2886
+ deepEqual,
2887
+ deserialize,
2888
+ getCallParameters,
2889
+ getSendTransactionParameters,
2890
+ getUnit,
2891
+ serialize,
2892
+ noopStorage,
2893
+ createStorage,
2894
+ Config,
2895
+ createConfig,
2896
+ getConfig,
2897
+ connect,
2898
+ disconnect,
2899
+ erc20ABI,
2900
+ erc721ABI,
2901
+ erc4626ABI,
2902
+ fetchToken,
2903
+ getPublicClient,
2904
+ getWalletClient,
2905
+ getWebSocketPublicClient,
2906
+ watchPublicClient,
2907
+ watchWalletClient,
2908
+ watchWebSocketPublicClient,
2909
+ prepareWriteContract,
2910
+ getContract,
2911
+ multicall,
2912
+ readContract,
2913
+ readContracts,
2914
+ watchContractEvent,
2915
+ watchBlockNumber,
2916
+ watchMulticall,
2917
+ watchReadContract,
2918
+ watchReadContracts,
2919
+ writeContract,
2920
+ fetchBalance,
2921
+ getAccount,
2922
+ getNetwork,
2923
+ signMessage,
2924
+ signTypedData,
2925
+ switchNetwork,
2926
+ watchAccount,
2927
+ watchNetwork,
2928
+ fetchEnsAddress,
2929
+ fetchEnsAvatar,
2930
+ fetchEnsName,
2931
+ fetchEnsResolver,
2932
+ fetchBlockNumber,
2933
+ fetchFeeData,
2934
+ fetchTransaction,
2935
+ prepareSendTransaction,
2936
+ sendTransaction,
2937
+ waitForTransaction,
2938
+ watchPendingTransactions
2939
+ };