@wagmi/core 1.0.3 → 1.0.4-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.
@@ -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 { createPublicClient, fallback, http, webSocket } from "viem";
12
+ var _viem = require('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 = chains.find((x) => x.id === chainId) ?? defaultChains[0];
61
+ const activeChain = _nullishCoalesce(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 = createPublicClient({
65
+ const publicClient = _viem.createPublicClient.call(void 0, {
66
66
  batch,
67
67
  chain: activeChain,
68
- transport: fallback(
69
- chainHttpUrls.map((url) => http(url, { timeout: stallTimeout })),
68
+ transport: _viem.fallback.call(void 0,
69
+ chainHttpUrls.map((url) => _viem.http.call(void 0, 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 = chains.find((x) => x.id === chainId) ?? defaultChains[0];
79
+ const activeChain = _nullishCoalesce(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 = createPublicClient({
83
+ const publicClient = _viem.createPublicClient.call(void 0, {
84
84
  batch,
85
85
  chain: activeChain,
86
- transport: fallback(
87
- chainWsUrls.map((url) => webSocket(url, { timeout: stallTimeout })),
86
+ transport: _viem.fallback.call(void 0,
87
+ chainWsUrls.map((url) => _viem.webSocket.call(void 0, 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
- import { ConnectorNotFoundError } from "@wagmi/connectors";
100
+ var _connectors = require('@wagmi/connectors');
101
101
  var ChainMismatchError = class extends Error {
102
102
  constructor({
103
103
  activeChain,
@@ -245,13 +245,13 @@ function getSendTransactionParameters(args) {
245
245
  }
246
246
 
247
247
  // src/utils/getUnit.ts
248
- import { weiUnits } from "viem";
248
+
249
249
  function getUnit(unit) {
250
250
  if (typeof unit === "number")
251
251
  return unit;
252
252
  if (unit === "wei")
253
253
  return 0;
254
- return Math.abs(weiUnits[unit]);
254
+ return Math.abs(_viem.weiUnits[unit]);
255
255
  }
256
256
 
257
257
  // src/utils/serialize.ts
@@ -305,15 +305,15 @@ function serialize(value, replacer, indent, circularReplacer) {
305
305
  value,
306
306
  createReplacer((key, value_) => {
307
307
  const value2 = typeof value_ === "bigint" ? `#bigint.${value_.toString()}` : value_;
308
- return replacer?.(key, value2) || value2;
308
+ return _optionalChain([replacer, 'optionalCall', _ => _(key, value2)]) || value2;
309
309
  }, circularReplacer),
310
- indent ?? void 0
310
+ _nullishCoalesce(indent, () => ( void 0))
311
311
  );
312
312
  }
313
313
 
314
314
  // src/config.ts
315
- import { persist, subscribeWithSelector } from "zustand/middleware";
316
- import { createStore } from "zustand/vanilla";
315
+ var _middleware = require('zustand/middleware');
316
+ var _vanilla = require('zustand/vanilla');
317
317
 
318
318
  // src/storage.ts
319
319
  var noopStorage = {
@@ -359,7 +359,7 @@ var _isAutoConnecting, _lastUsedConnector, _addEffects, addEffects_fn;
359
359
  var Config = class {
360
360
  constructor({
361
361
  autoConnect = false,
362
- connectors = [new InjectedConnector()],
362
+ connectors = [new (0, _chunkBVC4KGLQjs.InjectedConnector)()],
363
363
  publicClient,
364
364
  storage = createStorage({
365
365
  storage: typeof window !== "undefined" ? window.localStorage : noopStorage
@@ -369,11 +369,11 @@ var Config = class {
369
369
  },
370
370
  webSocketPublicClient
371
371
  }) {
372
- __privateAdd(this, _addEffects);
372
+ _chunkMQXBDTVKjs.__privateAdd.call(void 0, this, _addEffects);
373
373
  this.publicClients = /* @__PURE__ */ new Map();
374
374
  this.webSocketPublicClients = /* @__PURE__ */ new Map();
375
- __privateAdd(this, _isAutoConnecting, void 0);
376
- __privateAdd(this, _lastUsedConnector, void 0);
375
+ _chunkMQXBDTVKjs.__privateAdd.call(void 0, this, _isAutoConnecting, void 0);
376
+ _chunkMQXBDTVKjs.__privateAdd.call(void 0, this, _lastUsedConnector, void 0);
377
377
  this.args = {
378
378
  autoConnect,
379
379
  connectors,
@@ -387,17 +387,17 @@ var Config = class {
387
387
  if (autoConnect) {
388
388
  try {
389
389
  const rawState = storage.getItem(storeKey);
390
- const data = rawState?.state?.data;
391
- status = data?.account ? "reconnecting" : "connecting";
392
- chainId = data?.chain?.id;
390
+ const data = _optionalChain([rawState, 'optionalAccess', _2 => _2.state, 'optionalAccess', _3 => _3.data]);
391
+ status = _optionalChain([data, 'optionalAccess', _4 => _4.account]) ? "reconnecting" : "connecting";
392
+ chainId = _optionalChain([data, 'optionalAccess', _5 => _5.chain, 'optionalAccess', _6 => _6.id]);
393
393
  } catch (_error) {
394
394
  }
395
395
  }
396
396
  const connectors_ = typeof connectors === "function" ? connectors() : connectors;
397
397
  connectors_.forEach((connector) => connector.setStorage(storage));
398
- this.store = createStore(
399
- subscribeWithSelector(
400
- persist(
398
+ this.store = _vanilla.createStore.call(void 0,
399
+ _middleware.subscribeWithSelector.call(void 0,
400
+ _middleware.persist.call(void 0,
401
401
  () => ({
402
402
  connectors: connectors_,
403
403
  publicClient: this.getPublicClient({ chainId }),
@@ -410,11 +410,11 @@ var Config = class {
410
410
  partialize: (state) => ({
411
411
  ...autoConnect && {
412
412
  data: {
413
- account: state?.data?.account,
414
- chain: state?.data?.chain
413
+ account: _optionalChain([state, 'optionalAccess', _7 => _7.data, 'optionalAccess', _8 => _8.account]),
414
+ chain: _optionalChain([state, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.chain])
415
415
  }
416
416
  },
417
- chains: state?.chains
417
+ chains: _optionalChain([state, 'optionalAccess', _11 => _11.chains])
418
418
  }),
419
419
  version: 2
420
420
  }
@@ -422,8 +422,8 @@ var Config = class {
422
422
  )
423
423
  );
424
424
  this.storage = storage;
425
- __privateSet(this, _lastUsedConnector, storage?.getItem("wallet"));
426
- __privateMethod(this, _addEffects, addEffects_fn).call(this);
425
+ _chunkMQXBDTVKjs.__privateSet.call(void 0, this, _lastUsedConnector, _optionalChain([storage, 'optionalAccess', _12 => _12.getItem, 'call', _13 => _13("wallet")]));
426
+ _chunkMQXBDTVKjs.__privateMethod.call(void 0, this, _addEffects, addEffects_fn).call(this);
427
427
  if (autoConnect && typeof window !== "undefined")
428
428
  setTimeout(async () => await this.autoConnect(), 0);
429
429
  }
@@ -443,7 +443,7 @@ var Config = class {
443
443
  return this.store.getState().error;
444
444
  }
445
445
  get lastUsedChainId() {
446
- return this.data?.chain?.id;
446
+ return _optionalChain([this, 'access', _14 => _14.data, 'optionalAccess', _15 => _15.chain, 'optionalAccess', _16 => _16.id]);
447
447
  }
448
448
  get publicClient() {
449
449
  return this.store.getState().publicClient;
@@ -473,21 +473,21 @@ var Config = class {
473
473
  }
474
474
  async destroy() {
475
475
  if (this.connector)
476
- await this.connector.disconnect?.();
477
- __privateSet(this, _isAutoConnecting, false);
476
+ await _optionalChain([this, 'access', _17 => _17.connector, 'access', _18 => _18.disconnect, 'optionalCall', _19 => _19()]);
477
+ _chunkMQXBDTVKjs.__privateSet.call(void 0, this, _isAutoConnecting, false);
478
478
  this.clearState();
479
479
  this.store.destroy();
480
480
  }
481
481
  async autoConnect() {
482
- if (__privateGet(this, _isAutoConnecting))
482
+ if (_chunkMQXBDTVKjs.__privateGet.call(void 0, this, _isAutoConnecting))
483
483
  return;
484
- __privateSet(this, _isAutoConnecting, true);
484
+ _chunkMQXBDTVKjs.__privateSet.call(void 0, this, _isAutoConnecting, true);
485
485
  this.setState((x) => ({
486
486
  ...x,
487
- status: x.data?.account ? "reconnecting" : "connecting"
487
+ status: _optionalChain([x, 'access', _20 => _20.data, 'optionalAccess', _21 => _21.account]) ? "reconnecting" : "connecting"
488
488
  }));
489
- const sorted = __privateGet(this, _lastUsedConnector) ? [...this.connectors].sort(
490
- (x) => x.id === __privateGet(this, _lastUsedConnector) ? -1 : 1
489
+ const sorted = _chunkMQXBDTVKjs.__privateGet.call(void 0, this, _lastUsedConnector) ? [...this.connectors].sort(
490
+ (x) => x.id === _chunkMQXBDTVKjs.__privateGet.call(void 0, this, _lastUsedConnector) ? -1 : 1
491
491
  ) : this.connectors;
492
492
  let connected = false;
493
493
  for (const connector of sorted) {
@@ -500,7 +500,7 @@ var Config = class {
500
500
  this.setState((x) => ({
501
501
  ...x,
502
502
  connector,
503
- chains: connector?.chains,
503
+ chains: _optionalChain([connector, 'optionalAccess', _22 => _22.chains]),
504
504
  data,
505
505
  status: "connected"
506
506
  }));
@@ -513,7 +513,7 @@ var Config = class {
513
513
  data: void 0,
514
514
  status: "disconnected"
515
515
  }));
516
- __privateSet(this, _isAutoConnecting, false);
516
+ _chunkMQXBDTVKjs.__privateSet.call(void 0, this, _isAutoConnecting, false);
517
517
  return this.data;
518
518
  }
519
519
  setConnectors(connectors) {
@@ -530,18 +530,18 @@ var Config = class {
530
530
  }
531
531
  getPublicClient({ chainId } = {}) {
532
532
  let publicClient_ = this.publicClients.get(-1);
533
- if (publicClient_ && publicClient_?.chain.id === chainId)
533
+ if (publicClient_ && _optionalChain([publicClient_, 'optionalAccess', _23 => _23.chain, 'access', _24 => _24.id]) === chainId)
534
534
  return publicClient_;
535
- publicClient_ = this.publicClients.get(chainId ?? -1);
535
+ publicClient_ = this.publicClients.get(_nullishCoalesce(chainId, () => ( -1)));
536
536
  if (publicClient_)
537
537
  return publicClient_;
538
538
  const { publicClient } = this.args;
539
539
  publicClient_ = typeof publicClient === "function" ? publicClient({ chainId }) : publicClient;
540
- this.publicClients.set(chainId ?? -1, publicClient_);
540
+ this.publicClients.set(_nullishCoalesce(chainId, () => ( -1)), publicClient_);
541
541
  return publicClient_;
542
542
  }
543
543
  setPublicClient(publicClient) {
544
- const chainId = this.data?.chain?.id;
544
+ const chainId = _optionalChain([this, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.chain, 'optionalAccess', _27 => _27.id]);
545
545
  this.args = {
546
546
  ...this.args,
547
547
  publicClient
@@ -554,19 +554,19 @@ var Config = class {
554
554
  }
555
555
  getWebSocketPublicClient({ chainId } = {}) {
556
556
  let webSocketPublicClient_ = this.webSocketPublicClients.get(-1);
557
- if (webSocketPublicClient_ && webSocketPublicClient_?.chain.id === chainId)
557
+ if (webSocketPublicClient_ && _optionalChain([webSocketPublicClient_, 'optionalAccess', _28 => _28.chain, 'access', _29 => _29.id]) === chainId)
558
558
  return webSocketPublicClient_;
559
- webSocketPublicClient_ = this.webSocketPublicClients.get(chainId ?? -1);
559
+ webSocketPublicClient_ = this.webSocketPublicClients.get(_nullishCoalesce(chainId, () => ( -1)));
560
560
  if (webSocketPublicClient_)
561
561
  return webSocketPublicClient_;
562
562
  const { webSocketPublicClient } = this.args;
563
563
  webSocketPublicClient_ = typeof webSocketPublicClient === "function" ? webSocketPublicClient({ chainId }) : webSocketPublicClient;
564
564
  if (webSocketPublicClient_)
565
- this.webSocketPublicClients.set(chainId ?? -1, webSocketPublicClient_);
565
+ this.webSocketPublicClients.set(_nullishCoalesce(chainId, () => ( -1)), webSocketPublicClient_);
566
566
  return webSocketPublicClient_;
567
567
  }
568
568
  setWebSocketPublicClient(webSocketPublicClient) {
569
- const chainId = this.data?.chain?.id;
569
+ const chainId = _optionalChain([this, 'access', _30 => _30.data, 'optionalAccess', _31 => _31.chain, 'optionalAccess', _32 => _32.id]);
570
570
  this.args = {
571
571
  ...this.args,
572
572
  webSocketPublicClient
@@ -580,7 +580,7 @@ var Config = class {
580
580
  }));
581
581
  }
582
582
  setLastUsedConnector(lastUsedConnector = null) {
583
- this.storage?.setItem("wallet", lastUsedConnector);
583
+ _optionalChain([this, 'access', _33 => _33.storage, 'optionalAccess', _34 => _34.setItem, 'call', _35 => _35("wallet", lastUsedConnector)]);
584
584
  }
585
585
  };
586
586
  _isAutoConnecting = new WeakMap();
@@ -602,14 +602,14 @@ addEffects_fn = function() {
602
602
  this.store.subscribe(
603
603
  ({ connector }) => connector,
604
604
  (connector, prevConnector) => {
605
- prevConnector?.off?.("change", onChange);
606
- prevConnector?.off?.("disconnect", onDisconnect);
607
- prevConnector?.off?.("error", onError);
605
+ _optionalChain([prevConnector, 'optionalAccess', _36 => _36.off, 'optionalCall', _37 => _37("change", onChange)]);
606
+ _optionalChain([prevConnector, 'optionalAccess', _38 => _38.off, 'optionalCall', _39 => _39("disconnect", onDisconnect)]);
607
+ _optionalChain([prevConnector, 'optionalAccess', _40 => _40.off, 'optionalCall', _41 => _41("error", onError)]);
608
608
  if (!connector)
609
609
  return;
610
- connector.on?.("change", onChange);
611
- connector.on?.("disconnect", onDisconnect);
612
- connector.on?.("error", onError);
610
+ _optionalChain([connector, 'access', _42 => _42.on, 'optionalCall', _43 => _43("change", onChange)]);
611
+ _optionalChain([connector, 'access', _44 => _44.on, 'optionalCall', _45 => _45("disconnect", onDisconnect)]);
612
+ _optionalChain([connector, 'access', _46 => _46.on, 'optionalCall', _47 => _47("error", onError)]);
613
613
  }
614
614
  );
615
615
  const { publicClient, webSocketPublicClient } = this.args;
@@ -617,7 +617,7 @@ addEffects_fn = function() {
617
617
  const subscribeWebSocketPublicClient = typeof webSocketPublicClient === "function";
618
618
  if (subscribePublicClient || subscribeWebSocketPublicClient)
619
619
  this.store.subscribe(
620
- ({ data }) => data?.chain?.id,
620
+ ({ data }) => _optionalChain([data, 'optionalAccess', _48 => _48.chain, 'optionalAccess', _49 => _49.id]),
621
621
  (chainId) => {
622
622
  this.setState((x) => ({
623
623
  ...x,
@@ -657,7 +657,7 @@ async function connect({ chainId, connector }) {
657
657
  config2.setState((x) => ({
658
658
  ...x,
659
659
  connector,
660
- chains: connector?.chains,
660
+ chains: _optionalChain([connector, 'optionalAccess', _50 => _50.chains]),
661
661
  data,
662
662
  status: "connected"
663
663
  }));
@@ -684,12 +684,12 @@ async function disconnect() {
684
684
  }
685
685
 
686
686
  // src/actions/accounts/fetchBalance.ts
687
- import {
688
- ContractFunctionExecutionError as ContractFunctionExecutionError3,
689
- formatUnits as formatUnits2,
690
- hexToString as hexToString2,
691
- trim as trim2
692
- } from "viem";
687
+
688
+
689
+
690
+
691
+
692
+
693
693
 
694
694
  // src/constants/abis.ts
695
695
  var erc20ABI = [
@@ -1920,12 +1920,12 @@ var erc4626ABI = [
1920
1920
  ];
1921
1921
 
1922
1922
  // src/actions/contracts/fetchToken.ts
1923
- import {
1924
- ContractFunctionExecutionError,
1925
- formatUnits,
1926
- hexToString,
1927
- trim
1928
- } from "viem";
1923
+
1924
+
1925
+
1926
+
1927
+
1928
+
1929
1929
  async function fetchToken({
1930
1930
  address,
1931
1931
  chainId,
@@ -1948,7 +1948,7 @@ async function fetchToken({
1948
1948
  name,
1949
1949
  symbol,
1950
1950
  totalSupply: {
1951
- formatted: formatUnits(totalSupply, getUnit(unit)),
1951
+ formatted: _viem.formatUnits.call(void 0, totalSupply, getUnit(unit)),
1952
1952
  value: totalSupply
1953
1953
  }
1954
1954
  };
@@ -1956,13 +1956,13 @@ async function fetchToken({
1956
1956
  try {
1957
1957
  return await fetchToken_({ abi: erc20ABI });
1958
1958
  } catch (err) {
1959
- if (err instanceof ContractFunctionExecutionError) {
1959
+ if (err instanceof _viem.ContractFunctionExecutionError) {
1960
1960
  const { name, symbol, ...rest } = await fetchToken_({
1961
1961
  abi: erc20ABI_bytes32
1962
1962
  });
1963
1963
  return {
1964
- name: hexToString(trim(name, { dir: "right" })),
1965
- symbol: hexToString(trim(symbol, { dir: "right" })),
1964
+ name: _viem.hexToString.call(void 0, _viem.trim.call(void 0, name, { dir: "right" })),
1965
+ symbol: _viem.hexToString.call(void 0, _viem.trim.call(void 0, symbol, { dir: "right" })),
1966
1966
  ...rest
1967
1967
  };
1968
1968
  }
@@ -1983,7 +1983,7 @@ async function getWalletClient({
1983
1983
  chainId
1984
1984
  } = {}) {
1985
1985
  const config2 = getConfig();
1986
- const walletClient = await config2.connector?.getWalletClient?.({ chainId }) || null;
1986
+ const walletClient = await _optionalChain([config2, 'access', _51 => _51.connector, 'optionalAccess', _52 => _52.getWalletClient, 'optionalCall', _53 => _53({ chainId })]) || null;
1987
1987
  return walletClient;
1988
1988
  }
1989
1989
 
@@ -2009,7 +2009,7 @@ function watchPublicClient(args, callback) {
2009
2009
  }
2010
2010
 
2011
2011
  // src/actions/viem/watchWalletClient.ts
2012
- import { shallow } from "zustand/shallow";
2012
+ var _shallow = require('zustand/shallow');
2013
2013
  function watchWalletClient({ chainId }, callback) {
2014
2014
  const config2 = getConfig();
2015
2015
  const handleChange = async ({ chainId: chainId_ }) => {
@@ -2022,13 +2022,13 @@ function watchWalletClient({ chainId }, callback) {
2022
2022
  };
2023
2023
  const unsubscribe = config2.subscribe(
2024
2024
  ({ data, connector }) => ({
2025
- account: data?.account,
2026
- chainId: data?.chain?.id,
2025
+ account: _optionalChain([data, 'optionalAccess', _54 => _54.account]),
2026
+ chainId: _optionalChain([data, 'optionalAccess', _55 => _55.chain, 'optionalAccess', _56 => _56.id]),
2027
2027
  connector
2028
2028
  }),
2029
2029
  handleChange,
2030
2030
  {
2031
- equalityFn: shallow
2031
+ equalityFn: _shallow.shallow
2032
2032
  }
2033
2033
  );
2034
2034
  return unsubscribe;
@@ -2056,9 +2056,9 @@ async function prepareWriteContract({
2056
2056
  ...config2
2057
2057
  }) {
2058
2058
  const publicClient = getPublicClient({ chainId });
2059
- const walletClient = walletClient_ ?? await getWalletClient({ chainId });
2059
+ const walletClient = await _asyncNullishCoalesce(walletClient_, async () => ( await getWalletClient({ chainId })));
2060
2060
  if (!walletClient)
2061
- throw new ConnectorNotFoundError();
2061
+ throw new (0, _connectors.ConnectorNotFoundError)();
2062
2062
  if (chainId)
2063
2063
  assertActiveChain({ chainId });
2064
2064
  const {
@@ -2103,7 +2103,7 @@ async function prepareWriteContract({
2103
2103
  }
2104
2104
 
2105
2105
  // src/actions/contracts/getContract.ts
2106
- import { getContract as getContract_ } from "viem";
2106
+
2107
2107
  function getContract({
2108
2108
  address,
2109
2109
  abi,
@@ -2111,7 +2111,7 @@ function getContract({
2111
2111
  walletClient
2112
2112
  }) {
2113
2113
  const publicClient = getPublicClient({ chainId });
2114
- return getContract_({
2114
+ return _viem.getContract.call(void 0, {
2115
2115
  address,
2116
2116
  abi,
2117
2117
  publicClient,
@@ -2133,7 +2133,7 @@ async function multicall({
2133
2133
  if (chainId && publicClient.chain.id !== chainId)
2134
2134
  throw new ChainNotConfiguredError({ chainId });
2135
2135
  return publicClient.multicall({
2136
- allowFailure: args.allowFailure ?? true,
2136
+ allowFailure: _nullishCoalesce(args.allowFailure, () => ( true)),
2137
2137
  blockNumber,
2138
2138
  blockTag,
2139
2139
  contracts
@@ -2162,7 +2162,7 @@ async function readContract({
2162
2162
  }
2163
2163
 
2164
2164
  // src/actions/contracts/readContracts.ts
2165
- import { ContractFunctionExecutionError as ContractFunctionExecutionError2 } from "viem";
2165
+
2166
2166
  async function readContracts({
2167
2167
  contracts,
2168
2168
  blockNumber,
@@ -2173,7 +2173,7 @@ async function readContracts({
2173
2173
  try {
2174
2174
  const publicClient = getPublicClient();
2175
2175
  const contractsByChainId = contracts.reduce((contracts2, contract, index) => {
2176
- const chainId = contract.chainId ?? publicClient.chain.id;
2176
+ const chainId = _nullishCoalesce(contract.chainId, () => ( publicClient.chain.id));
2177
2177
  return {
2178
2178
  ...contracts2,
2179
2179
  [chainId]: [...contracts2[chainId] || [], { contract, index }]
@@ -2200,7 +2200,7 @@ async function readContracts({
2200
2200
  return results;
2201
2201
  }, []);
2202
2202
  } catch (err) {
2203
- if (err instanceof ContractFunctionExecutionError2)
2203
+ if (err instanceof _viem.ContractFunctionExecutionError)
2204
2204
  throw err;
2205
2205
  const promises = () => contracts.map(
2206
2206
  (contract) => readContract({ ...contract, blockNumber, blockTag })
@@ -2216,7 +2216,7 @@ async function readContracts({
2216
2216
  }
2217
2217
 
2218
2218
  // src/actions/contracts/watchContractEvent.ts
2219
- import { shallow as shallow2 } from "zustand/shallow";
2219
+
2220
2220
  function watchContractEvent({
2221
2221
  address,
2222
2222
  abi,
@@ -2243,16 +2243,16 @@ function watchContractEvent({
2243
2243
  webSocketPublicClient
2244
2244
  }),
2245
2245
  watchEvent,
2246
- { equalityFn: shallow2 }
2246
+ { equalityFn: _shallow.shallow }
2247
2247
  );
2248
2248
  return () => {
2249
- unwatch?.();
2249
+ _optionalChain([unwatch, 'optionalCall', _57 => _57()]);
2250
2250
  unsubscribe();
2251
2251
  };
2252
2252
  }
2253
2253
 
2254
2254
  // src/actions/network-status/watchBlockNumber.ts
2255
- import { shallow as shallow3 } from "zustand/shallow";
2255
+
2256
2256
  function watchBlockNumber(args, callback) {
2257
2257
  let unwatch;
2258
2258
  const createListener = (publicClient) => {
@@ -2264,7 +2264,7 @@ function watchBlockNumber(args, callback) {
2264
2264
  poll: true
2265
2265
  });
2266
2266
  };
2267
- const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });
2267
+ const publicClient_ = _nullishCoalesce(getWebSocketPublicClient({ chainId: args.chainId }), () => ( getPublicClient({ chainId: args.chainId })));
2268
2268
  if (args.listen)
2269
2269
  createListener(publicClient_);
2270
2270
  const config2 = getConfig();
@@ -2274,18 +2274,18 @@ function watchBlockNumber(args, callback) {
2274
2274
  webSocketPublicClient
2275
2275
  }),
2276
2276
  async ({ publicClient, webSocketPublicClient }) => {
2277
- const publicClient_2 = webSocketPublicClient ?? publicClient;
2277
+ const publicClient_2 = _nullishCoalesce(webSocketPublicClient, () => ( publicClient));
2278
2278
  if (args.listen && !args.chainId && publicClient_2) {
2279
2279
  createListener(publicClient_2);
2280
2280
  }
2281
2281
  },
2282
2282
  {
2283
- equalityFn: shallow3
2283
+ equalityFn: _shallow.shallow
2284
2284
  }
2285
2285
  );
2286
2286
  return () => {
2287
2287
  unsubscribe();
2288
- unwatch?.();
2288
+ _optionalChain([unwatch, 'optionalCall', _58 => _58()]);
2289
2289
  };
2290
2290
  }
2291
2291
 
@@ -2300,7 +2300,7 @@ function watchMulticall(args, callback) {
2300
2300
  );
2301
2301
  return () => {
2302
2302
  unsubscribe();
2303
- unwatch?.();
2303
+ _optionalChain([unwatch, 'optionalCall', _59 => _59()]);
2304
2304
  };
2305
2305
  }
2306
2306
 
@@ -2315,7 +2315,7 @@ function watchReadContract(args, callback) {
2315
2315
  );
2316
2316
  return () => {
2317
2317
  unsubscribe();
2318
- unwatch?.();
2318
+ _optionalChain([unwatch, 'optionalCall', _60 => _60()]);
2319
2319
  };
2320
2320
  }
2321
2321
 
@@ -2330,7 +2330,7 @@ function watchReadContracts(args, callback) {
2330
2330
  );
2331
2331
  return () => {
2332
2332
  unsubscribe();
2333
- unwatch?.();
2333
+ _optionalChain([unwatch, 'optionalCall', _61 => _61()]);
2334
2334
  };
2335
2335
  }
2336
2336
 
@@ -2338,7 +2338,7 @@ function watchReadContracts(args, callback) {
2338
2338
  async function writeContract(config2) {
2339
2339
  const walletClient = await getWalletClient({ chainId: config2.chainId });
2340
2340
  if (!walletClient)
2341
- throw new ConnectorNotFoundError();
2341
+ throw new (0, _connectors.ConnectorNotFoundError)();
2342
2342
  if (config2.chainId)
2343
2343
  assertActiveChain({ chainId: config2.chainId });
2344
2344
  let request;
@@ -2382,7 +2382,7 @@ async function fetchBalance({
2382
2382
  });
2383
2383
  return {
2384
2384
  decimals,
2385
- formatted: formatUnits2(value2 ?? "0", getUnit(unit ?? decimals)),
2385
+ formatted: _viem.formatUnits.call(void 0, _nullishCoalesce(value2, () => ( "0")), getUnit(_nullishCoalesce(unit, () => ( decimals)))),
2386
2386
  symbol,
2387
2387
  value: value2
2388
2388
  };
@@ -2390,12 +2390,12 @@ async function fetchBalance({
2390
2390
  try {
2391
2391
  return await fetchContractBalance({ abi: erc20ABI });
2392
2392
  } catch (err) {
2393
- if (err instanceof ContractFunctionExecutionError3) {
2393
+ if (err instanceof _viem.ContractFunctionExecutionError) {
2394
2394
  const { symbol, ...rest } = await fetchContractBalance({
2395
2395
  abi: erc20ABI_bytes32
2396
2396
  });
2397
2397
  return {
2398
- symbol: hexToString2(trim2(symbol, { dir: "right" })),
2398
+ symbol: _viem.hexToString.call(void 0, _viem.trim.call(void 0, symbol, { dir: "right" })),
2399
2399
  ...rest
2400
2400
  };
2401
2401
  }
@@ -2404,14 +2404,14 @@ async function fetchBalance({
2404
2404
  }
2405
2405
  const chains = [
2406
2406
  ...config2.publicClient.chains || [],
2407
- ...config2.chains ?? []
2407
+ ..._nullishCoalesce(config2.chains, () => ( []))
2408
2408
  ];
2409
2409
  const value = await publicClient.getBalance({ address });
2410
2410
  const chain = chains.find((x) => x.id === publicClient.chain.id);
2411
2411
  return {
2412
- decimals: chain?.nativeCurrency.decimals ?? 18,
2413
- formatted: formatUnits2(value ?? "0", getUnit(unit ?? 18)),
2414
- symbol: chain?.nativeCurrency.symbol ?? "ETH",
2412
+ decimals: _nullishCoalesce(_optionalChain([chain, 'optionalAccess', _62 => _62.nativeCurrency, 'access', _63 => _63.decimals]), () => ( 18)),
2413
+ formatted: _viem.formatUnits.call(void 0, _nullishCoalesce(value, () => ( "0")), getUnit(_nullishCoalesce(unit, () => ( 18)))),
2414
+ symbol: _nullishCoalesce(_optionalChain([chain, 'optionalAccess', _64 => _64.nativeCurrency, 'access', _65 => _65.symbol]), () => ( "ETH")),
2415
2415
  value
2416
2416
  };
2417
2417
  }
@@ -2422,7 +2422,7 @@ function getAccount() {
2422
2422
  switch (status) {
2423
2423
  case "connected":
2424
2424
  return {
2425
- address: data?.account,
2425
+ address: _optionalChain([data, 'optionalAccess', _66 => _66.account]),
2426
2426
  connector,
2427
2427
  isConnected: true,
2428
2428
  isConnecting: false,
@@ -2432,9 +2432,9 @@ function getAccount() {
2432
2432
  };
2433
2433
  case "reconnecting":
2434
2434
  return {
2435
- address: data?.account,
2435
+ address: _optionalChain([data, 'optionalAccess', _67 => _67.account]),
2436
2436
  connector,
2437
- isConnected: !!data?.account,
2437
+ isConnected: !!_optionalChain([data, 'optionalAccess', _68 => _68.account]),
2438
2438
  isConnecting: false,
2439
2439
  isDisconnected: false,
2440
2440
  isReconnecting: true,
@@ -2442,7 +2442,7 @@ function getAccount() {
2442
2442
  };
2443
2443
  case "connecting":
2444
2444
  return {
2445
- address: data?.account,
2445
+ address: _optionalChain([data, 'optionalAccess', _69 => _69.account]),
2446
2446
  connector,
2447
2447
  isConnected: false,
2448
2448
  isConnecting: true,
@@ -2466,12 +2466,12 @@ function getAccount() {
2466
2466
  // src/actions/accounts/getNetwork.ts
2467
2467
  function getNetwork() {
2468
2468
  const config2 = getConfig();
2469
- const chainId = config2.data?.chain?.id;
2470
- const activeChains = config2.chains ?? [];
2471
- const activeChain = [
2472
- ...config2.publicClient?.chains || [],
2469
+ const chainId = _optionalChain([config2, 'access', _70 => _70.data, 'optionalAccess', _71 => _71.chain, 'optionalAccess', _72 => _72.id]);
2470
+ const activeChains = _nullishCoalesce(config2.chains, () => ( []));
2471
+ const activeChain = _nullishCoalesce([
2472
+ ..._optionalChain([config2, 'access', _73 => _73.publicClient, 'optionalAccess', _74 => _74.chains]) || [],
2473
2473
  ...activeChains
2474
- ].find((x) => x.id === chainId) ?? {
2474
+ ].find((x) => x.id === chainId), () => ( {
2475
2475
  id: chainId,
2476
2476
  name: `Chain ${chainId}`,
2477
2477
  network: `${chainId}`,
@@ -2480,11 +2480,11 @@ function getNetwork() {
2480
2480
  default: { http: [""] },
2481
2481
  public: { http: [""] }
2482
2482
  }
2483
- };
2483
+ }));
2484
2484
  return {
2485
2485
  chain: chainId ? {
2486
2486
  ...activeChain,
2487
- ...config2.data?.chain,
2487
+ ..._optionalChain([config2, 'access', _75 => _75.data, 'optionalAccess', _76 => _76.chain]),
2488
2488
  id: chainId
2489
2489
  } : void 0,
2490
2490
  chains: activeChains
@@ -2495,7 +2495,7 @@ function getNetwork() {
2495
2495
  async function signMessage(args) {
2496
2496
  const walletClient = await getWalletClient();
2497
2497
  if (!walletClient)
2498
- throw new ConnectorNotFoundError();
2498
+ throw new (0, _connectors.ConnectorNotFoundError)();
2499
2499
  return await walletClient.signMessage({
2500
2500
  message: args.message
2501
2501
  });
@@ -2510,7 +2510,7 @@ async function signTypedData({
2510
2510
  }) {
2511
2511
  const walletClient = await getWalletClient();
2512
2512
  if (!walletClient)
2513
- throw new ConnectorNotFoundError();
2513
+ throw new (0, _connectors.ConnectorNotFoundError)();
2514
2514
  const { chainId } = domain;
2515
2515
  if (chainId)
2516
2516
  assertActiveChain({ chainId });
@@ -2528,7 +2528,7 @@ async function switchNetwork({
2528
2528
  }) {
2529
2529
  const { connector } = getConfig();
2530
2530
  if (!connector)
2531
- throw new ConnectorNotFoundError();
2531
+ throw new (0, _connectors.ConnectorNotFoundError)();
2532
2532
  if (!connector.switchChain)
2533
2533
  throw new SwitchChainNotSupportedError({
2534
2534
  connector
@@ -2537,90 +2537,90 @@ async function switchNetwork({
2537
2537
  }
2538
2538
 
2539
2539
  // src/actions/accounts/watchAccount.ts
2540
- import { shallow as shallow4 } from "zustand/shallow";
2540
+
2541
2541
  function watchAccount(callback, { selector = (x) => x } = {}) {
2542
2542
  const config2 = getConfig();
2543
2543
  const handleChange = () => callback(getAccount());
2544
2544
  const unsubscribe = config2.subscribe(
2545
2545
  ({ data, connector, status }) => selector({
2546
- address: data?.account,
2546
+ address: _optionalChain([data, 'optionalAccess', _77 => _77.account]),
2547
2547
  connector,
2548
2548
  status
2549
2549
  }),
2550
2550
  handleChange,
2551
2551
  {
2552
- equalityFn: shallow4
2552
+ equalityFn: _shallow.shallow
2553
2553
  }
2554
2554
  );
2555
2555
  return unsubscribe;
2556
2556
  }
2557
2557
 
2558
2558
  // src/actions/accounts/watchNetwork.ts
2559
- import { shallow as shallow5 } from "zustand/shallow";
2559
+
2560
2560
  function watchNetwork(callback, { selector = (x) => x } = {}) {
2561
2561
  const config2 = getConfig();
2562
2562
  const handleChange = () => callback(getNetwork());
2563
2563
  const unsubscribe = config2.subscribe(
2564
- ({ data, chains }) => selector({ chainId: data?.chain?.id, chains }),
2564
+ ({ data, chains }) => selector({ chainId: _optionalChain([data, 'optionalAccess', _78 => _78.chain, 'optionalAccess', _79 => _79.id]), chains }),
2565
2565
  handleChange,
2566
2566
  {
2567
- equalityFn: shallow5
2567
+ equalityFn: _shallow.shallow
2568
2568
  }
2569
2569
  );
2570
2570
  return unsubscribe;
2571
2571
  }
2572
2572
 
2573
2573
  // src/actions/ens/fetchEnsAddress.ts
2574
- import { getAddress } from "viem";
2575
- import { normalize } from "viem/ens";
2574
+
2575
+ var _ens = require('viem/ens');
2576
2576
  async function fetchEnsAddress({
2577
2577
  chainId,
2578
2578
  name
2579
2579
  }) {
2580
2580
  const publicClient = getPublicClient({ chainId });
2581
2581
  const address = await publicClient.getEnsAddress({
2582
- name: normalize(name)
2582
+ name: _ens.normalize.call(void 0, name)
2583
2583
  });
2584
2584
  try {
2585
2585
  if (address === "0x0000000000000000000000000000000000000000")
2586
2586
  return null;
2587
- return address ? getAddress(address) : null;
2587
+ return address ? _viem.getAddress.call(void 0, address) : null;
2588
2588
  } catch (_error) {
2589
2589
  return null;
2590
2590
  }
2591
2591
  }
2592
2592
 
2593
2593
  // src/actions/ens/fetchEnsAvatar.ts
2594
- import { normalize as normalize2 } from "viem/ens";
2594
+
2595
2595
  async function fetchEnsAvatar({
2596
2596
  name,
2597
2597
  chainId
2598
2598
  }) {
2599
2599
  const publicClient = getPublicClient({ chainId });
2600
- const avatar = await publicClient.getEnsAvatar({ name: normalize2(name) });
2600
+ const avatar = await publicClient.getEnsAvatar({ name: _ens.normalize.call(void 0, name) });
2601
2601
  return avatar;
2602
2602
  }
2603
2603
 
2604
2604
  // src/actions/ens/fetchEnsName.ts
2605
- import { getAddress as getAddress2 } from "viem";
2605
+
2606
2606
  async function fetchEnsName({
2607
2607
  address,
2608
2608
  chainId
2609
2609
  }) {
2610
2610
  const publicClient = getPublicClient({ chainId });
2611
2611
  return publicClient.getEnsName({
2612
- address: getAddress2(address)
2612
+ address: _viem.getAddress.call(void 0, address)
2613
2613
  });
2614
2614
  }
2615
2615
 
2616
2616
  // src/actions/ens/fetchEnsResolver.ts
2617
- import { normalize as normalize3 } from "viem/ens";
2617
+
2618
2618
  async function fetchEnsResolver({
2619
2619
  chainId,
2620
2620
  name
2621
2621
  }) {
2622
2622
  const publicClient = getPublicClient({ chainId });
2623
- const resolver = await publicClient.getEnsResolver({ name: normalize3(name) });
2623
+ const resolver = await publicClient.getEnsResolver({ name: _ens.normalize.call(void 0, name) });
2624
2624
  return resolver;
2625
2625
  }
2626
2626
 
@@ -2634,7 +2634,7 @@ async function fetchBlockNumber({
2634
2634
  }
2635
2635
 
2636
2636
  // src/actions/network-status/fetchFeeData.ts
2637
- import { formatUnits as formatUnits3, parseGwei } from "viem";
2637
+
2638
2638
  async function fetchFeeData({
2639
2639
  chainId,
2640
2640
  formatUnits: units = "gwei"
@@ -2644,21 +2644,21 @@ async function fetchFeeData({
2644
2644
  let gasPrice = null;
2645
2645
  try {
2646
2646
  gasPrice = await publicClient.getGasPrice();
2647
- } catch {
2647
+ } catch (e) {
2648
2648
  }
2649
2649
  let lastBaseFeePerGas = null;
2650
2650
  let maxFeePerGas = null;
2651
2651
  let maxPriorityFeePerGas = null;
2652
- if (block?.baseFeePerGas) {
2652
+ if (_optionalChain([block, 'optionalAccess', _80 => _80.baseFeePerGas])) {
2653
2653
  lastBaseFeePerGas = block.baseFeePerGas;
2654
- maxPriorityFeePerGas = parseGwei("1");
2654
+ maxPriorityFeePerGas = _viem.parseGwei.call(void 0, "1");
2655
2655
  maxFeePerGas = block.baseFeePerGas * 2n + maxPriorityFeePerGas;
2656
2656
  }
2657
2657
  const unit = getUnit(units);
2658
2658
  const formatted = {
2659
- gasPrice: gasPrice ? formatUnits3(gasPrice, unit) : null,
2660
- maxFeePerGas: maxFeePerGas ? formatUnits3(maxFeePerGas, unit) : null,
2661
- maxPriorityFeePerGas: maxPriorityFeePerGas ? formatUnits3(maxPriorityFeePerGas, unit) : null
2659
+ gasPrice: gasPrice ? _viem.formatUnits.call(void 0, gasPrice, unit) : null,
2660
+ maxFeePerGas: maxFeePerGas ? _viem.formatUnits.call(void 0, maxFeePerGas, unit) : null,
2661
+ maxPriorityFeePerGas: maxPriorityFeePerGas ? _viem.formatUnits.call(void 0, maxPriorityFeePerGas, unit) : null
2662
2662
  };
2663
2663
  return {
2664
2664
  lastBaseFeePerGas,
@@ -2679,13 +2679,13 @@ async function fetchTransaction({
2679
2679
  }
2680
2680
 
2681
2681
  // src/actions/transactions/prepareSendTransaction.ts
2682
- import { isAddress } from "viem";
2682
+
2683
2683
  async function prepareSendTransaction({
2684
2684
  accessList,
2685
2685
  account,
2686
2686
  chainId,
2687
2687
  data,
2688
- gas,
2688
+ gas: gas_,
2689
2689
  gasPrice,
2690
2690
  maxFeePerGas,
2691
2691
  maxPriorityFeePerGas,
@@ -2694,14 +2694,27 @@ async function prepareSendTransaction({
2694
2694
  value,
2695
2695
  walletClient: walletClient_
2696
2696
  }) {
2697
- const walletClient = walletClient_ ?? await getWalletClient({ chainId });
2697
+ const publicClient = getPublicClient({ chainId });
2698
+ const walletClient = await _asyncNullishCoalesce(walletClient_, async () => ( await getWalletClient({ chainId })));
2698
2699
  if (!walletClient)
2699
- throw new ConnectorNotFoundError();
2700
+ throw new (0, _connectors.ConnectorNotFoundError)();
2700
2701
  if (chainId)
2701
2702
  assertActiveChain({ chainId });
2702
- const to = (to_ && !isAddress(to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;
2703
- if (to && !isAddress(to))
2703
+ const to = (to_ && !_viem.isAddress.call(void 0, to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;
2704
+ if (to && !_viem.isAddress.call(void 0, to))
2704
2705
  throw new Error("Invalid address");
2706
+ const gas = typeof gas_ === "undefined" ? await publicClient.estimateGas({
2707
+ accessList,
2708
+ account: walletClient.account,
2709
+ data,
2710
+ gas: _nullishCoalesce(gas_, () => ( void 0)),
2711
+ gasPrice,
2712
+ maxFeePerGas,
2713
+ maxPriorityFeePerGas,
2714
+ nonce,
2715
+ to,
2716
+ value
2717
+ }) : gas_ || void 0;
2705
2718
  return {
2706
2719
  accessList,
2707
2720
  account,
@@ -2735,7 +2748,7 @@ async function sendTransaction({
2735
2748
  }) {
2736
2749
  const walletClient = await getWalletClient({ chainId });
2737
2750
  if (!walletClient)
2738
- throw new ConnectorNotFoundError();
2751
+ throw new (0, _connectors.ConnectorNotFoundError)();
2739
2752
  if (chainId)
2740
2753
  assertActiveChain({ chainId });
2741
2754
  let args;
@@ -2759,7 +2772,7 @@ async function sendTransaction({
2759
2772
  account,
2760
2773
  chainId,
2761
2774
  data,
2762
- gas,
2775
+ gas: gas || null,
2763
2776
  gasPrice,
2764
2777
  maxFeePerGas,
2765
2778
  maxPriorityFeePerGas,
@@ -2773,7 +2786,7 @@ async function sendTransaction({
2773
2786
  }
2774
2787
 
2775
2788
  // src/actions/transactions/waitForTransaction.ts
2776
- import { hexToString as hexToString3 } from "viem";
2789
+
2777
2790
  async function waitForTransaction({
2778
2791
  chainId,
2779
2792
  confirmations = 1,
@@ -2798,14 +2811,14 @@ async function waitForTransaction({
2798
2811
  maxFeePerGas: txn.type === "eip1559" ? txn.maxFeePerGas : void 0,
2799
2812
  maxPriorityFeePerGas: txn.type === "eip1559" ? txn.maxPriorityFeePerGas : void 0
2800
2813
  });
2801
- const reason = hexToString3(`0x${code.substring(138)}`);
2814
+ const reason = _viem.hexToString.call(void 0, `0x${code.substring(138)}`);
2802
2815
  throw new Error(reason);
2803
2816
  }
2804
2817
  return receipt;
2805
2818
  }
2806
2819
 
2807
2820
  // src/actions/transactions/watchPendingTransactions.ts
2808
- import { shallow as shallow6 } from "zustand/shallow";
2821
+
2809
2822
  function watchPendingTransactions(args, callback) {
2810
2823
  let unwatch;
2811
2824
  const createListener = (publicClient) => {
@@ -2816,7 +2829,7 @@ function watchPendingTransactions(args, callback) {
2816
2829
  poll: true
2817
2830
  });
2818
2831
  };
2819
- const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });
2832
+ const publicClient_ = _nullishCoalesce(getWebSocketPublicClient({ chainId: args.chainId }), () => ( getPublicClient({ chainId: args.chainId })));
2820
2833
  createListener(publicClient_);
2821
2834
  const config2 = getConfig();
2822
2835
  const unsubscribe = config2.subscribe(
@@ -2825,92 +2838,92 @@ function watchPendingTransactions(args, callback) {
2825
2838
  webSocketPublicClient
2826
2839
  }),
2827
2840
  async ({ publicClient, webSocketPublicClient }) => {
2828
- const publicClient_2 = webSocketPublicClient ?? publicClient;
2841
+ const publicClient_2 = _nullishCoalesce(webSocketPublicClient, () => ( publicClient));
2829
2842
  if (!args.chainId && publicClient_2) {
2830
2843
  createListener(publicClient_2);
2831
2844
  }
2832
2845
  },
2833
2846
  {
2834
- equalityFn: shallow6
2847
+ equalityFn: _shallow.shallow
2835
2848
  }
2836
2849
  );
2837
2850
  return () => {
2838
2851
  unsubscribe();
2839
- unwatch?.();
2852
+ _optionalChain([unwatch, 'optionalCall', _81 => _81()]);
2840
2853
  };
2841
2854
  }
2842
2855
 
2843
2856
  // src/utils/assertActiveChain.ts
2844
2857
  function assertActiveChain({ chainId }) {
2845
2858
  const { chain: activeChain, chains } = getNetwork();
2846
- const activeChainId = activeChain?.id;
2859
+ const activeChainId = _optionalChain([activeChain, 'optionalAccess', _82 => _82.id]);
2847
2860
  if (activeChainId && chainId !== activeChainId) {
2848
2861
  throw new ChainMismatchError({
2849
- activeChain: chains.find((x) => x.id === activeChainId)?.name ?? `Chain ${activeChainId}`,
2850
- targetChain: chains.find((x) => x.id === chainId)?.name ?? `Chain ${chainId}`
2862
+ activeChain: _nullishCoalesce(_optionalChain([chains, 'access', _83 => _83.find, 'call', _84 => _84((x) => x.id === activeChainId), 'optionalAccess', _85 => _85.name]), () => ( `Chain ${activeChainId}`)),
2863
+ targetChain: _nullishCoalesce(_optionalChain([chains, 'access', _86 => _86.find, 'call', _87 => _87((x) => x.id === chainId), 'optionalAccess', _88 => _88.name]), () => ( `Chain ${chainId}`))
2851
2864
  });
2852
2865
  }
2853
2866
  }
2854
2867
 
2855
- export {
2856
- configureChains,
2857
- ChainMismatchError,
2858
- ChainNotConfiguredError,
2859
- ConnectorAlreadyConnectedError,
2860
- ConfigChainsNotFound,
2861
- SwitchChainNotSupportedError,
2862
- ConnectorNotFoundError,
2863
- deepEqual,
2864
- deserialize,
2865
- getCallParameters,
2866
- getSendTransactionParameters,
2867
- getUnit,
2868
- serialize,
2869
- noopStorage,
2870
- createStorage,
2871
- Config,
2872
- createConfig,
2873
- getConfig,
2874
- connect,
2875
- disconnect,
2876
- erc20ABI,
2877
- erc721ABI,
2878
- erc4626ABI,
2879
- fetchToken,
2880
- getPublicClient,
2881
- getWalletClient,
2882
- getWebSocketPublicClient,
2883
- watchPublicClient,
2884
- watchWalletClient,
2885
- watchWebSocketPublicClient,
2886
- prepareWriteContract,
2887
- getContract,
2888
- multicall,
2889
- readContract,
2890
- readContracts,
2891
- watchContractEvent,
2892
- watchBlockNumber,
2893
- watchMulticall,
2894
- watchReadContract,
2895
- watchReadContracts,
2896
- writeContract,
2897
- fetchBalance,
2898
- getAccount,
2899
- getNetwork,
2900
- signMessage,
2901
- signTypedData,
2902
- switchNetwork,
2903
- watchAccount,
2904
- watchNetwork,
2905
- fetchEnsAddress,
2906
- fetchEnsAvatar,
2907
- fetchEnsName,
2908
- fetchEnsResolver,
2909
- fetchBlockNumber,
2910
- fetchFeeData,
2911
- fetchTransaction,
2912
- prepareSendTransaction,
2913
- sendTransaction,
2914
- waitForTransaction,
2915
- watchPendingTransactions
2916
- };
2868
+
2869
+
2870
+
2871
+
2872
+
2873
+
2874
+
2875
+
2876
+
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
+ 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;