wagmi 0.2.13 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/README.md +13 -14
  2. package/connectors/injected/dist/wagmi-connectors-injected.cjs.dev.js +2 -2
  3. package/connectors/injected/dist/wagmi-connectors-injected.cjs.prod.js +2 -2
  4. package/connectors/injected/dist/wagmi-connectors-injected.esm.js +1 -1
  5. package/connectors/walletConnect/dist/wagmi-connectors-walletConnect.cjs.dev.js +1 -1
  6. package/connectors/walletConnect/dist/wagmi-connectors-walletConnect.cjs.prod.js +1 -1
  7. package/connectors/walletConnect/dist/wagmi-connectors-walletConnect.esm.js +1 -1
  8. package/connectors/walletLink/dist/wagmi-connectors-walletLink.cjs.dev.js +1 -1
  9. package/connectors/walletLink/dist/wagmi-connectors-walletLink.cjs.prod.js +1 -1
  10. package/connectors/walletLink/dist/wagmi-connectors-walletLink.esm.js +1 -1
  11. package/dist/declarations/src/connectors/injected.d.ts +1 -1
  12. package/dist/declarations/src/connectors/walletConnect.d.ts +1 -1
  13. package/dist/declarations/src/connectors/walletLink.d.ts +1 -1
  14. package/dist/declarations/src/context.d.ts +1 -1
  15. package/dist/declarations/src/hooks/accounts/useAccount.d.ts +1 -1
  16. package/dist/declarations/src/hooks/accounts/useBalance.d.ts +3 -14
  17. package/dist/declarations/src/hooks/accounts/useConnect.d.ts +1 -1
  18. package/dist/declarations/src/hooks/accounts/useNetwork.d.ts +1 -1
  19. package/dist/declarations/src/hooks/contracts/useToken.d.ts +1 -1
  20. package/dist/declarations/src/hooks/network-status/useFeeData.d.ts +1 -1
  21. package/dist/declarations/src/index.d.ts +2 -2
  22. package/dist/wagmi.cjs.dev.js +43 -71
  23. package/dist/wagmi.cjs.prod.js +43 -71
  24. package/dist/wagmi.esm.js +17 -45
  25. package/package.json +5 -5
package/README.md CHANGED
@@ -29,19 +29,15 @@
29
29
 
30
30
  **React Hooks library for Ethereum, built on [ethers.js](https://github.com/ethers-io/ethers.js).**
31
31
 
32
- šŸš€   20+ hooks for working with wallets, ENS, contracts, transactions, signing, etc.
32
+ ## Features
33
33
 
34
- šŸ’¼   Built-in wallet connectors for MetaMask, WalletConnect, and Coinbase Wallet
35
-
36
- šŸŒ€   Auto-refresh data on wallet and network changes
37
-
38
- šŸ¦„   TypeScript ready
39
-
40
- šŸ’Ø   Zero-dependencies (besides ethers.js peer dependency)
41
-
42
- 🌳   Test suite and documentation
43
-
44
- šŸ“–   MIT License
34
+ - šŸš€ 20+ hooks for working with wallets, ENS, contracts, transactions, signing, etc.
35
+ - šŸ’¼ Built-in wallet connectors for MetaMask, WalletConnect, and Coinbase Wallet
36
+ - šŸŒ€ Auto-refresh data on wallet and network changes
37
+ - šŸ¦„ TypeScript ready
38
+ - šŸ’Ø Zero-dependencies (besides ethers.js peer dependency)
39
+ - 🌳 Test suite and documentation
40
+ - šŸ“– MIT License
45
41
 
46
42
  ## Documentation
47
43
 
@@ -87,13 +83,16 @@ Want to learn more? Check out the [guides](https://wagmi-xyz.vercel.app/guides/c
87
83
 
88
84
  ## Community
89
85
 
90
- Feel free to join the [discussions on GitHub](https://github.com/tmm/wagmi/discussions) or reach out [on Twitter](https://twitter.com/awkweb)!
86
+ - Join the [discussions on GitHub](https://github.com/tmm/wagmi/discussions)
87
+ - Follow [@awkweb](https://twitter.com/awkweb) on Twitter for project updates
88
+ - Sign the [guestbook](https://github.com/tmm/wagmi/discussions/2)
89
+ - Share [your project/organization](https://github.com/tmm/wagmi/discussions/201) that uses wagmi
91
90
 
92
91
  ## Support
93
92
 
94
93
  - awkweb.eth
95
94
  - [GitHub Sponsors](https://github.com/sponsors/tmm)
96
- - Sign the [guestbook](https://github.com/tmm/wagmi/discussions/2)
95
+ - [Gitcoin Grant](https://gitcoin.co/grants/4493/wagmi-react-hooks-library-for-ethereum)
97
96
 
98
97
  ## Thanks
99
98
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var wagmiPrivate = require('wagmi-private');
5
+ var wagmiCore = require('wagmi-core');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, 'InjectedConnector', {
10
10
  enumerable: true,
11
- get: function () { return wagmiPrivate.InjectedConnector; }
11
+ get: function () { return wagmiCore.InjectedConnector; }
12
12
  });
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var wagmiPrivate = require('wagmi-private');
5
+ var wagmiCore = require('wagmi-core');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, 'InjectedConnector', {
10
10
  enumerable: true,
11
- get: function () { return wagmiPrivate.InjectedConnector; }
11
+ get: function () { return wagmiCore.InjectedConnector; }
12
12
  });
@@ -1 +1 @@
1
- export { InjectedConnector } from 'wagmi-private';
1
+ export { InjectedConnector } from 'wagmi-core';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var walletConnect = require('wagmi-private/connectors/walletConnect');
5
+ var walletConnect = require('wagmi-core/connectors/walletConnect');
6
6
 
7
7
 
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var walletConnect = require('wagmi-private/connectors/walletConnect');
5
+ var walletConnect = require('wagmi-core/connectors/walletConnect');
6
6
 
7
7
 
8
8
 
@@ -1 +1 @@
1
- export { WalletConnectConnector } from 'wagmi-private/connectors/walletConnect';
1
+ export { WalletConnectConnector } from 'wagmi-core/connectors/walletConnect';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var walletLink = require('wagmi-private/connectors/walletLink');
5
+ var walletLink = require('wagmi-core/connectors/walletLink');
6
6
 
7
7
 
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var walletLink = require('wagmi-private/connectors/walletLink');
5
+ var walletLink = require('wagmi-core/connectors/walletLink');
6
6
 
7
7
 
8
8
 
@@ -1 +1 @@
1
- export { WalletLinkConnector } from 'wagmi-private/connectors/walletLink';
1
+ export { WalletLinkConnector } from 'wagmi-core/connectors/walletLink';
@@ -1 +1 @@
1
- export { InjectedConnector } from 'wagmi-private';
1
+ export { InjectedConnector } from 'wagmi-core';
@@ -1 +1 @@
1
- export { WalletConnectConnector } from 'wagmi-private/connectors/walletConnect';
1
+ export { WalletConnectConnector } from 'wagmi-core/connectors/walletConnect';
@@ -1 +1 @@
1
- export { WalletLinkConnector } from 'wagmi-private/connectors/walletLink';
1
+ export { WalletLinkConnector } from 'wagmi-core/connectors/walletLink';
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { BaseProvider, Web3Provider, WebSocketProvider } from '@ethersproject/providers';
3
- import { Connector, ConnectorData } from 'wagmi-private';
3
+ import { Connector, ConnectorData } from 'wagmi-core';
4
4
  declare type State = {
5
5
  cacheBuster: number;
6
6
  connecting?: boolean;
@@ -5,7 +5,7 @@ export declare type Config = {
5
5
  export declare const useAccount: ({ fetchEns }?: Config) => readonly [{
6
6
  readonly data: {
7
7
  address: string;
8
- connector: import("wagmi-private").Connector<any, any> | undefined;
8
+ connector: import("wagmi-core").Connector<any, any> | undefined;
9
9
  ens: {
10
10
  avatar: string | null | undefined;
11
11
  name: string;
@@ -1,17 +1,11 @@
1
1
  import { BigNumber } from 'ethers';
2
- import { Unit } from 'wagmi-private';
2
+ import { BalanceActionArgs } from 'wagmi-core';
3
3
  export declare type Config = {
4
- /** Address or ENS name */
5
- addressOrName?: string;
6
- /** Units for formatting output */
7
- formatUnits?: Unit | number;
8
4
  /** Disables fetching */
9
5
  skip?: boolean;
10
- /** ERC-20 address */
11
- token?: string;
12
6
  /** Subscribe to changes */
13
7
  watch?: boolean;
14
- };
8
+ } & Partial<BalanceActionArgs['config']>;
15
9
  export declare const useBalance: ({ addressOrName, formatUnits, skip, token, watch, }?: Config) => readonly [{
16
10
  readonly data: {
17
11
  decimals: number;
@@ -26,12 +20,7 @@ export declare const useBalance: ({ addressOrName, formatUnits, skip, token, wat
26
20
  formatUnits?: Config['formatUnits'];
27
21
  token?: Config['token'];
28
22
  } | undefined) => Promise<{
29
- data: {
30
- decimals: number;
31
- formatted: string;
32
- symbol: string;
33
- value: BigNumber;
34
- };
23
+ data: import("wagmi-core").Balance;
35
24
  error: undefined;
36
25
  } | {
37
26
  data: undefined;
@@ -1,4 +1,4 @@
1
- import { Connector, ConnectorData } from 'wagmi-private';
1
+ import { Connector, ConnectorData } from 'wagmi-core';
2
2
  export declare const useConnect: () => readonly [{
3
3
  readonly data: {
4
4
  readonly connected: boolean;
@@ -1,4 +1,4 @@
1
- import { Chain, SwitchChainError } from 'wagmi-private';
1
+ import { Chain, SwitchChainError } from 'wagmi-core';
2
2
  export declare const useNetwork: () => readonly [{
3
3
  readonly data: {
4
4
  readonly chain: {
@@ -1,5 +1,5 @@
1
1
  import { BigNumber } from 'ethers';
2
- import { Unit } from 'wagmi-private';
2
+ import { Unit } from 'wagmi-core';
3
3
  export declare type Config = {
4
4
  address?: string;
5
5
  formatUnits?: Unit | number;
@@ -1,5 +1,5 @@
1
1
  import { FeeData } from '@ethersproject/providers';
2
- import { Unit } from 'wagmi-private';
2
+ import { Unit } from 'wagmi-core';
3
3
  declare type Config = {
4
4
  /** Units for formatting output */
5
5
  formatUnits?: Unit | number;
@@ -1,5 +1,5 @@
1
1
  export { Provider, Provider as WagmiProvider, useContext, Context, } from './context';
2
2
  export type { Props as ProviderProps, Props as WagmiProviderProps, } from './context';
3
3
  export { useAccount, useBalance, useBlockNumber, useConnect, useContract, useContractEvent, useContractRead, useContractWrite, useEnsAvatar, useEnsLookup, useEnsResolveName, useEnsResolver, useFeeData, useNetwork, useProvider, useSigner, useSignMessage, useToken, useTransaction, useWaitForTransaction, useWebSocketProvider, } from './hooks';
4
- export { Connector, InjectedConnector, chain, allChains, defaultChains, defaultL2Chains, developmentChains, erc1155ABI, erc20ABI, erc721ABI, normalizeChainId, AddChainError, ChainNotConfiguredError, ConnectorAlreadyConnectedError, ConnectorNotFoundError, SwitchChainError, UserRejectedRequestError, } from 'wagmi-private';
5
- export type { Chain, ConnectorData } from 'wagmi-private';
4
+ export { Connector, InjectedConnector, chain, allChains, defaultChains, defaultL2Chains, developmentChains, erc1155ABI, erc20ABI, erc721ABI, normalizeChainId, AddChainError, ChainNotConfiguredError, ConnectorAlreadyConnectedError, ConnectorNotFoundError, SwitchChainError, UserRejectedRequestError, } from 'wagmi-core';
5
+ export type { Chain, ConnectorData } from 'wagmi-core';
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var providers = require('@ethersproject/providers');
7
- var wagmiPrivate = require('wagmi-private');
7
+ var wagmiCore = require('wagmi-core');
8
8
  var ethers = require('ethers');
9
9
 
10
10
  function _interopNamespace(e) {
@@ -755,7 +755,7 @@ var useBalance = function useBalance() {
755
755
  });
756
756
 
757
757
  try {
758
- var _config_$formatUnits;
758
+ var _connector$chains;
759
759
 
760
760
  var config_ = config !== null && config !== void 0 ? config : {
761
761
  addressOrName,
@@ -763,57 +763,29 @@ var useBalance = function useBalance() {
763
763
  token
764
764
  };
765
765
  if (!config_.addressOrName) throw new Error('address is required');
766
- var formatUnits_ = (_config_$formatUnits = config_.formatUnits) !== null && _config_$formatUnits !== void 0 ? _config_$formatUnits : 'ether';
767
766
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
768
767
  error: undefined,
769
768
  loading: true
770
769
  }));
771
- var balance;
772
-
773
- if (config_.token) {
774
- var contract = new ethers.ethers.Contract(config_.token, wagmiPrivate.erc20ABI, provider);
775
- var [value, decimals, symbol] = yield Promise.all([contract.balanceOf(config_.addressOrName), contract.decimals(), contract.symbol()]);
776
- balance = {
777
- decimals,
778
- formatted: ethers.utils.formatUnits(value, formatUnits_),
779
- symbol,
780
- value
781
- };
782
- } else {
783
- var _connector$chains, _chain$nativeCurrency, _chain$nativeCurrency2, _chain$nativeCurrency3, _chain$nativeCurrency4;
784
-
785
- var _value = yield provider.getBalance(config_.addressOrName);
786
-
787
- var chain = [...((_connector$chains = connector === null || connector === void 0 ? void 0 : connector.chains) !== null && _connector$chains !== void 0 ? _connector$chains : []), ...wagmiPrivate.defaultChains, ...wagmiPrivate.defaultL2Chains].find(x => x.id === provider.network.chainId);
788
- balance = {
789
- decimals: (_chain$nativeCurrency = chain === null || chain === void 0 ? void 0 : (_chain$nativeCurrency2 = chain.nativeCurrency) === null || _chain$nativeCurrency2 === void 0 ? void 0 : _chain$nativeCurrency2.decimals) !== null && _chain$nativeCurrency !== void 0 ? _chain$nativeCurrency : 18,
790
- formatted: ethers.utils.formatUnits(_value, formatUnits_),
791
- symbol: (_chain$nativeCurrency3 = chain === null || chain === void 0 ? void 0 : (_chain$nativeCurrency4 = chain.nativeCurrency) === null || _chain$nativeCurrency4 === void 0 ? void 0 : _chain$nativeCurrency4.symbol) !== null && _chain$nativeCurrency3 !== void 0 ? _chain$nativeCurrency3 : 'ETH',
792
- value: _value
793
- };
794
- }
795
-
796
- if (!didCancel) {
797
- setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
798
- balance,
799
- loading: false
800
- }));
801
- }
802
-
770
+ var balance = yield wagmiCore.balanceAction({
771
+ chains: [...((_connector$chains = connector === null || connector === void 0 ? void 0 : connector.chains) !== null && _connector$chains !== void 0 ? _connector$chains : []), ...wagmiCore.defaultChains, ...wagmiCore.defaultL2Chains],
772
+ config: config_,
773
+ provider
774
+ });
775
+ if (!didCancel) setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
776
+ balance,
777
+ loading: false
778
+ }));
803
779
  return {
804
780
  data: balance,
805
781
  error: undefined
806
782
  };
807
783
  } catch (error_) {
808
784
  var error = error_;
809
-
810
- if (!didCancel) {
811
- setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
812
- error,
813
- loading: false
814
- }));
815
- }
816
-
785
+ if (!didCancel) setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
786
+ error,
787
+ loading: false
788
+ }));
817
789
  return {
818
790
  data: undefined,
819
791
  error
@@ -882,7 +854,7 @@ var useConnect = () => {
882
854
 
883
855
  try {
884
856
  var activeConnector = globalState === null || globalState === void 0 ? void 0 : globalState.connector;
885
- if (connector === activeConnector) throw new wagmiPrivate.ConnectorAlreadyConnectedError();
857
+ if (connector === activeConnector) throw new wagmiCore.ConnectorAlreadyConnectedError();
886
858
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
887
859
  loading: true,
888
860
  connector,
@@ -963,7 +935,7 @@ var useNetwork = () => {
963
935
  var chainId = data === null || data === void 0 ? void 0 : (_data$chain = data.chain) === null || _data$chain === void 0 ? void 0 : _data$chain.id;
964
936
  var unsupported = data === null || data === void 0 ? void 0 : (_data$chain2 = data.chain) === null || _data$chain2 === void 0 ? void 0 : _data$chain2.unsupported;
965
937
  var activeChains = (_connector$chains = connector === null || connector === void 0 ? void 0 : connector.chains) !== null && _connector$chains !== void 0 ? _connector$chains : [];
966
- var activeChain = [...activeChains, ...wagmiPrivate.allChains].find(x => x.id === chainId);
938
+ var activeChain = [...activeChains, ...wagmiCore.allChains].find(x => x.id === chainId);
967
939
  var cancelQuery = useCancel();
968
940
  var switchNetwork = React__namespace.useCallback( /*#__PURE__*/function () {
969
941
  var _ref = _asyncToGenerator(function* (chainId) {
@@ -973,7 +945,7 @@ var useNetwork = () => {
973
945
  });
974
946
  if (!(connector !== null && connector !== void 0 && connector.switchChain)) return {
975
947
  data: undefined,
976
- error: new wagmiPrivate.SwitchChainError()
948
+ error: new wagmiCore.SwitchChainError()
977
949
  };
978
950
 
979
951
  try {
@@ -1115,7 +1087,7 @@ var useSignMessage = function useSignMessage() {
1115
1087
  message
1116
1088
  };
1117
1089
  if (!config_.message) throw new Error('message is required');
1118
- if (!connector) throw new wagmiPrivate.ConnectorNotFoundError();
1090
+ if (!connector) throw new wagmiCore.ConnectorNotFoundError();
1119
1091
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
1120
1092
  error: undefined,
1121
1093
  loading: true
@@ -1136,7 +1108,7 @@ var useSignMessage = function useSignMessage() {
1136
1108
  };
1137
1109
  } catch (error_) {
1138
1110
  var error = error_;
1139
- if (error_.code === 4001) error = new wagmiPrivate.UserRejectedRequestError();
1111
+ if (error_.code === 4001) error = new wagmiCore.UserRejectedRequestError();
1140
1112
 
1141
1113
  if (!didCancel) {
1142
1114
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
@@ -1347,7 +1319,7 @@ var useContractWrite = function useContractWrite(contractConfig, functionName) {
1347
1319
  args,
1348
1320
  overrides
1349
1321
  };
1350
- if (!connector) throw new wagmiPrivate.ConnectorNotFoundError();
1322
+ if (!connector) throw new wagmiCore.ConnectorNotFoundError();
1351
1323
  var params = [...(Array.isArray(config_.args) ? config_.args : config_.args ? [config_.args] : []), ...(config_.overrides ? [config_.overrides] : [])];
1352
1324
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
1353
1325
  error: undefined,
@@ -1371,7 +1343,7 @@ var useContractWrite = function useContractWrite(contractConfig, functionName) {
1371
1343
  };
1372
1344
  } catch (error_) {
1373
1345
  var error = error_;
1374
- if (error_.code === 4001) error = new wagmiPrivate.UserRejectedRequestError();
1346
+ if (error_.code === 4001) error = new wagmiCore.UserRejectedRequestError();
1375
1347
 
1376
1348
  if (!didCancel) {
1377
1349
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
@@ -1430,7 +1402,7 @@ var useToken = function useToken() {
1430
1402
  formatUnits
1431
1403
  };
1432
1404
  if (!config_.address) throw new Error('address is required');
1433
- var contract = new ethers.ethers.Contract(config_.address, wagmiPrivate.erc20ABI, provider);
1405
+ var contract = new ethers.ethers.Contract(config_.address, wagmiCore.erc20ABI, provider);
1434
1406
  var formatUnits_ = (_config_$formatUnits = config_.formatUnits) !== null && _config_$formatUnits !== void 0 ? _config_$formatUnits : 'ether';
1435
1407
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
1436
1408
  error: undefined,
@@ -1542,7 +1514,7 @@ var useTransaction = function useTransaction() {
1542
1514
  request
1543
1515
  };
1544
1516
  if (!config_.request) throw new Error('request is required');
1545
- if (!connector) throw new wagmiPrivate.ConnectorNotFoundError();
1517
+ if (!connector) throw new wagmiCore.ConnectorNotFoundError();
1546
1518
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
1547
1519
  loading: true
1548
1520
  }));
@@ -1562,7 +1534,7 @@ var useTransaction = function useTransaction() {
1562
1534
  };
1563
1535
  } catch (error_) {
1564
1536
  var error = error_;
1565
- if (error_.code === 4001) error = new wagmiPrivate.UserRejectedRequestError();
1537
+ if (error_.code === 4001) error = new wagmiCore.UserRejectedRequestError();
1566
1538
 
1567
1539
  if (!didCancel) {
1568
1540
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
@@ -1691,7 +1663,7 @@ var Provider = _ref => {
1691
1663
  var {
1692
1664
  autoConnect = false,
1693
1665
  children,
1694
- connectors: connectors_ = [new wagmiPrivate.InjectedConnector()],
1666
+ connectors: connectors_ = [new wagmiCore.InjectedConnector()],
1695
1667
  connectorStorageKey = 'wagmi.wallet',
1696
1668
  provider: provider_ = providers.getDefaultProvider(),
1697
1669
  webSocketProvider: webSocketProvider_
@@ -1825,71 +1797,71 @@ var useContext = () => {
1825
1797
 
1826
1798
  Object.defineProperty(exports, 'AddChainError', {
1827
1799
  enumerable: true,
1828
- get: function () { return wagmiPrivate.AddChainError; }
1800
+ get: function () { return wagmiCore.AddChainError; }
1829
1801
  });
1830
1802
  Object.defineProperty(exports, 'ChainNotConfiguredError', {
1831
1803
  enumerable: true,
1832
- get: function () { return wagmiPrivate.ChainNotConfiguredError; }
1804
+ get: function () { return wagmiCore.ChainNotConfiguredError; }
1833
1805
  });
1834
1806
  Object.defineProperty(exports, 'Connector', {
1835
1807
  enumerable: true,
1836
- get: function () { return wagmiPrivate.Connector; }
1808
+ get: function () { return wagmiCore.Connector; }
1837
1809
  });
1838
1810
  Object.defineProperty(exports, 'ConnectorAlreadyConnectedError', {
1839
1811
  enumerable: true,
1840
- get: function () { return wagmiPrivate.ConnectorAlreadyConnectedError; }
1812
+ get: function () { return wagmiCore.ConnectorAlreadyConnectedError; }
1841
1813
  });
1842
1814
  Object.defineProperty(exports, 'ConnectorNotFoundError', {
1843
1815
  enumerable: true,
1844
- get: function () { return wagmiPrivate.ConnectorNotFoundError; }
1816
+ get: function () { return wagmiCore.ConnectorNotFoundError; }
1845
1817
  });
1846
1818
  Object.defineProperty(exports, 'InjectedConnector', {
1847
1819
  enumerable: true,
1848
- get: function () { return wagmiPrivate.InjectedConnector; }
1820
+ get: function () { return wagmiCore.InjectedConnector; }
1849
1821
  });
1850
1822
  Object.defineProperty(exports, 'SwitchChainError', {
1851
1823
  enumerable: true,
1852
- get: function () { return wagmiPrivate.SwitchChainError; }
1824
+ get: function () { return wagmiCore.SwitchChainError; }
1853
1825
  });
1854
1826
  Object.defineProperty(exports, 'UserRejectedRequestError', {
1855
1827
  enumerable: true,
1856
- get: function () { return wagmiPrivate.UserRejectedRequestError; }
1828
+ get: function () { return wagmiCore.UserRejectedRequestError; }
1857
1829
  });
1858
1830
  Object.defineProperty(exports, 'allChains', {
1859
1831
  enumerable: true,
1860
- get: function () { return wagmiPrivate.allChains; }
1832
+ get: function () { return wagmiCore.allChains; }
1861
1833
  });
1862
1834
  Object.defineProperty(exports, 'chain', {
1863
1835
  enumerable: true,
1864
- get: function () { return wagmiPrivate.chain; }
1836
+ get: function () { return wagmiCore.chain; }
1865
1837
  });
1866
1838
  Object.defineProperty(exports, 'defaultChains', {
1867
1839
  enumerable: true,
1868
- get: function () { return wagmiPrivate.defaultChains; }
1840
+ get: function () { return wagmiCore.defaultChains; }
1869
1841
  });
1870
1842
  Object.defineProperty(exports, 'defaultL2Chains', {
1871
1843
  enumerable: true,
1872
- get: function () { return wagmiPrivate.defaultL2Chains; }
1844
+ get: function () { return wagmiCore.defaultL2Chains; }
1873
1845
  });
1874
1846
  Object.defineProperty(exports, 'developmentChains', {
1875
1847
  enumerable: true,
1876
- get: function () { return wagmiPrivate.developmentChains; }
1848
+ get: function () { return wagmiCore.developmentChains; }
1877
1849
  });
1878
1850
  Object.defineProperty(exports, 'erc1155ABI', {
1879
1851
  enumerable: true,
1880
- get: function () { return wagmiPrivate.erc1155ABI; }
1852
+ get: function () { return wagmiCore.erc1155ABI; }
1881
1853
  });
1882
1854
  Object.defineProperty(exports, 'erc20ABI', {
1883
1855
  enumerable: true,
1884
- get: function () { return wagmiPrivate.erc20ABI; }
1856
+ get: function () { return wagmiCore.erc20ABI; }
1885
1857
  });
1886
1858
  Object.defineProperty(exports, 'erc721ABI', {
1887
1859
  enumerable: true,
1888
- get: function () { return wagmiPrivate.erc721ABI; }
1860
+ get: function () { return wagmiCore.erc721ABI; }
1889
1861
  });
1890
1862
  Object.defineProperty(exports, 'normalizeChainId', {
1891
1863
  enumerable: true,
1892
- get: function () { return wagmiPrivate.normalizeChainId; }
1864
+ get: function () { return wagmiCore.normalizeChainId; }
1893
1865
  });
1894
1866
  exports.Context = Context;
1895
1867
  exports.Provider = Provider;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var providers = require('@ethersproject/providers');
7
- var wagmiPrivate = require('wagmi-private');
7
+ var wagmiCore = require('wagmi-core');
8
8
  var ethers = require('ethers');
9
9
 
10
10
  function _interopNamespace(e) {
@@ -755,7 +755,7 @@ var useBalance = function useBalance() {
755
755
  });
756
756
 
757
757
  try {
758
- var _config_$formatUnits;
758
+ var _connector$chains;
759
759
 
760
760
  var config_ = config !== null && config !== void 0 ? config : {
761
761
  addressOrName,
@@ -763,57 +763,29 @@ var useBalance = function useBalance() {
763
763
  token
764
764
  };
765
765
  if (!config_.addressOrName) throw new Error('address is required');
766
- var formatUnits_ = (_config_$formatUnits = config_.formatUnits) !== null && _config_$formatUnits !== void 0 ? _config_$formatUnits : 'ether';
767
766
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
768
767
  error: undefined,
769
768
  loading: true
770
769
  }));
771
- var balance;
772
-
773
- if (config_.token) {
774
- var contract = new ethers.ethers.Contract(config_.token, wagmiPrivate.erc20ABI, provider);
775
- var [value, decimals, symbol] = yield Promise.all([contract.balanceOf(config_.addressOrName), contract.decimals(), contract.symbol()]);
776
- balance = {
777
- decimals,
778
- formatted: ethers.utils.formatUnits(value, formatUnits_),
779
- symbol,
780
- value
781
- };
782
- } else {
783
- var _connector$chains, _chain$nativeCurrency, _chain$nativeCurrency2, _chain$nativeCurrency3, _chain$nativeCurrency4;
784
-
785
- var _value = yield provider.getBalance(config_.addressOrName);
786
-
787
- var chain = [...((_connector$chains = connector === null || connector === void 0 ? void 0 : connector.chains) !== null && _connector$chains !== void 0 ? _connector$chains : []), ...wagmiPrivate.defaultChains, ...wagmiPrivate.defaultL2Chains].find(x => x.id === provider.network.chainId);
788
- balance = {
789
- decimals: (_chain$nativeCurrency = chain === null || chain === void 0 ? void 0 : (_chain$nativeCurrency2 = chain.nativeCurrency) === null || _chain$nativeCurrency2 === void 0 ? void 0 : _chain$nativeCurrency2.decimals) !== null && _chain$nativeCurrency !== void 0 ? _chain$nativeCurrency : 18,
790
- formatted: ethers.utils.formatUnits(_value, formatUnits_),
791
- symbol: (_chain$nativeCurrency3 = chain === null || chain === void 0 ? void 0 : (_chain$nativeCurrency4 = chain.nativeCurrency) === null || _chain$nativeCurrency4 === void 0 ? void 0 : _chain$nativeCurrency4.symbol) !== null && _chain$nativeCurrency3 !== void 0 ? _chain$nativeCurrency3 : 'ETH',
792
- value: _value
793
- };
794
- }
795
-
796
- if (!didCancel) {
797
- setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
798
- balance,
799
- loading: false
800
- }));
801
- }
802
-
770
+ var balance = yield wagmiCore.balanceAction({
771
+ chains: [...((_connector$chains = connector === null || connector === void 0 ? void 0 : connector.chains) !== null && _connector$chains !== void 0 ? _connector$chains : []), ...wagmiCore.defaultChains, ...wagmiCore.defaultL2Chains],
772
+ config: config_,
773
+ provider
774
+ });
775
+ if (!didCancel) setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
776
+ balance,
777
+ loading: false
778
+ }));
803
779
  return {
804
780
  data: balance,
805
781
  error: undefined
806
782
  };
807
783
  } catch (error_) {
808
784
  var error = error_;
809
-
810
- if (!didCancel) {
811
- setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
812
- error,
813
- loading: false
814
- }));
815
- }
816
-
785
+ if (!didCancel) setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
786
+ error,
787
+ loading: false
788
+ }));
817
789
  return {
818
790
  data: undefined,
819
791
  error
@@ -882,7 +854,7 @@ var useConnect = () => {
882
854
 
883
855
  try {
884
856
  var activeConnector = globalState === null || globalState === void 0 ? void 0 : globalState.connector;
885
- if (connector === activeConnector) throw new wagmiPrivate.ConnectorAlreadyConnectedError();
857
+ if (connector === activeConnector) throw new wagmiCore.ConnectorAlreadyConnectedError();
886
858
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
887
859
  loading: true,
888
860
  connector,
@@ -963,7 +935,7 @@ var useNetwork = () => {
963
935
  var chainId = data === null || data === void 0 ? void 0 : (_data$chain = data.chain) === null || _data$chain === void 0 ? void 0 : _data$chain.id;
964
936
  var unsupported = data === null || data === void 0 ? void 0 : (_data$chain2 = data.chain) === null || _data$chain2 === void 0 ? void 0 : _data$chain2.unsupported;
965
937
  var activeChains = (_connector$chains = connector === null || connector === void 0 ? void 0 : connector.chains) !== null && _connector$chains !== void 0 ? _connector$chains : [];
966
- var activeChain = [...activeChains, ...wagmiPrivate.allChains].find(x => x.id === chainId);
938
+ var activeChain = [...activeChains, ...wagmiCore.allChains].find(x => x.id === chainId);
967
939
  var cancelQuery = useCancel();
968
940
  var switchNetwork = React__namespace.useCallback( /*#__PURE__*/function () {
969
941
  var _ref = _asyncToGenerator(function* (chainId) {
@@ -973,7 +945,7 @@ var useNetwork = () => {
973
945
  });
974
946
  if (!(connector !== null && connector !== void 0 && connector.switchChain)) return {
975
947
  data: undefined,
976
- error: new wagmiPrivate.SwitchChainError()
948
+ error: new wagmiCore.SwitchChainError()
977
949
  };
978
950
 
979
951
  try {
@@ -1115,7 +1087,7 @@ var useSignMessage = function useSignMessage() {
1115
1087
  message
1116
1088
  };
1117
1089
  if (!config_.message) throw new Error('message is required');
1118
- if (!connector) throw new wagmiPrivate.ConnectorNotFoundError();
1090
+ if (!connector) throw new wagmiCore.ConnectorNotFoundError();
1119
1091
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
1120
1092
  error: undefined,
1121
1093
  loading: true
@@ -1136,7 +1108,7 @@ var useSignMessage = function useSignMessage() {
1136
1108
  };
1137
1109
  } catch (error_) {
1138
1110
  var error = error_;
1139
- if (error_.code === 4001) error = new wagmiPrivate.UserRejectedRequestError();
1111
+ if (error_.code === 4001) error = new wagmiCore.UserRejectedRequestError();
1140
1112
 
1141
1113
  if (!didCancel) {
1142
1114
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
@@ -1347,7 +1319,7 @@ var useContractWrite = function useContractWrite(contractConfig, functionName) {
1347
1319
  args,
1348
1320
  overrides
1349
1321
  };
1350
- if (!connector) throw new wagmiPrivate.ConnectorNotFoundError();
1322
+ if (!connector) throw new wagmiCore.ConnectorNotFoundError();
1351
1323
  var params = [...(Array.isArray(config_.args) ? config_.args : config_.args ? [config_.args] : []), ...(config_.overrides ? [config_.overrides] : [])];
1352
1324
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
1353
1325
  error: undefined,
@@ -1371,7 +1343,7 @@ var useContractWrite = function useContractWrite(contractConfig, functionName) {
1371
1343
  };
1372
1344
  } catch (error_) {
1373
1345
  var error = error_;
1374
- if (error_.code === 4001) error = new wagmiPrivate.UserRejectedRequestError();
1346
+ if (error_.code === 4001) error = new wagmiCore.UserRejectedRequestError();
1375
1347
 
1376
1348
  if (!didCancel) {
1377
1349
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
@@ -1430,7 +1402,7 @@ var useToken = function useToken() {
1430
1402
  formatUnits
1431
1403
  };
1432
1404
  if (!config_.address) throw new Error('address is required');
1433
- var contract = new ethers.ethers.Contract(config_.address, wagmiPrivate.erc20ABI, provider);
1405
+ var contract = new ethers.ethers.Contract(config_.address, wagmiCore.erc20ABI, provider);
1434
1406
  var formatUnits_ = (_config_$formatUnits = config_.formatUnits) !== null && _config_$formatUnits !== void 0 ? _config_$formatUnits : 'ether';
1435
1407
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
1436
1408
  error: undefined,
@@ -1542,7 +1514,7 @@ var useTransaction = function useTransaction() {
1542
1514
  request
1543
1515
  };
1544
1516
  if (!config_.request) throw new Error('request is required');
1545
- if (!connector) throw new wagmiPrivate.ConnectorNotFoundError();
1517
+ if (!connector) throw new wagmiCore.ConnectorNotFoundError();
1546
1518
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
1547
1519
  loading: true
1548
1520
  }));
@@ -1562,7 +1534,7 @@ var useTransaction = function useTransaction() {
1562
1534
  };
1563
1535
  } catch (error_) {
1564
1536
  var error = error_;
1565
- if (error_.code === 4001) error = new wagmiPrivate.UserRejectedRequestError();
1537
+ if (error_.code === 4001) error = new wagmiCore.UserRejectedRequestError();
1566
1538
 
1567
1539
  if (!didCancel) {
1568
1540
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
@@ -1691,7 +1663,7 @@ var Provider = _ref => {
1691
1663
  var {
1692
1664
  autoConnect = false,
1693
1665
  children,
1694
- connectors: connectors_ = [new wagmiPrivate.InjectedConnector()],
1666
+ connectors: connectors_ = [new wagmiCore.InjectedConnector()],
1695
1667
  connectorStorageKey = 'wagmi.wallet',
1696
1668
  provider: provider_ = providers.getDefaultProvider(),
1697
1669
  webSocketProvider: webSocketProvider_
@@ -1825,71 +1797,71 @@ var useContext = () => {
1825
1797
 
1826
1798
  Object.defineProperty(exports, 'AddChainError', {
1827
1799
  enumerable: true,
1828
- get: function () { return wagmiPrivate.AddChainError; }
1800
+ get: function () { return wagmiCore.AddChainError; }
1829
1801
  });
1830
1802
  Object.defineProperty(exports, 'ChainNotConfiguredError', {
1831
1803
  enumerable: true,
1832
- get: function () { return wagmiPrivate.ChainNotConfiguredError; }
1804
+ get: function () { return wagmiCore.ChainNotConfiguredError; }
1833
1805
  });
1834
1806
  Object.defineProperty(exports, 'Connector', {
1835
1807
  enumerable: true,
1836
- get: function () { return wagmiPrivate.Connector; }
1808
+ get: function () { return wagmiCore.Connector; }
1837
1809
  });
1838
1810
  Object.defineProperty(exports, 'ConnectorAlreadyConnectedError', {
1839
1811
  enumerable: true,
1840
- get: function () { return wagmiPrivate.ConnectorAlreadyConnectedError; }
1812
+ get: function () { return wagmiCore.ConnectorAlreadyConnectedError; }
1841
1813
  });
1842
1814
  Object.defineProperty(exports, 'ConnectorNotFoundError', {
1843
1815
  enumerable: true,
1844
- get: function () { return wagmiPrivate.ConnectorNotFoundError; }
1816
+ get: function () { return wagmiCore.ConnectorNotFoundError; }
1845
1817
  });
1846
1818
  Object.defineProperty(exports, 'InjectedConnector', {
1847
1819
  enumerable: true,
1848
- get: function () { return wagmiPrivate.InjectedConnector; }
1820
+ get: function () { return wagmiCore.InjectedConnector; }
1849
1821
  });
1850
1822
  Object.defineProperty(exports, 'SwitchChainError', {
1851
1823
  enumerable: true,
1852
- get: function () { return wagmiPrivate.SwitchChainError; }
1824
+ get: function () { return wagmiCore.SwitchChainError; }
1853
1825
  });
1854
1826
  Object.defineProperty(exports, 'UserRejectedRequestError', {
1855
1827
  enumerable: true,
1856
- get: function () { return wagmiPrivate.UserRejectedRequestError; }
1828
+ get: function () { return wagmiCore.UserRejectedRequestError; }
1857
1829
  });
1858
1830
  Object.defineProperty(exports, 'allChains', {
1859
1831
  enumerable: true,
1860
- get: function () { return wagmiPrivate.allChains; }
1832
+ get: function () { return wagmiCore.allChains; }
1861
1833
  });
1862
1834
  Object.defineProperty(exports, 'chain', {
1863
1835
  enumerable: true,
1864
- get: function () { return wagmiPrivate.chain; }
1836
+ get: function () { return wagmiCore.chain; }
1865
1837
  });
1866
1838
  Object.defineProperty(exports, 'defaultChains', {
1867
1839
  enumerable: true,
1868
- get: function () { return wagmiPrivate.defaultChains; }
1840
+ get: function () { return wagmiCore.defaultChains; }
1869
1841
  });
1870
1842
  Object.defineProperty(exports, 'defaultL2Chains', {
1871
1843
  enumerable: true,
1872
- get: function () { return wagmiPrivate.defaultL2Chains; }
1844
+ get: function () { return wagmiCore.defaultL2Chains; }
1873
1845
  });
1874
1846
  Object.defineProperty(exports, 'developmentChains', {
1875
1847
  enumerable: true,
1876
- get: function () { return wagmiPrivate.developmentChains; }
1848
+ get: function () { return wagmiCore.developmentChains; }
1877
1849
  });
1878
1850
  Object.defineProperty(exports, 'erc1155ABI', {
1879
1851
  enumerable: true,
1880
- get: function () { return wagmiPrivate.erc1155ABI; }
1852
+ get: function () { return wagmiCore.erc1155ABI; }
1881
1853
  });
1882
1854
  Object.defineProperty(exports, 'erc20ABI', {
1883
1855
  enumerable: true,
1884
- get: function () { return wagmiPrivate.erc20ABI; }
1856
+ get: function () { return wagmiCore.erc20ABI; }
1885
1857
  });
1886
1858
  Object.defineProperty(exports, 'erc721ABI', {
1887
1859
  enumerable: true,
1888
- get: function () { return wagmiPrivate.erc721ABI; }
1860
+ get: function () { return wagmiCore.erc721ABI; }
1889
1861
  });
1890
1862
  Object.defineProperty(exports, 'normalizeChainId', {
1891
1863
  enumerable: true,
1892
- get: function () { return wagmiPrivate.normalizeChainId; }
1864
+ get: function () { return wagmiCore.normalizeChainId; }
1893
1865
  });
1894
1866
  exports.Context = Context;
1895
1867
  exports.Provider = Provider;
package/dist/wagmi.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { getDefaultProvider } from '@ethersproject/providers';
3
- import { erc20ABI, defaultChains, defaultL2Chains, ConnectorAlreadyConnectedError, allChains, SwitchChainError, ConnectorNotFoundError, UserRejectedRequestError, InjectedConnector } from 'wagmi-private';
4
- export { AddChainError, ChainNotConfiguredError, Connector, ConnectorAlreadyConnectedError, ConnectorNotFoundError, InjectedConnector, SwitchChainError, UserRejectedRequestError, allChains, chain, defaultChains, defaultL2Chains, developmentChains, erc1155ABI, erc20ABI, erc721ABI, normalizeChainId } from 'wagmi-private';
5
- import { utils, ethers, Contract } from 'ethers';
3
+ import { balanceAction, defaultChains, defaultL2Chains, ConnectorAlreadyConnectedError, allChains, SwitchChainError, ConnectorNotFoundError, UserRejectedRequestError, erc20ABI, InjectedConnector } from 'wagmi-core';
4
+ export { AddChainError, ChainNotConfiguredError, Connector, ConnectorAlreadyConnectedError, ConnectorNotFoundError, InjectedConnector, SwitchChainError, UserRejectedRequestError, allChains, chain, defaultChains, defaultL2Chains, developmentChains, erc1155ABI, erc20ABI, erc721ABI, normalizeChainId } from 'wagmi-core';
5
+ import { utils, Contract, ethers } from 'ethers';
6
6
 
7
7
  function _defineProperty(obj, key, value) {
8
8
  if (key in obj) {
@@ -732,7 +732,7 @@ var useBalance = function useBalance() {
732
732
  });
733
733
 
734
734
  try {
735
- var _config_$formatUnits;
735
+ var _connector$chains;
736
736
 
737
737
  var config_ = config !== null && config !== void 0 ? config : {
738
738
  addressOrName,
@@ -740,57 +740,29 @@ var useBalance = function useBalance() {
740
740
  token
741
741
  };
742
742
  if (!config_.addressOrName) throw new Error('address is required');
743
- var formatUnits_ = (_config_$formatUnits = config_.formatUnits) !== null && _config_$formatUnits !== void 0 ? _config_$formatUnits : 'ether';
744
743
  setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
745
744
  error: undefined,
746
745
  loading: true
747
746
  }));
748
- var balance;
749
-
750
- if (config_.token) {
751
- var contract = new ethers.Contract(config_.token, erc20ABI, provider);
752
- var [value, decimals, symbol] = yield Promise.all([contract.balanceOf(config_.addressOrName), contract.decimals(), contract.symbol()]);
753
- balance = {
754
- decimals,
755
- formatted: utils.formatUnits(value, formatUnits_),
756
- symbol,
757
- value
758
- };
759
- } else {
760
- var _connector$chains, _chain$nativeCurrency, _chain$nativeCurrency2, _chain$nativeCurrency3, _chain$nativeCurrency4;
761
-
762
- var _value = yield provider.getBalance(config_.addressOrName);
763
-
764
- var chain = [...((_connector$chains = connector === null || connector === void 0 ? void 0 : connector.chains) !== null && _connector$chains !== void 0 ? _connector$chains : []), ...defaultChains, ...defaultL2Chains].find(x => x.id === provider.network.chainId);
765
- balance = {
766
- decimals: (_chain$nativeCurrency = chain === null || chain === void 0 ? void 0 : (_chain$nativeCurrency2 = chain.nativeCurrency) === null || _chain$nativeCurrency2 === void 0 ? void 0 : _chain$nativeCurrency2.decimals) !== null && _chain$nativeCurrency !== void 0 ? _chain$nativeCurrency : 18,
767
- formatted: utils.formatUnits(_value, formatUnits_),
768
- symbol: (_chain$nativeCurrency3 = chain === null || chain === void 0 ? void 0 : (_chain$nativeCurrency4 = chain.nativeCurrency) === null || _chain$nativeCurrency4 === void 0 ? void 0 : _chain$nativeCurrency4.symbol) !== null && _chain$nativeCurrency3 !== void 0 ? _chain$nativeCurrency3 : 'ETH',
769
- value: _value
770
- };
771
- }
772
-
773
- if (!didCancel) {
774
- setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
775
- balance,
776
- loading: false
777
- }));
778
- }
779
-
747
+ var balance = yield balanceAction({
748
+ chains: [...((_connector$chains = connector === null || connector === void 0 ? void 0 : connector.chains) !== null && _connector$chains !== void 0 ? _connector$chains : []), ...defaultChains, ...defaultL2Chains],
749
+ config: config_,
750
+ provider
751
+ });
752
+ if (!didCancel) setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
753
+ balance,
754
+ loading: false
755
+ }));
780
756
  return {
781
757
  data: balance,
782
758
  error: undefined
783
759
  };
784
760
  } catch (error_) {
785
761
  var error = error_;
786
-
787
- if (!didCancel) {
788
- setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
789
- error,
790
- loading: false
791
- }));
792
- }
793
-
762
+ if (!didCancel) setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
763
+ error,
764
+ loading: false
765
+ }));
794
766
  return {
795
767
  data: undefined,
796
768
  error
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "wagmi",
3
3
  "description": "React Hooks library for Ethereum",
4
4
  "license": "MIT",
5
- "version": "0.2.13",
5
+ "version": "0.2.16",
6
6
  "ethereum": "awkweb.eth",
7
7
  "repository": "tmm/wagmi",
8
8
  "homepage": "https://wagmi-xyz.vercel.app",
@@ -47,17 +47,17 @@
47
47
  "dependencies": {
48
48
  "@ethersproject/providers": "^5.5.1",
49
49
  "@walletconnect/ethereum-provider": "1.7.1",
50
- "wagmi-private": "0.1.9",
50
+ "wagmi-core": "0.1.12",
51
51
  "walletlink": "^2.2.8"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@testing-library/react-hooks": "^7.0.2",
55
55
  "@types/react": "^17.0.0",
56
+ "wagmi-testing": "0.1.12",
56
57
  "@walletconnect/ethereum-provider": "1.7.1",
57
58
  "ethers": "^5.5.1",
58
59
  "react": "^17.0.0",
59
- "walletlink": "^2.2.8",
60
- "wagmi-testing": "0.1.9"
60
+ "walletlink": "^2.2.8"
61
61
  },
62
- "readme": "<p>\n <a aria-label=\"Version\" href=\"https://www.npmjs.com/package/wagmi\">\n <img\n alt=\"\"\n src=\"https://img.shields.io/npm/v/wagmi.svg?style=for-the-badge&labelColor=161c22\"\n />\n </a>\n <a aria-label=\"License\" href=\"/LICENSE\">\n <img\n alt=\"\"\n src=\"https://img.shields.io/npm/l/wagmi.svg?style=for-the-badge&labelColor=161c22\"\n />\n </a>\n <a aria-label=\"Sponsors\" href=\"https://github.com/sponsors/tmm\">\n <img\n alt=\"\"\n src=\"https://img.shields.io/github/sponsors/tmm.svg?style=for-the-badge&labelColor=161c22\"\n />\n </a>\n <a aria-label=\"Downloads\" href=\"https://www.npmjs.com/package/wagmi\">\n <img\n alt=\"\"\n src=\"https://img.shields.io/npm/dm/wagmi.svg?style=for-the-badge&labelColor=161c22\"\n />\n </a>\n</p>\n\n# wagmi\n\n**React Hooks library for Ethereum, built on [ethers.js](https://github.com/ethers-io/ethers.js).**\n\nšŸš€ &nbsp; 20+ hooks for working with wallets, ENS, contracts, transactions, signing, etc.\n\nšŸ’¼ &nbsp; Built-in wallet connectors for MetaMask, WalletConnect, and Coinbase Wallet\n\nšŸŒ€ &nbsp; Auto-refresh data on wallet and network changes\n\nšŸ¦„ &nbsp; TypeScript ready\n\nšŸ’Ø &nbsp; Zero-dependencies (besides ethers.js peer dependency)\n\n🌳 &nbsp; Test suite and documentation\n\nšŸ“– &nbsp; MIT License\n\n## Documentation\n\nVisit https://wagmi-xyz.vercel.app to view the full documentation.\n\n## Usage\n\n1. Install the dependencies.\n\n```bash\nnpm add wagmi ethers\n```\n\n2. Wrap your app with the `Provider` component.\n\n```tsx\nimport { Provider } from 'wagmi'\n\nconst App = () => (\n <Provider>\n <YourRoutes />\n </Provider>\n)\n```\n\n3. Use hooks.\n\n```tsx\nimport { useAccount } from 'wagmi'\n\nconst Page = () => {\n const [{ data, error, loading }, disconnect] = useAccount({\n fetchEns: true,\n })\n\n return ...\n}\n```\n\nEvery component inside the `Provider` is set up with the default `InjectedConnector` for connecting wallets and ethers.js [Default Provider](https://docs.ethers.io/v5/api/providers/#providers-getDefaultProvider) for fetching data.\n\nWant to learn more? Check out the [guides](https://wagmi-xyz.vercel.app/guides/connect-wallet) or browse the [API docs](https://wagmi-xyz.vercel.app/docs/provider).\n\n## Community\n\nFeel free to join the [discussions on GitHub](https://github.com/tmm/wagmi/discussions) or reach out [on Twitter](https://twitter.com/awkweb)!\n\n## Support\n\n- awkweb.eth\n- [GitHub Sponsors](https://github.com/sponsors/tmm)\n- Sign the [guestbook](https://github.com/tmm/wagmi/discussions/2)\n\n## Thanks\n\n- [ricmoo.eth](https://twitter.com/ricmoo) for creating and continued work on [ethers.js](https://github.com/ethers-io/ethers.js)\n- [Mirror](https://mirror.xyz) for creating space to do good work\n\n## License\n\nMIT.\n\n<br />\n\nwagmi\n"
62
+ "readme": "<p>\n <a aria-label=\"Version\" href=\"https://www.npmjs.com/package/wagmi\">\n <img\n alt=\"\"\n src=\"https://img.shields.io/npm/v/wagmi.svg?style=for-the-badge&labelColor=161c22\"\n />\n </a>\n <a aria-label=\"License\" href=\"/LICENSE\">\n <img\n alt=\"\"\n src=\"https://img.shields.io/npm/l/wagmi.svg?style=for-the-badge&labelColor=161c22\"\n />\n </a>\n <a aria-label=\"Sponsors\" href=\"https://github.com/sponsors/tmm\">\n <img\n alt=\"\"\n src=\"https://img.shields.io/github/sponsors/tmm.svg?style=for-the-badge&labelColor=161c22\"\n />\n </a>\n <a aria-label=\"Downloads\" href=\"https://www.npmjs.com/package/wagmi\">\n <img\n alt=\"\"\n src=\"https://img.shields.io/npm/dm/wagmi.svg?style=for-the-badge&labelColor=161c22\"\n />\n </a>\n</p>\n\n# wagmi\n\n**React Hooks library for Ethereum, built on [ethers.js](https://github.com/ethers-io/ethers.js).**\n\n## Features\n\n- šŸš€ 20+ hooks for working with wallets, ENS, contracts, transactions, signing, etc.\n- šŸ’¼ Built-in wallet connectors for MetaMask, WalletConnect, and Coinbase Wallet\n- šŸŒ€ Auto-refresh data on wallet and network changes\n- šŸ¦„ TypeScript ready\n- šŸ’Ø Zero-dependencies (besides ethers.js peer dependency)\n- 🌳 Test suite and documentation\n- šŸ“– MIT License\n\n## Documentation\n\nVisit https://wagmi-xyz.vercel.app to view the full documentation.\n\n## Usage\n\n1. Install the dependencies.\n\n```bash\nnpm add wagmi ethers\n```\n\n2. Wrap your app with the `Provider` component.\n\n```tsx\nimport { Provider } from 'wagmi'\n\nconst App = () => (\n <Provider>\n <YourRoutes />\n </Provider>\n)\n```\n\n3. Use hooks.\n\n```tsx\nimport { useAccount } from 'wagmi'\n\nconst Page = () => {\n const [{ data, error, loading }, disconnect] = useAccount({\n fetchEns: true,\n })\n\n return ...\n}\n```\n\nEvery component inside the `Provider` is set up with the default `InjectedConnector` for connecting wallets and ethers.js [Default Provider](https://docs.ethers.io/v5/api/providers/#providers-getDefaultProvider) for fetching data.\n\nWant to learn more? Check out the [guides](https://wagmi-xyz.vercel.app/guides/connect-wallet) or browse the [API docs](https://wagmi-xyz.vercel.app/docs/provider).\n\n## Community\n\n- Join the [discussions on GitHub](https://github.com/tmm/wagmi/discussions)\n- Follow [@awkweb](https://twitter.com/awkweb) on Twitter for project updates\n- Sign the [guestbook](https://github.com/tmm/wagmi/discussions/2)\n- Share [your project/organization](https://github.com/tmm/wagmi/discussions/201) that uses wagmi\n\n## Support\n\n- awkweb.eth\n- [GitHub Sponsors](https://github.com/sponsors/tmm)\n- [Gitcoin Grant](https://gitcoin.co/grants/4493/wagmi-react-hooks-library-for-ethereum)\n\n## Thanks\n\n- [ricmoo.eth](https://twitter.com/ricmoo) for creating and continued work on [ethers.js](https://github.com/ethers-io/ethers.js)\n- [Mirror](https://mirror.xyz) for creating space to do good work\n\n## License\n\nMIT.\n\n<br />\n\nwagmi\n"
63
63
  }