wagmi 0.2.8 ā 0.2.9
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,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BaseProvider, Web3Provider, WebSocketProvider } from '@ethersproject/providers';
|
|
3
|
-
import { Connector,
|
|
3
|
+
import { Connector, ConnectorData } from 'wagmi-private';
|
|
4
4
|
declare type State = {
|
|
5
5
|
cacheBuster: number;
|
|
6
6
|
connecting?: boolean;
|
|
7
7
|
connector?: Connector;
|
|
8
|
-
data?:
|
|
8
|
+
data?: ConnectorData<Web3Provider>;
|
|
9
9
|
error?: Error;
|
|
10
10
|
};
|
|
11
11
|
declare type ContextValue = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connector } from 'wagmi-private';
|
|
1
|
+
import { Connector, ConnectorData } from 'wagmi-private';
|
|
2
2
|
export declare const useConnect: () => readonly [{
|
|
3
3
|
readonly data: {
|
|
4
4
|
readonly connected: boolean;
|
|
@@ -8,9 +8,6 @@ export declare const useConnect: () => readonly [{
|
|
|
8
8
|
readonly error: Error | undefined;
|
|
9
9
|
readonly loading: boolean | undefined;
|
|
10
10
|
}, (connector: Connector) => Promise<{
|
|
11
|
-
data
|
|
12
|
-
error
|
|
13
|
-
}
|
|
14
|
-
data: undefined;
|
|
15
|
-
error: Error;
|
|
16
|
-
} | undefined>];
|
|
11
|
+
data?: ConnectorData;
|
|
12
|
+
error?: Error;
|
|
13
|
+
}>];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { Provider, useContext } from './context';
|
|
1
|
+
export { Provider, useContext, Context } from './context';
|
|
2
2
|
export type { Props as ProviderProps } from './context';
|
|
3
3
|
export { useAccount, useBalance, useBlockNumber, useConnect, useContract, useContractEvent, useContractRead, useContractWrite, useEnsAvatar, useEnsLookup, 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, } from 'wagmi-private';
|
|
5
|
-
export {
|
|
6
|
-
export type { Chain, Data } from 'wagmi-private';
|
|
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';
|
package/dist/wagmi.cjs.dev.js
CHANGED
|
@@ -718,7 +718,7 @@ var useConnect = () => {
|
|
|
718
718
|
var _ref = _asyncToGenerator(function* (connector) {
|
|
719
719
|
try {
|
|
720
720
|
var activeConnector = globalState === null || globalState === void 0 ? void 0 : globalState.connector;
|
|
721
|
-
if (connector === activeConnector)
|
|
721
|
+
if (connector === activeConnector) throw new wagmiPrivate.ConnectorAlreadyConnectedError();
|
|
722
722
|
setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
|
|
723
723
|
loading: true,
|
|
724
724
|
connector,
|
|
@@ -1561,14 +1561,38 @@ var useContext = () => {
|
|
|
1561
1561
|
return context;
|
|
1562
1562
|
};
|
|
1563
1563
|
|
|
1564
|
+
Object.defineProperty(exports, 'AddChainError', {
|
|
1565
|
+
enumerable: true,
|
|
1566
|
+
get: function () { return wagmiPrivate.AddChainError; }
|
|
1567
|
+
});
|
|
1568
|
+
Object.defineProperty(exports, 'ChainNotConfiguredError', {
|
|
1569
|
+
enumerable: true,
|
|
1570
|
+
get: function () { return wagmiPrivate.ChainNotConfiguredError; }
|
|
1571
|
+
});
|
|
1564
1572
|
Object.defineProperty(exports, 'Connector', {
|
|
1565
1573
|
enumerable: true,
|
|
1566
1574
|
get: function () { return wagmiPrivate.Connector; }
|
|
1567
1575
|
});
|
|
1576
|
+
Object.defineProperty(exports, 'ConnectorAlreadyConnectedError', {
|
|
1577
|
+
enumerable: true,
|
|
1578
|
+
get: function () { return wagmiPrivate.ConnectorAlreadyConnectedError; }
|
|
1579
|
+
});
|
|
1580
|
+
Object.defineProperty(exports, 'ConnectorNotFoundError', {
|
|
1581
|
+
enumerable: true,
|
|
1582
|
+
get: function () { return wagmiPrivate.ConnectorNotFoundError; }
|
|
1583
|
+
});
|
|
1568
1584
|
Object.defineProperty(exports, 'InjectedConnector', {
|
|
1569
1585
|
enumerable: true,
|
|
1570
1586
|
get: function () { return wagmiPrivate.InjectedConnector; }
|
|
1571
1587
|
});
|
|
1588
|
+
Object.defineProperty(exports, 'SwitchChainError', {
|
|
1589
|
+
enumerable: true,
|
|
1590
|
+
get: function () { return wagmiPrivate.SwitchChainError; }
|
|
1591
|
+
});
|
|
1592
|
+
Object.defineProperty(exports, 'UserRejectedRequestError', {
|
|
1593
|
+
enumerable: true,
|
|
1594
|
+
get: function () { return wagmiPrivate.UserRejectedRequestError; }
|
|
1595
|
+
});
|
|
1572
1596
|
Object.defineProperty(exports, 'allChains', {
|
|
1573
1597
|
enumerable: true,
|
|
1574
1598
|
get: function () { return wagmiPrivate.allChains; }
|
package/dist/wagmi.cjs.prod.js
CHANGED
|
@@ -718,7 +718,7 @@ var useConnect = () => {
|
|
|
718
718
|
var _ref = _asyncToGenerator(function* (connector) {
|
|
719
719
|
try {
|
|
720
720
|
var activeConnector = globalState === null || globalState === void 0 ? void 0 : globalState.connector;
|
|
721
|
-
if (connector === activeConnector)
|
|
721
|
+
if (connector === activeConnector) throw new wagmiPrivate.ConnectorAlreadyConnectedError();
|
|
722
722
|
setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
|
|
723
723
|
loading: true,
|
|
724
724
|
connector,
|
|
@@ -1561,14 +1561,38 @@ var useContext = () => {
|
|
|
1561
1561
|
return context;
|
|
1562
1562
|
};
|
|
1563
1563
|
|
|
1564
|
+
Object.defineProperty(exports, 'AddChainError', {
|
|
1565
|
+
enumerable: true,
|
|
1566
|
+
get: function () { return wagmiPrivate.AddChainError; }
|
|
1567
|
+
});
|
|
1568
|
+
Object.defineProperty(exports, 'ChainNotConfiguredError', {
|
|
1569
|
+
enumerable: true,
|
|
1570
|
+
get: function () { return wagmiPrivate.ChainNotConfiguredError; }
|
|
1571
|
+
});
|
|
1564
1572
|
Object.defineProperty(exports, 'Connector', {
|
|
1565
1573
|
enumerable: true,
|
|
1566
1574
|
get: function () { return wagmiPrivate.Connector; }
|
|
1567
1575
|
});
|
|
1576
|
+
Object.defineProperty(exports, 'ConnectorAlreadyConnectedError', {
|
|
1577
|
+
enumerable: true,
|
|
1578
|
+
get: function () { return wagmiPrivate.ConnectorAlreadyConnectedError; }
|
|
1579
|
+
});
|
|
1580
|
+
Object.defineProperty(exports, 'ConnectorNotFoundError', {
|
|
1581
|
+
enumerable: true,
|
|
1582
|
+
get: function () { return wagmiPrivate.ConnectorNotFoundError; }
|
|
1583
|
+
});
|
|
1568
1584
|
Object.defineProperty(exports, 'InjectedConnector', {
|
|
1569
1585
|
enumerable: true,
|
|
1570
1586
|
get: function () { return wagmiPrivate.InjectedConnector; }
|
|
1571
1587
|
});
|
|
1588
|
+
Object.defineProperty(exports, 'SwitchChainError', {
|
|
1589
|
+
enumerable: true,
|
|
1590
|
+
get: function () { return wagmiPrivate.SwitchChainError; }
|
|
1591
|
+
});
|
|
1592
|
+
Object.defineProperty(exports, 'UserRejectedRequestError', {
|
|
1593
|
+
enumerable: true,
|
|
1594
|
+
get: function () { return wagmiPrivate.UserRejectedRequestError; }
|
|
1595
|
+
});
|
|
1572
1596
|
Object.defineProperty(exports, 'allChains', {
|
|
1573
1597
|
enumerable: true,
|
|
1574
1598
|
get: function () { return wagmiPrivate.allChains; }
|
package/dist/wagmi.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { getDefaultProvider } from '@ethersproject/providers';
|
|
3
|
-
import { erc20ABI, defaultChains, defaultL2Chains, allChains, SwitchChainError, ConnectorNotFoundError, UserRejectedRequestError, InjectedConnector } from 'wagmi-private';
|
|
4
|
-
export { Connector, InjectedConnector, allChains, chain, defaultChains, defaultL2Chains, developmentChains, erc1155ABI, erc20ABI, erc721ABI, normalizeChainId } from 'wagmi-private';
|
|
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
5
|
import { utils, ethers, Contract } from 'ethers';
|
|
6
6
|
|
|
7
7
|
function _defineProperty(obj, key, value) {
|
|
@@ -695,7 +695,7 @@ var useConnect = () => {
|
|
|
695
695
|
var _ref = _asyncToGenerator(function* (connector) {
|
|
696
696
|
try {
|
|
697
697
|
var activeConnector = globalState === null || globalState === void 0 ? void 0 : globalState.connector;
|
|
698
|
-
if (connector === activeConnector)
|
|
698
|
+
if (connector === activeConnector) throw new ConnectorAlreadyConnectedError();
|
|
699
699
|
setState(x => _objectSpread2(_objectSpread2({}, x), {}, {
|
|
700
700
|
loading: true,
|
|
701
701
|
connector,
|
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.
|
|
5
|
+
"version": "0.2.9",
|
|
6
6
|
"ethereum": "awkweb.eth",
|
|
7
7
|
"repository": "tmm/wagmi",
|
|
8
8
|
"homepage": "https://wagmi-xyz.vercel.app",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@ethersproject/providers": "^5.5.1",
|
|
49
49
|
"@walletconnect/ethereum-provider": "1.7.1",
|
|
50
|
-
"wagmi-private": "0.1.
|
|
50
|
+
"wagmi-private": "0.1.8",
|
|
51
51
|
"walletlink": "^2.2.8"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"ethers": "^5.5.1",
|
|
58
58
|
"react": "^17.0.0",
|
|
59
59
|
"walletlink": "^2.2.8",
|
|
60
|
-
"wagmi-testing": "0.1.
|
|
60
|
+
"wagmi-testing": "0.1.8"
|
|
61
61
|
},
|
|
62
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š 20+ hooks for working with wallets, ENS, contracts, transactions, signing, etc.\n\nš¼ Built-in wallet connectors for MetaMask, WalletConnect, and Coinbase Wallet\n\nš Auto-refresh data on wallet and network changes\n\nš¦ TypeScript ready\n\nšØ Zero-dependencies (besides ethers.js peer dependency)\n\nš³ Test suite and documentation\n\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\npnpm 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"
|
|
63
63
|
}
|