wagmi 0.3.5 → 0.4.0
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.
- package/dist/declarations/src/context.d.ts +12 -13
- package/dist/declarations/src/hooks/accounts/useSignTypedData.d.ts +2 -2
- package/dist/declarations/src/hooks/contracts/useContractWrite.d.ts +2 -2
- package/dist/declarations/src/hooks/providers/useProvider.d.ts +2 -3
- package/dist/declarations/src/hooks/transactions/useSendTransaction.d.ts +3 -3
- package/dist/declarations/src/hooks/transactions/useWaitForTransaction.d.ts +2 -2
- package/dist/declarations/src/index.d.ts +6 -4
- package/dist/declarations/src/providers/alchemy.d.ts +1 -0
- package/dist/declarations/src/providers/infura.d.ts +1 -0
- package/dist/declarations/src/providers/jsonRpc.d.ts +1 -0
- package/dist/declarations/src/providers/public.d.ts +1 -0
- package/dist/wagmi.cjs.dev.js +47 -13
- package/dist/wagmi.cjs.prod.js +47 -13
- package/dist/wagmi.esm.js +5 -5
- package/package.json +39 -8
- package/providers/alchemy/dist/wagmi-providers-alchemy.cjs.d.ts +1 -0
- package/providers/alchemy/dist/wagmi-providers-alchemy.cjs.dev.js +12 -0
- package/providers/alchemy/dist/wagmi-providers-alchemy.cjs.js +7 -0
- package/providers/alchemy/dist/wagmi-providers-alchemy.cjs.prod.js +12 -0
- package/providers/alchemy/dist/wagmi-providers-alchemy.esm.js +1 -0
- package/providers/alchemy/package.json +4 -0
- package/providers/infura/dist/wagmi-providers-infura.cjs.d.ts +1 -0
- package/providers/infura/dist/wagmi-providers-infura.cjs.dev.js +12 -0
- package/providers/infura/dist/wagmi-providers-infura.cjs.js +7 -0
- package/providers/infura/dist/wagmi-providers-infura.cjs.prod.js +12 -0
- package/providers/infura/dist/wagmi-providers-infura.esm.js +1 -0
- package/providers/infura/package.json +4 -0
- package/providers/jsonRpc/dist/wagmi-providers-jsonRpc.cjs.d.ts +1 -0
- package/providers/jsonRpc/dist/wagmi-providers-jsonRpc.cjs.dev.js +12 -0
- package/providers/jsonRpc/dist/wagmi-providers-jsonRpc.cjs.js +7 -0
- package/providers/jsonRpc/dist/wagmi-providers-jsonRpc.cjs.prod.js +12 -0
- package/providers/jsonRpc/dist/wagmi-providers-jsonRpc.esm.js +1 -0
- package/providers/jsonRpc/package.json +4 -0
- package/providers/public/dist/wagmi-providers-public.cjs.d.ts +1 -0
- package/providers/public/dist/wagmi-providers-public.cjs.dev.js +12 -0
- package/providers/public/dist/wagmi-providers-public.cjs.js +7 -0
- package/providers/public/dist/wagmi-providers-public.cjs.prod.js +12 -0
- package/providers/public/dist/wagmi-providers-public.esm.js +1 -0
- package/providers/public/package.json +4 -0
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { WagmiClient, ClientConfig as WagmiClientConfig } from '@wagmi/core';
|
|
2
|
+
import { ClientConfig, Provider, Client as VanillaClient, WebSocketProvider } from '@wagmi/core';
|
|
4
3
|
import { QueryClient } from 'react-query';
|
|
5
4
|
import { Persister } from 'react-query/persistQueryClient';
|
|
6
|
-
export declare type
|
|
7
|
-
queryClient: QueryClient;
|
|
8
|
-
};
|
|
9
|
-
export declare const Context: React.Context<DecoratedWagmiClient<providers.BaseProvider, providers.WebSocketProvider> | undefined>;
|
|
10
|
-
export declare type ClientConfig<TProvider extends providers.BaseProvider = providers.BaseProvider, TWebSocketProvider extends providers.WebSocketProvider = providers.WebSocketProvider> = WagmiClientConfig<TProvider, TWebSocketProvider> & {
|
|
5
|
+
export declare type CreateClientConfig<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = ClientConfig<TProvider, TWebSocketProvider> & {
|
|
11
6
|
queryClient?: QueryClient;
|
|
12
7
|
persister?: Persister;
|
|
13
8
|
};
|
|
14
|
-
export declare function createClient<TProvider extends
|
|
9
|
+
export declare function createClient<TProvider extends Provider, TWebSocketProvider extends WebSocketProvider>({ queryClient, persister, ...config }?: CreateClientConfig<TProvider, TWebSocketProvider>): VanillaClient<TProvider, TWebSocketProvider> & {
|
|
10
|
+
queryClient: QueryClient;
|
|
11
|
+
};
|
|
12
|
+
export declare type Client<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = VanillaClient<TProvider, TWebSocketProvider> & {
|
|
15
13
|
queryClient: QueryClient;
|
|
16
14
|
};
|
|
17
|
-
export declare
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export declare const Context: React.Context<Client<import("@ethersproject/providers").BaseProvider, import("@ethersproject/providers").WebSocketProvider> | undefined>;
|
|
16
|
+
export declare type WagmiConfigProps<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = {
|
|
17
|
+
/** React-decorated Client instance */
|
|
18
|
+
client?: Client<TProvider, TWebSocketProvider>;
|
|
20
19
|
};
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function useClient<TProvider extends
|
|
20
|
+
export declare function WagmiConfig<TProvider extends Provider, TWebSocketProvider extends WebSocketProvider>({ children, client, }: React.PropsWithChildren<WagmiConfigProps<TProvider, TWebSocketProvider>>): JSX.Element;
|
|
21
|
+
export declare function useClient<TProvider extends Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider>(): Client<TProvider, TWebSocketProvider>;
|
|
@@ -3,8 +3,8 @@ import { MutationConfig } from '../../types';
|
|
|
3
3
|
export declare type UseSignTypedDataArgs = Partial<SignTypedDataArgs>;
|
|
4
4
|
export declare type UseSignTypedDataConfig = MutationConfig<SignTypedDataResult, Error, SignTypedDataArgs>;
|
|
5
5
|
export declare const mutationKey: (args: UseSignTypedDataArgs) => {
|
|
6
|
-
domain?: import("@
|
|
7
|
-
types?: Record<string, import("@
|
|
6
|
+
domain?: import("@wagmi/core/src/actions/accounts/signTypedData").TypedDataDomain | undefined;
|
|
7
|
+
types?: Record<string, import("@wagmi/core/src/actions/accounts/signTypedData").TypedDataField[]> | undefined;
|
|
8
8
|
value?: Record<string, any> | undefined;
|
|
9
9
|
entity: string;
|
|
10
10
|
}[];
|
|
@@ -10,7 +10,7 @@ export declare const mutationKey: ([contractConfig, functionName, { args, overri
|
|
|
10
10
|
readonly overrides: import("ethers").CallOverrides | undefined;
|
|
11
11
|
}];
|
|
12
12
|
export declare function useContractWrite(contractConfig: WriteContractArgs, functionName: string, { args, overrides, onError, onMutate, onSettled, onSuccess, }?: UseContractWriteArgs & UseContractWriteConfig): {
|
|
13
|
-
data: import("@ethersproject/
|
|
13
|
+
data: import("@ethersproject/providers").TransactionResponse | undefined;
|
|
14
14
|
error: Error | null;
|
|
15
15
|
isError: boolean;
|
|
16
16
|
isIdle: boolean;
|
|
@@ -20,5 +20,5 @@ export declare function useContractWrite(contractConfig: WriteContractArgs, func
|
|
|
20
20
|
status: "error" | "loading" | "success" | "idle";
|
|
21
21
|
variables: Partial<WriteContractConfig> | undefined;
|
|
22
22
|
write: (overrideConfig?: WriteContractConfig | undefined) => void;
|
|
23
|
-
writeAsync: (overrideConfig?: WriteContractConfig | undefined) => Promise<import("@ethersproject/
|
|
23
|
+
writeAsync: (overrideConfig?: WriteContractConfig | undefined) => Promise<import("@ethersproject/providers").TransactionResponse>;
|
|
24
24
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GetProviderArgs } from '@wagmi/core';
|
|
1
|
+
import { GetProviderArgs, Provider } from '@wagmi/core';
|
|
3
2
|
export declare type UseProviderArgs = Partial<GetProviderArgs>;
|
|
4
|
-
export declare function useProvider<TProvider extends
|
|
3
|
+
export declare function useProvider<TProvider extends Provider>({ chainId, }?: UseProviderArgs): TProvider;
|
|
@@ -3,11 +3,11 @@ import { MutationConfig } from '../../types';
|
|
|
3
3
|
export declare type UseSendTransactionArgs = Partial<SendTransactionArgs>;
|
|
4
4
|
export declare type UseSendTransactionConfig = MutationConfig<SendTransactionResult, Error, UseSendTransactionArgs>;
|
|
5
5
|
export declare const mutationKey: (args: UseSendTransactionArgs) => readonly [{
|
|
6
|
-
readonly request?: import("@ethersproject/
|
|
6
|
+
readonly request?: import("@ethersproject/providers").TransactionRequest | undefined;
|
|
7
7
|
readonly entity: "sendTransaction";
|
|
8
8
|
}];
|
|
9
9
|
export declare function useSendTransaction({ request, onError, onMutate, onSettled, onSuccess, }?: UseSendTransactionArgs & UseSendTransactionConfig): {
|
|
10
|
-
data: import("@ethersproject/
|
|
10
|
+
data: import("@ethersproject/providers").TransactionResponse | undefined;
|
|
11
11
|
error: Error | null;
|
|
12
12
|
isError: boolean;
|
|
13
13
|
isIdle: boolean;
|
|
@@ -15,7 +15,7 @@ export declare function useSendTransaction({ request, onError, onMutate, onSettl
|
|
|
15
15
|
isSuccess: boolean;
|
|
16
16
|
reset: () => void;
|
|
17
17
|
sendTransaction: (args?: SendTransactionArgs | undefined) => void;
|
|
18
|
-
sendTransactionAsync: (args?: SendTransactionArgs | undefined) => Promise<import("@ethersproject/
|
|
18
|
+
sendTransactionAsync: (args?: SendTransactionArgs | undefined) => Promise<import("@ethersproject/providers").TransactionResponse>;
|
|
19
19
|
status: "error" | "loading" | "success" | "idle";
|
|
20
20
|
variables: Partial<SendTransactionArgs> | undefined;
|
|
21
21
|
};
|
|
@@ -8,9 +8,9 @@ export declare const queryKey: ({ confirmations, chainId, hash, timeout, wait, }
|
|
|
8
8
|
readonly chainId: number | undefined;
|
|
9
9
|
readonly hash: string | undefined;
|
|
10
10
|
readonly timeout: number | undefined;
|
|
11
|
-
readonly wait: ((confirmations?: number | undefined) => Promise<import("@ethersproject/
|
|
11
|
+
readonly wait: ((confirmations?: number | undefined) => Promise<import("@ethersproject/providers").TransactionReceipt>) | undefined;
|
|
12
12
|
}];
|
|
13
|
-
export declare function useWaitForTransaction({ chainId: chainId_, confirmations, hash, timeout, wait, cacheTime, enabled, staleTime, suspense, onError, onSettled, onSuccess, }?: UseWaitForTransactionArgs & UseWaitForTransactionConfig): Pick<import("react-query").QueryObserverResult<import("@ethersproject/
|
|
13
|
+
export declare function useWaitForTransaction({ chainId: chainId_, confirmations, hash, timeout, wait, cacheTime, enabled, staleTime, suspense, onError, onSettled, onSuccess, }?: UseWaitForTransactionArgs & UseWaitForTransactionConfig): Pick<import("react-query").QueryObserverResult<import("@ethersproject/providers").TransactionReceipt, Error>, "data" | "error" | "isError" | "isLoading" | "isSuccess" | "isFetched" | "isFetching" | "isRefetching" | "refetch" | "fetchStatus"> & {
|
|
14
14
|
isIdle: boolean;
|
|
15
15
|
status: "error" | "loading" | "success" | "idle";
|
|
16
16
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "isLoadingError" | "isRefetchError" | "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isStale" | "remove">;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export { createClient,
|
|
2
|
-
|
|
1
|
+
export { createClient, WagmiConfig,
|
|
2
|
+
/** @deprecated use `WagmiConfig` instead */
|
|
3
|
+
WagmiConfig as WagmiProvider, useClient, } from './context';
|
|
4
|
+
export type { CreateClientConfig, WagmiConfigProps } from './context';
|
|
3
5
|
export { useAccount, useBalance, useBlockNumber, useConnect, useContract, useContractEvent, useContractRead, useContractWrite, useDisconnect, useEnsAddress, useEnsAvatar, useEnsName, useEnsResolver, useFeeData, useNetwork, useProvider, useQuery, useSendTransaction, useSignMessage, useSignTypedData, useSigner, useToken, useWaitForTransaction, useWebSocketProvider, } from './hooks';
|
|
4
6
|
export { deserialize, serialize } from './utils';
|
|
5
|
-
export { Client, Connector,
|
|
6
|
-
export type { Chain, ConnectorData, ConnectorEvents, Storage, Unit,
|
|
7
|
+
export { Client, Connector, alchemyRpcUrls, allChains, chain, chainId, configureChains, createStorage, defaultChains, defaultL2Chains, erc20ABI, erc721ABI, etherscanBlockExplorers, infuraRpcUrls, AddChainError, ChainNotConfiguredError, ConnectorAlreadyConnectedError, ConnectorNotFoundError, ProviderRpcError, ResourceUnavailableError, RpcError, SwitchChainError, SwitchChainNotSupportedError, UserRejectedRequestError, } from '@wagmi/core';
|
|
8
|
+
export type { Chain, ChainProvider, ConnectorData, ConnectorEvents, Storage, Unit, } from '@wagmi/core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { alchemyProvider } from '@wagmi/core/providers/alchemy';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { infuraProvider } from '@wagmi/core/providers/infura';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { jsonRpcProvider } from '@wagmi/core/providers/jsonRpc';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { publicProvider } from '@wagmi/core/providers/public';
|
package/dist/wagmi.cjs.dev.js
CHANGED
|
@@ -175,7 +175,6 @@ function serialize(value, replacer, indent, circularReplacer) {
|
|
|
175
175
|
return JSON.stringify(value, createReplacer(replacer, circularReplacer), indent !== null && indent !== void 0 ? indent : undefined);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
const Context = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
179
178
|
function createClient() {
|
|
180
179
|
let {
|
|
181
180
|
queryClient = new reactQuery.QueryClient({
|
|
@@ -212,7 +211,8 @@ function createClient() {
|
|
|
212
211
|
queryClient
|
|
213
212
|
});
|
|
214
213
|
}
|
|
215
|
-
|
|
214
|
+
const Context = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
215
|
+
function WagmiConfig(_ref) {
|
|
216
216
|
let {
|
|
217
217
|
children,
|
|
218
218
|
client = createClient()
|
|
@@ -234,7 +234,7 @@ function Provider(_ref) {
|
|
|
234
234
|
}
|
|
235
235
|
function useClient() {
|
|
236
236
|
const client = React__namespace.useContext(Context);
|
|
237
|
-
if (!client) throw Error('
|
|
237
|
+
if (!client) throw new Error(['`useClient` must be used within `WagmiConfig`.\n', 'Read more: https://wagmi.sh/docs/WagmiConfig'].join('\n'));
|
|
238
238
|
return client;
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -1734,6 +1734,14 @@ function useWaitForTransaction() {
|
|
|
1734
1734
|
});
|
|
1735
1735
|
}
|
|
1736
1736
|
|
|
1737
|
+
Object.defineProperty(exports, 'AddChainError', {
|
|
1738
|
+
enumerable: true,
|
|
1739
|
+
get: function () { return core.AddChainError; }
|
|
1740
|
+
});
|
|
1741
|
+
Object.defineProperty(exports, 'ChainNotConfiguredError', {
|
|
1742
|
+
enumerable: true,
|
|
1743
|
+
get: function () { return core.ChainNotConfiguredError; }
|
|
1744
|
+
});
|
|
1737
1745
|
Object.defineProperty(exports, 'Client', {
|
|
1738
1746
|
enumerable: true,
|
|
1739
1747
|
get: function () { return core.Client; }
|
|
@@ -1742,9 +1750,37 @@ Object.defineProperty(exports, 'Connector', {
|
|
|
1742
1750
|
enumerable: true,
|
|
1743
1751
|
get: function () { return core.Connector; }
|
|
1744
1752
|
});
|
|
1745
|
-
Object.defineProperty(exports, '
|
|
1753
|
+
Object.defineProperty(exports, 'ConnectorAlreadyConnectedError', {
|
|
1754
|
+
enumerable: true,
|
|
1755
|
+
get: function () { return core.ConnectorAlreadyConnectedError; }
|
|
1756
|
+
});
|
|
1757
|
+
Object.defineProperty(exports, 'ConnectorNotFoundError', {
|
|
1758
|
+
enumerable: true,
|
|
1759
|
+
get: function () { return core.ConnectorNotFoundError; }
|
|
1760
|
+
});
|
|
1761
|
+
Object.defineProperty(exports, 'ProviderRpcError', {
|
|
1762
|
+
enumerable: true,
|
|
1763
|
+
get: function () { return core.ProviderRpcError; }
|
|
1764
|
+
});
|
|
1765
|
+
Object.defineProperty(exports, 'ResourceUnavailableError', {
|
|
1746
1766
|
enumerable: true,
|
|
1747
|
-
get: function () { return core.
|
|
1767
|
+
get: function () { return core.ResourceUnavailableError; }
|
|
1768
|
+
});
|
|
1769
|
+
Object.defineProperty(exports, 'RpcError', {
|
|
1770
|
+
enumerable: true,
|
|
1771
|
+
get: function () { return core.RpcError; }
|
|
1772
|
+
});
|
|
1773
|
+
Object.defineProperty(exports, 'SwitchChainError', {
|
|
1774
|
+
enumerable: true,
|
|
1775
|
+
get: function () { return core.SwitchChainError; }
|
|
1776
|
+
});
|
|
1777
|
+
Object.defineProperty(exports, 'SwitchChainNotSupportedError', {
|
|
1778
|
+
enumerable: true,
|
|
1779
|
+
get: function () { return core.SwitchChainNotSupportedError; }
|
|
1780
|
+
});
|
|
1781
|
+
Object.defineProperty(exports, 'UserRejectedRequestError', {
|
|
1782
|
+
enumerable: true,
|
|
1783
|
+
get: function () { return core.UserRejectedRequestError; }
|
|
1748
1784
|
});
|
|
1749
1785
|
Object.defineProperty(exports, 'alchemyRpcUrls', {
|
|
1750
1786
|
enumerable: true,
|
|
@@ -1762,13 +1798,13 @@ Object.defineProperty(exports, 'chainId', {
|
|
|
1762
1798
|
enumerable: true,
|
|
1763
1799
|
get: function () { return core.chainId; }
|
|
1764
1800
|
});
|
|
1765
|
-
Object.defineProperty(exports, '
|
|
1801
|
+
Object.defineProperty(exports, 'configureChains', {
|
|
1766
1802
|
enumerable: true,
|
|
1767
|
-
get: function () { return core.
|
|
1803
|
+
get: function () { return core.configureChains; }
|
|
1768
1804
|
});
|
|
1769
|
-
Object.defineProperty(exports, '
|
|
1805
|
+
Object.defineProperty(exports, 'createStorage', {
|
|
1770
1806
|
enumerable: true,
|
|
1771
|
-
get: function () { return core.
|
|
1807
|
+
get: function () { return core.createStorage; }
|
|
1772
1808
|
});
|
|
1773
1809
|
Object.defineProperty(exports, 'defaultChains', {
|
|
1774
1810
|
enumerable: true,
|
|
@@ -1794,10 +1830,9 @@ Object.defineProperty(exports, 'infuraRpcUrls', {
|
|
|
1794
1830
|
enumerable: true,
|
|
1795
1831
|
get: function () { return core.infuraRpcUrls; }
|
|
1796
1832
|
});
|
|
1797
|
-
exports.
|
|
1798
|
-
exports.WagmiProvider =
|
|
1833
|
+
exports.WagmiConfig = WagmiConfig;
|
|
1834
|
+
exports.WagmiProvider = WagmiConfig;
|
|
1799
1835
|
exports.createClient = createClient;
|
|
1800
|
-
exports.createWagmiClient = createClient;
|
|
1801
1836
|
exports.deserialize = deserialize;
|
|
1802
1837
|
exports.serialize = serialize;
|
|
1803
1838
|
exports.useAccount = useAccount;
|
|
@@ -1823,6 +1858,5 @@ exports.useSignMessage = useSignMessage;
|
|
|
1823
1858
|
exports.useSignTypedData = useSignTypedData;
|
|
1824
1859
|
exports.useSigner = useSigner;
|
|
1825
1860
|
exports.useToken = useToken;
|
|
1826
|
-
exports.useWagmiClient = useClient;
|
|
1827
1861
|
exports.useWaitForTransaction = useWaitForTransaction;
|
|
1828
1862
|
exports.useWebSocketProvider = useWebSocketProvider;
|
package/dist/wagmi.cjs.prod.js
CHANGED
|
@@ -175,7 +175,6 @@ function serialize(value, replacer, indent, circularReplacer) {
|
|
|
175
175
|
return JSON.stringify(value, createReplacer(replacer, circularReplacer), indent !== null && indent !== void 0 ? indent : undefined);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
const Context = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
179
178
|
function createClient() {
|
|
180
179
|
let {
|
|
181
180
|
queryClient = new reactQuery.QueryClient({
|
|
@@ -212,7 +211,8 @@ function createClient() {
|
|
|
212
211
|
queryClient
|
|
213
212
|
});
|
|
214
213
|
}
|
|
215
|
-
|
|
214
|
+
const Context = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
215
|
+
function WagmiConfig(_ref) {
|
|
216
216
|
let {
|
|
217
217
|
children,
|
|
218
218
|
client = createClient()
|
|
@@ -234,7 +234,7 @@ function Provider(_ref) {
|
|
|
234
234
|
}
|
|
235
235
|
function useClient() {
|
|
236
236
|
const client = React__namespace.useContext(Context);
|
|
237
|
-
if (!client) throw Error('
|
|
237
|
+
if (!client) throw new Error(['`useClient` must be used within `WagmiConfig`.\n', 'Read more: https://wagmi.sh/docs/WagmiConfig'].join('\n'));
|
|
238
238
|
return client;
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -1734,6 +1734,14 @@ function useWaitForTransaction() {
|
|
|
1734
1734
|
});
|
|
1735
1735
|
}
|
|
1736
1736
|
|
|
1737
|
+
Object.defineProperty(exports, 'AddChainError', {
|
|
1738
|
+
enumerable: true,
|
|
1739
|
+
get: function () { return core.AddChainError; }
|
|
1740
|
+
});
|
|
1741
|
+
Object.defineProperty(exports, 'ChainNotConfiguredError', {
|
|
1742
|
+
enumerable: true,
|
|
1743
|
+
get: function () { return core.ChainNotConfiguredError; }
|
|
1744
|
+
});
|
|
1737
1745
|
Object.defineProperty(exports, 'Client', {
|
|
1738
1746
|
enumerable: true,
|
|
1739
1747
|
get: function () { return core.Client; }
|
|
@@ -1742,9 +1750,37 @@ Object.defineProperty(exports, 'Connector', {
|
|
|
1742
1750
|
enumerable: true,
|
|
1743
1751
|
get: function () { return core.Connector; }
|
|
1744
1752
|
});
|
|
1745
|
-
Object.defineProperty(exports, '
|
|
1753
|
+
Object.defineProperty(exports, 'ConnectorAlreadyConnectedError', {
|
|
1754
|
+
enumerable: true,
|
|
1755
|
+
get: function () { return core.ConnectorAlreadyConnectedError; }
|
|
1756
|
+
});
|
|
1757
|
+
Object.defineProperty(exports, 'ConnectorNotFoundError', {
|
|
1758
|
+
enumerable: true,
|
|
1759
|
+
get: function () { return core.ConnectorNotFoundError; }
|
|
1760
|
+
});
|
|
1761
|
+
Object.defineProperty(exports, 'ProviderRpcError', {
|
|
1762
|
+
enumerable: true,
|
|
1763
|
+
get: function () { return core.ProviderRpcError; }
|
|
1764
|
+
});
|
|
1765
|
+
Object.defineProperty(exports, 'ResourceUnavailableError', {
|
|
1746
1766
|
enumerable: true,
|
|
1747
|
-
get: function () { return core.
|
|
1767
|
+
get: function () { return core.ResourceUnavailableError; }
|
|
1768
|
+
});
|
|
1769
|
+
Object.defineProperty(exports, 'RpcError', {
|
|
1770
|
+
enumerable: true,
|
|
1771
|
+
get: function () { return core.RpcError; }
|
|
1772
|
+
});
|
|
1773
|
+
Object.defineProperty(exports, 'SwitchChainError', {
|
|
1774
|
+
enumerable: true,
|
|
1775
|
+
get: function () { return core.SwitchChainError; }
|
|
1776
|
+
});
|
|
1777
|
+
Object.defineProperty(exports, 'SwitchChainNotSupportedError', {
|
|
1778
|
+
enumerable: true,
|
|
1779
|
+
get: function () { return core.SwitchChainNotSupportedError; }
|
|
1780
|
+
});
|
|
1781
|
+
Object.defineProperty(exports, 'UserRejectedRequestError', {
|
|
1782
|
+
enumerable: true,
|
|
1783
|
+
get: function () { return core.UserRejectedRequestError; }
|
|
1748
1784
|
});
|
|
1749
1785
|
Object.defineProperty(exports, 'alchemyRpcUrls', {
|
|
1750
1786
|
enumerable: true,
|
|
@@ -1762,13 +1798,13 @@ Object.defineProperty(exports, 'chainId', {
|
|
|
1762
1798
|
enumerable: true,
|
|
1763
1799
|
get: function () { return core.chainId; }
|
|
1764
1800
|
});
|
|
1765
|
-
Object.defineProperty(exports, '
|
|
1801
|
+
Object.defineProperty(exports, 'configureChains', {
|
|
1766
1802
|
enumerable: true,
|
|
1767
|
-
get: function () { return core.
|
|
1803
|
+
get: function () { return core.configureChains; }
|
|
1768
1804
|
});
|
|
1769
|
-
Object.defineProperty(exports, '
|
|
1805
|
+
Object.defineProperty(exports, 'createStorage', {
|
|
1770
1806
|
enumerable: true,
|
|
1771
|
-
get: function () { return core.
|
|
1807
|
+
get: function () { return core.createStorage; }
|
|
1772
1808
|
});
|
|
1773
1809
|
Object.defineProperty(exports, 'defaultChains', {
|
|
1774
1810
|
enumerable: true,
|
|
@@ -1794,10 +1830,9 @@ Object.defineProperty(exports, 'infuraRpcUrls', {
|
|
|
1794
1830
|
enumerable: true,
|
|
1795
1831
|
get: function () { return core.infuraRpcUrls; }
|
|
1796
1832
|
});
|
|
1797
|
-
exports.
|
|
1798
|
-
exports.WagmiProvider =
|
|
1833
|
+
exports.WagmiConfig = WagmiConfig;
|
|
1834
|
+
exports.WagmiProvider = WagmiConfig;
|
|
1799
1835
|
exports.createClient = createClient;
|
|
1800
|
-
exports.createWagmiClient = createClient;
|
|
1801
1836
|
exports.deserialize = deserialize;
|
|
1802
1837
|
exports.serialize = serialize;
|
|
1803
1838
|
exports.useAccount = useAccount;
|
|
@@ -1823,6 +1858,5 @@ exports.useSignMessage = useSignMessage;
|
|
|
1823
1858
|
exports.useSignTypedData = useSignTypedData;
|
|
1824
1859
|
exports.useSigner = useSigner;
|
|
1825
1860
|
exports.useToken = useToken;
|
|
1826
|
-
exports.useWagmiClient = useClient;
|
|
1827
1861
|
exports.useWaitForTransaction = useWaitForTransaction;
|
|
1828
1862
|
exports.useWebSocketProvider = useWebSocketProvider;
|
package/dist/wagmi.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createClient as createClient$1, getProvider, watchProvider, getWebSocketProvider, watchWebSocketProvider, watchAccount, getAccount, fetchBlockNumber, fetchFeeData, fetchBalance, connect, disconnect, getNetwork, watchNetwork, switchNetwork, watchSigner, fetchSigner, signMessage, signTypedData, getContract, watchReadContract, readContract, writeContract, fetchToken, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, sendTransaction, waitForTransaction } from '@wagmi/core';
|
|
3
|
-
export { Client, Connector,
|
|
3
|
+
export { AddChainError, ChainNotConfiguredError, Client, Connector, ConnectorAlreadyConnectedError, ConnectorNotFoundError, ProviderRpcError, ResourceUnavailableError, RpcError, SwitchChainError, SwitchChainNotSupportedError, UserRejectedRequestError, alchemyRpcUrls, allChains, chain, chainId, configureChains, createStorage, defaultChains, defaultL2Chains, erc20ABI, erc721ABI, etherscanBlockExplorers, infuraRpcUrls } from '@wagmi/core';
|
|
4
4
|
import { QueryClient, QueryClientProvider, useQueryClient, useIsRestoring, useQueryErrorResetBoundary, notifyManager, QueryObserver, useMutation } from 'react-query';
|
|
5
5
|
import { persistQueryClient } from 'react-query/persistQueryClient';
|
|
6
6
|
import { createWebStoragePersister } from 'react-query/createWebStoragePersister';
|
|
@@ -152,7 +152,6 @@ function serialize(value, replacer, indent, circularReplacer) {
|
|
|
152
152
|
return JSON.stringify(value, createReplacer(replacer, circularReplacer), indent !== null && indent !== void 0 ? indent : undefined);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
const Context = /*#__PURE__*/React.createContext(undefined);
|
|
156
155
|
function createClient() {
|
|
157
156
|
let {
|
|
158
157
|
queryClient = new QueryClient({
|
|
@@ -189,7 +188,8 @@ function createClient() {
|
|
|
189
188
|
queryClient
|
|
190
189
|
});
|
|
191
190
|
}
|
|
192
|
-
|
|
191
|
+
const Context = /*#__PURE__*/React.createContext(undefined);
|
|
192
|
+
function WagmiConfig(_ref) {
|
|
193
193
|
let {
|
|
194
194
|
children,
|
|
195
195
|
client = createClient()
|
|
@@ -211,7 +211,7 @@ function Provider(_ref) {
|
|
|
211
211
|
}
|
|
212
212
|
function useClient() {
|
|
213
213
|
const client = React.useContext(Context);
|
|
214
|
-
if (!client) throw Error('
|
|
214
|
+
if (!client) throw new Error(['`useClient` must be used within `WagmiConfig`.\n', 'Read more: https://wagmi.sh/docs/WagmiConfig'].join('\n'));
|
|
215
215
|
return client;
|
|
216
216
|
}
|
|
217
217
|
|
|
@@ -1711,4 +1711,4 @@ function useWaitForTransaction() {
|
|
|
1711
1711
|
});
|
|
1712
1712
|
}
|
|
1713
1713
|
|
|
1714
|
-
export {
|
|
1714
|
+
export { WagmiConfig, WagmiConfig as WagmiProvider, createClient, deserialize, serialize, useAccount, useBalance, useBlockNumber, useClient, useConnect, useContract, useContractEvent, useContractRead, useContractWrite, useDisconnect, useEnsAddress, useEnsAvatar, useEnsName, useEnsResolver, useFeeData, useNetwork, useProvider, useQuery, useSendTransaction, useSignMessage, useSignTypedData, useSigner, useToken, useWaitForTransaction, useWebSocketProvider };
|
package/package.json
CHANGED
|
@@ -2,11 +2,21 @@
|
|
|
2
2
|
"name": "wagmi",
|
|
3
3
|
"description": "React Hooks for Ethereum",
|
|
4
4
|
"license": "WAGMIT",
|
|
5
|
-
"version": "0.
|
|
6
|
-
"author": "awkweb.eth",
|
|
7
|
-
"ethereum": "awkweb.eth",
|
|
5
|
+
"version": "0.4.0",
|
|
8
6
|
"repository": "tmm/wagmi",
|
|
7
|
+
"author": "awkweb.eth",
|
|
9
8
|
"homepage": "https://wagmi.sh",
|
|
9
|
+
"ethereum": "awkweb.eth",
|
|
10
|
+
"funding": [
|
|
11
|
+
{
|
|
12
|
+
"type": "gitcoin",
|
|
13
|
+
"url": "https://gitcoin.co/grants/4493/wagmi-react-hooks-library-for-ethereum"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"type": "github",
|
|
17
|
+
"url": "https://github.com/sponsors/tmm"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
10
20
|
"sideEffects": false,
|
|
11
21
|
"main": "dist/wagmi.cjs.js",
|
|
12
22
|
"module": "dist/wagmi.esm.js",
|
|
@@ -31,11 +41,28 @@
|
|
|
31
41
|
"./connectors/walletConnect": {
|
|
32
42
|
"module": "./connectors/walletConnect/dist/wagmi-connectors-walletConnect.esm.js",
|
|
33
43
|
"default": "./connectors/walletConnect/dist/wagmi-connectors-walletConnect.cjs.js"
|
|
44
|
+
},
|
|
45
|
+
"./providers/alchemy": {
|
|
46
|
+
"module": "./providers/alchemy/dist/wagmi-providers-alchemy.esm.js",
|
|
47
|
+
"default": "./providers/alchemy/dist/wagmi-providers-alchemy.cjs.js"
|
|
48
|
+
},
|
|
49
|
+
"./providers/public": {
|
|
50
|
+
"module": "./providers/public/dist/wagmi-providers-public.esm.js",
|
|
51
|
+
"default": "./providers/public/dist/wagmi-providers-public.cjs.js"
|
|
52
|
+
},
|
|
53
|
+
"./providers/infura": {
|
|
54
|
+
"module": "./providers/infura/dist/wagmi-providers-infura.esm.js",
|
|
55
|
+
"default": "./providers/infura/dist/wagmi-providers-infura.cjs.js"
|
|
56
|
+
},
|
|
57
|
+
"./providers/jsonRpc": {
|
|
58
|
+
"module": "./providers/jsonRpc/dist/wagmi-providers-jsonRpc.esm.js",
|
|
59
|
+
"default": "./providers/jsonRpc/dist/wagmi-providers-jsonRpc.cjs.js"
|
|
34
60
|
}
|
|
35
61
|
},
|
|
36
62
|
"files": [
|
|
63
|
+
"/connectors",
|
|
37
64
|
"/dist",
|
|
38
|
-
"/
|
|
65
|
+
"/providers"
|
|
39
66
|
],
|
|
40
67
|
"preconstruct": {
|
|
41
68
|
"entrypoints": [
|
|
@@ -43,7 +70,11 @@
|
|
|
43
70
|
"connectors/coinbaseWallet.ts",
|
|
44
71
|
"connectors/injected.ts",
|
|
45
72
|
"connectors/metaMask.ts",
|
|
46
|
-
"connectors/walletConnect.ts"
|
|
73
|
+
"connectors/walletConnect.ts",
|
|
74
|
+
"providers/alchemy.ts",
|
|
75
|
+
"providers/public.ts",
|
|
76
|
+
"providers/infura.ts",
|
|
77
|
+
"providers/jsonRpc.ts"
|
|
47
78
|
]
|
|
48
79
|
},
|
|
49
80
|
"peerDependencies": {
|
|
@@ -51,10 +82,10 @@
|
|
|
51
82
|
"react": ">=17.0.0"
|
|
52
83
|
},
|
|
53
84
|
"dependencies": {
|
|
54
|
-
"@coinbase/wallet-sdk": "^3.0
|
|
55
|
-
"@wagmi/core": "^0.
|
|
85
|
+
"@coinbase/wallet-sdk": "^3.1.0",
|
|
86
|
+
"@wagmi/core": "^0.3.0",
|
|
56
87
|
"@walletconnect/ethereum-provider": "^1.7.8",
|
|
57
|
-
"react-query": "4.0.0-beta.
|
|
88
|
+
"react-query": "4.0.0-beta.12",
|
|
58
89
|
"use-sync-external-store": "^1.1.0"
|
|
59
90
|
},
|
|
60
91
|
"devDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/providers/alchemy";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var alchemy = require('@wagmi/core/providers/alchemy');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'alchemyProvider', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return alchemy.alchemyProvider; }
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var alchemy = require('@wagmi/core/providers/alchemy');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'alchemyProvider', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return alchemy.alchemyProvider; }
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { alchemyProvider } from '@wagmi/core/providers/alchemy';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/providers/infura";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var infura = require('@wagmi/core/providers/infura');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'infuraProvider', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return infura.infuraProvider; }
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var infura = require('@wagmi/core/providers/infura');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'infuraProvider', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return infura.infuraProvider; }
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { infuraProvider } from '@wagmi/core/providers/infura';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/providers/jsonRpc";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsonRpc = require('@wagmi/core/providers/jsonRpc');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'jsonRpcProvider', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return jsonRpc.jsonRpcProvider; }
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsonRpc = require('@wagmi/core/providers/jsonRpc');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'jsonRpcProvider', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return jsonRpc.jsonRpcProvider; }
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { jsonRpcProvider } from '@wagmi/core/providers/jsonRpc';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/providers/public";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _public = require('@wagmi/core/providers/public');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'publicProvider', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return _public.publicProvider; }
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _public = require('@wagmi/core/providers/public');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'publicProvider', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return _public.publicProvider; }
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { publicProvider } from '@wagmi/core/providers/public';
|