wagmi 0.5.11 → 0.6.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/README.md +2 -2
- package/actions/dist/wagmi-actions.cjs.dev.js +12 -0
- package/actions/dist/wagmi-actions.cjs.prod.js +12 -0
- package/actions/dist/wagmi-actions.esm.js +1 -1
- package/connectors/mock/dist/wagmi-connectors-mock.cjs.d.ts +1 -0
- package/connectors/mock/dist/wagmi-connectors-mock.cjs.dev.js +12 -0
- package/connectors/mock/dist/wagmi-connectors-mock.cjs.js +7 -0
- package/connectors/mock/dist/wagmi-connectors-mock.cjs.prod.js +12 -0
- package/connectors/mock/dist/wagmi-connectors-mock.esm.js +1 -0
- package/connectors/mock/package.json +4 -0
- package/dist/declarations/src/actions.d.ts +2 -2
- package/dist/declarations/src/client.d.ts +13 -0
- package/dist/declarations/src/connectors/mock.d.ts +1 -0
- package/dist/declarations/src/context.d.ts +2 -13
- package/dist/declarations/src/hooks/accounts/useBalance.d.ts +1 -1
- package/dist/declarations/src/hooks/accounts/useConnect.d.ts +3 -3
- package/dist/declarations/src/hooks/accounts/useSigner.d.ts +2 -2
- package/dist/declarations/src/hooks/contracts/index.d.ts +2 -0
- package/dist/declarations/src/hooks/contracts/useContractInfiniteReads.d.ts +1 -1
- package/dist/declarations/src/hooks/contracts/useContractRead.d.ts +1 -1
- package/dist/declarations/src/hooks/contracts/useContractReads.d.ts +1 -1
- package/dist/declarations/src/hooks/contracts/useContractWrite.d.ts +62 -9
- package/dist/declarations/src/hooks/contracts/useDeprecatedContractWrite.d.ts +27 -0
- package/dist/declarations/src/hooks/contracts/usePrepareContractWrite.d.ts +41 -0
- package/dist/declarations/src/hooks/contracts/useToken.d.ts +1 -1
- package/dist/declarations/src/hooks/ens/useEnsAddress.d.ts +1 -1
- package/dist/declarations/src/hooks/ens/useEnsAvatar.d.ts +1 -1
- package/dist/declarations/src/hooks/ens/useEnsName.d.ts +1 -1
- package/dist/declarations/src/hooks/ens/useEnsResolver.d.ts +1 -1
- package/dist/declarations/src/hooks/index.d.ts +2 -2
- package/dist/declarations/src/hooks/network-status/useBlockNumber.d.ts +1 -1
- package/dist/declarations/src/hooks/network-status/useFeeData.d.ts +1 -1
- package/dist/declarations/src/hooks/transactions/index.d.ts +3 -0
- package/dist/declarations/src/hooks/transactions/useDeprecatedSendTransaction.d.ts +23 -0
- package/dist/declarations/src/hooks/transactions/usePrepareSendTransaction.d.ts +39 -0
- package/dist/declarations/src/hooks/transactions/useSendTransaction.d.ts +63 -8
- package/dist/declarations/src/hooks/transactions/useTransaction.d.ts +21 -0
- package/dist/declarations/src/hooks/transactions/useWaitForTransaction.d.ts +1 -1
- package/dist/declarations/src/index.d.ts +5 -5
- package/dist/wagmi.cjs.dev.js +626 -99
- package/dist/wagmi.cjs.prod.js +626 -99
- package/dist/wagmi.esm.js +623 -100
- package/package.json +18 -9
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install wagmi ethers
|
|
|
17
17
|
Check out the following places for more wagmi-related content:
|
|
18
18
|
|
|
19
19
|
- Join the [discussions on GitHub](https://github.com/wagmi-dev/wagmi/discussions)
|
|
20
|
-
- Follow [@
|
|
20
|
+
- Follow [@wagmi_sh](https://twitter.com/wagmi_sh) on Twitter for project updates
|
|
21
21
|
- Share [your project/organization](https://github.com/wagmi-dev/wagmi/discussions/201) using wagmi
|
|
22
22
|
- Browse the [awesome-wagmi](https://github.com/wagmi-dev/awesome-wagmi) list of awesome projects and resources
|
|
23
23
|
|
|
@@ -27,4 +27,4 @@ If you find wagmi useful, please consider supporting development. Thank you 🙏
|
|
|
27
27
|
|
|
28
28
|
- [GitHub Sponsors](https://github.com/sponsors/tmm?metadata_campaign=readme_wagmi)
|
|
29
29
|
- [Gitcoin Grant](https://gitcoin.co/grants/4493/wagmi-react-hooks-library-for-ethereum)
|
|
30
|
-
- [
|
|
30
|
+
- [wagmi-dev.eth](https://etherscan.io/enslookup-search?search=wagmi-dev.eth)
|
|
@@ -50,6 +50,10 @@ Object.defineProperty(exports, 'fetchToken', {
|
|
|
50
50
|
enumerable: true,
|
|
51
51
|
get: function () { return core.fetchToken; }
|
|
52
52
|
});
|
|
53
|
+
Object.defineProperty(exports, 'fetchTransaction', {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return core.fetchTransaction; }
|
|
56
|
+
});
|
|
53
57
|
Object.defineProperty(exports, 'getAccount', {
|
|
54
58
|
enumerable: true,
|
|
55
59
|
get: function () { return core.getAccount; }
|
|
@@ -70,6 +74,14 @@ Object.defineProperty(exports, 'getWebSocketProvider', {
|
|
|
70
74
|
enumerable: true,
|
|
71
75
|
get: function () { return core.getWebSocketProvider; }
|
|
72
76
|
});
|
|
77
|
+
Object.defineProperty(exports, 'prepareSendTransaction', {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () { return core.prepareSendTransaction; }
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(exports, 'prepareWriteContract', {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () { return core.prepareWriteContract; }
|
|
84
|
+
});
|
|
73
85
|
Object.defineProperty(exports, 'readContract', {
|
|
74
86
|
enumerable: true,
|
|
75
87
|
get: function () { return core.readContract; }
|
|
@@ -50,6 +50,10 @@ Object.defineProperty(exports, 'fetchToken', {
|
|
|
50
50
|
enumerable: true,
|
|
51
51
|
get: function () { return core.fetchToken; }
|
|
52
52
|
});
|
|
53
|
+
Object.defineProperty(exports, 'fetchTransaction', {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return core.fetchTransaction; }
|
|
56
|
+
});
|
|
53
57
|
Object.defineProperty(exports, 'getAccount', {
|
|
54
58
|
enumerable: true,
|
|
55
59
|
get: function () { return core.getAccount; }
|
|
@@ -70,6 +74,14 @@ Object.defineProperty(exports, 'getWebSocketProvider', {
|
|
|
70
74
|
enumerable: true,
|
|
71
75
|
get: function () { return core.getWebSocketProvider; }
|
|
72
76
|
});
|
|
77
|
+
Object.defineProperty(exports, 'prepareSendTransaction', {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () { return core.prepareSendTransaction; }
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(exports, 'prepareWriteContract', {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () { return core.prepareWriteContract; }
|
|
84
|
+
});
|
|
73
85
|
Object.defineProperty(exports, 'readContract', {
|
|
74
86
|
enumerable: true,
|
|
75
87
|
get: function () { return core.readContract; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { connect, disconnect, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract } from '@wagmi/core';
|
|
1
|
+
export { connect, disconnect, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, fetchTransaction, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract } from '@wagmi/core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/connectors/mock";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var mock = require('@wagmi/core/connectors/mock');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'MockConnector', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return mock.MockConnector; }
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var mock = require('@wagmi/core/connectors/mock');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'MockConnector', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return mock.MockConnector; }
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MockConnector } from '@wagmi/core/connectors/mock';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { connect, disconnect, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract, } from '@wagmi/core';
|
|
2
|
-
export type { ConnectArgs, ConnectResult, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchSignerResult, FetchTokenArgs, FetchTokenResult, GetAccountResult, GetContractArgs, GetNetworkResult, GetProviderArgs, GetProviderResult, GetWebSocketProviderArgs, GetWebSocketProviderResult, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, SendTransactionArgs, SendTransactionResult, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, SwitchNetworkArgs, SwitchNetworkResult, WaitForTransactionArgs, WaitForTransactionResult, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchNetworkCallback, WatchReadContractConfig, WatchReadContractResult, WatchProviderCallback, WatchSignerCallback, WatchWebSocketProviderCallback,
|
|
1
|
+
export { connect, disconnect, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, fetchTransaction, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract, } from '@wagmi/core';
|
|
2
|
+
export type { ConnectArgs, ConnectResult, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchSignerResult, FetchTokenArgs, FetchTokenResult, FetchTransactionArgs, FetchTransactionResult, GetAccountResult, GetContractArgs, GetNetworkResult, GetProviderArgs, GetProviderResult, GetWebSocketProviderArgs, GetWebSocketProviderResult, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, SendTransactionArgs, SendTransactionPreparedRequest, SendTransactionResult, SendTransactionUnpreparedRequest, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, SwitchNetworkArgs, SwitchNetworkResult, WaitForTransactionArgs, WaitForTransactionResult, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchNetworkCallback, WatchReadContractConfig, WatchReadContractResult, WatchProviderCallback, WatchSignerCallback, WatchWebSocketProviderCallback, WriteContractArgs, WriteContractPreparedArgs, WriteContractResult, WriteContractUnpreparedArgs, } from '@wagmi/core';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ClientConfig, Client as CoreClient, Provider, WebSocketProvider } from '@wagmi/core';
|
|
2
|
+
import { QueryClient } from 'react-query';
|
|
3
|
+
import { Persister } from 'react-query/persistQueryClient';
|
|
4
|
+
export declare type CreateClientConfig<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = ClientConfig<TProvider, TWebSocketProvider> & {
|
|
5
|
+
queryClient?: QueryClient;
|
|
6
|
+
persister?: Persister | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function createClient<TProvider extends Provider, TWebSocketProvider extends WebSocketProvider>({ queryClient, persister, ...config }: CreateClientConfig<TProvider, TWebSocketProvider>): CoreClient<TProvider, TWebSocketProvider> & {
|
|
9
|
+
queryClient: QueryClient;
|
|
10
|
+
};
|
|
11
|
+
export declare type Client<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = CoreClient<TProvider, TWebSocketProvider> & {
|
|
12
|
+
queryClient: QueryClient;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MockConnector } from '@wagmi/core/connectors/mock';
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
+
import { Provider, WebSocketProvider } from '@wagmi/core';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { QueryClient } from 'react-query';
|
|
4
|
-
import { Persister } from 'react-query/persistQueryClient';
|
|
5
|
-
export declare type CreateClientConfig<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = ClientConfig<TProvider, TWebSocketProvider> & {
|
|
6
|
-
queryClient?: QueryClient;
|
|
7
|
-
persister?: Persister;
|
|
8
|
-
};
|
|
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> & {
|
|
13
|
-
queryClient: QueryClient;
|
|
14
|
-
};
|
|
3
|
+
import { Client } from './client';
|
|
15
4
|
export declare const Context: React.Context<Client<Provider, WebSocketProvider> | undefined>;
|
|
16
5
|
export declare type WagmiConfigProps<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = {
|
|
17
6
|
/** React-decorated Client instance */
|
|
@@ -14,7 +14,7 @@ export declare const queryKey: ({ addressOrName, chainId, formatUnits, token, }:
|
|
|
14
14
|
readonly formatUnits: number | "wei" | "kwei" | "mwei" | "gwei" | "szabo" | "finney" | "ether" | undefined;
|
|
15
15
|
readonly token: string | undefined;
|
|
16
16
|
}];
|
|
17
|
-
export declare function useBalance({ addressOrName, cacheTime, chainId: chainId_, enabled, formatUnits, staleTime, suspense, token, watch, onError, onSettled, onSuccess, }?: UseBalanceArgs & UseBalanceConfig): Pick<import("react-query").QueryObserverResult<FetchBalanceResult, Error>, "
|
|
17
|
+
export declare function useBalance({ addressOrName, cacheTime, chainId: chainId_, enabled, formatUnits, staleTime, suspense, token, watch, onError, onSettled, onSuccess, }?: UseBalanceArgs & UseBalanceConfig): Pick<import("react-query").QueryObserverResult<FetchBalanceResult, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
18
18
|
isIdle: boolean;
|
|
19
19
|
status: "error" | "success" | "idle" | "loading";
|
|
20
20
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -4,20 +4,20 @@ export declare type UseConnectArgs = Partial<ConnectArgs>;
|
|
|
4
4
|
export declare type UseConnectConfig = MutationConfig<ConnectResult, Error, ConnectArgs>;
|
|
5
5
|
export declare const mutationKey: (args: UseConnectArgs) => readonly [{
|
|
6
6
|
readonly chainId?: number | undefined;
|
|
7
|
-
readonly connector?: import("@wagmi/core").Connector<any, any> | undefined;
|
|
7
|
+
readonly connector?: import("@wagmi/core").Connector<any, any, any> | undefined;
|
|
8
8
|
readonly entity: "connect";
|
|
9
9
|
}];
|
|
10
10
|
export declare function useConnect({ chainId, connector, onError, onMutate, onSettled, onSuccess, }?: UseConnectArgs & UseConnectConfig): {
|
|
11
11
|
readonly connect: (args?: Partial<ConnectArgs> | undefined) => void;
|
|
12
12
|
readonly connectAsync: (args?: Partial<ConnectArgs> | undefined) => Promise<ConnectResult<import("@wagmi/core").Provider>>;
|
|
13
|
-
readonly connectors: import("@wagmi/core").Connector<any, any>[];
|
|
13
|
+
readonly connectors: import("@wagmi/core").Connector<any, any, any>[];
|
|
14
14
|
readonly data: ConnectResult<import("@wagmi/core").Provider> | undefined;
|
|
15
15
|
readonly error: Error | null;
|
|
16
16
|
readonly isError: boolean;
|
|
17
17
|
readonly isIdle: boolean;
|
|
18
18
|
readonly isLoading: boolean;
|
|
19
19
|
readonly isSuccess: boolean;
|
|
20
|
-
readonly pendingConnector: import("@wagmi/core").Connector<any, any> | undefined;
|
|
20
|
+
readonly pendingConnector: import("@wagmi/core").Connector<any, any, any> | undefined;
|
|
21
21
|
readonly reset: () => void;
|
|
22
22
|
readonly status: "error" | "success" | "idle" | "loading";
|
|
23
23
|
readonly variables: ConnectArgs | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FetchSignerResult } from '@wagmi/core';
|
|
1
|
+
import { FetchSignerResult, Signer } from '@wagmi/core';
|
|
2
2
|
import { QueryConfig } from '../../types';
|
|
3
3
|
export declare type UseSignerConfig = Omit<QueryConfig<FetchSignerResult, Error>, 'cacheTime' | 'staleTime' | 'enabled'>;
|
|
4
4
|
export declare const queryKey: () => readonly [{
|
|
5
5
|
readonly entity: "signer";
|
|
6
6
|
}];
|
|
7
|
-
export declare function useSigner({ suspense, onError, onSettled, onSuccess, }?: UseSignerConfig): Pick<import("react-query").QueryObserverResult<FetchSignerResult
|
|
7
|
+
export declare function useSigner<TSigner extends Signer>({ suspense, onError, onSettled, onSuccess, }?: UseSignerConfig): Pick<import("react-query").QueryObserverResult<FetchSignerResult<TSigner>, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
8
8
|
isIdle: boolean;
|
|
9
9
|
status: "error" | "success" | "idle" | "loading";
|
|
10
10
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -4,4 +4,6 @@ export { useContractInfiniteReads, paginatedIndexesConfig, } from './useContract
|
|
|
4
4
|
export { useContractRead } from './useContractRead';
|
|
5
5
|
export { useContractReads } from './useContractReads';
|
|
6
6
|
export { useContractWrite } from './useContractWrite';
|
|
7
|
+
export { useDeprecatedContractWrite } from './useDeprecatedContractWrite';
|
|
8
|
+
export { usePrepareContractWrite } from './usePrepareContractWrite';
|
|
7
9
|
export { useToken } from './useToken';
|
|
@@ -17,7 +17,7 @@ export declare const queryKey: ([{ cacheKey, overrides }]: [{
|
|
|
17
17
|
readonly cacheKey: string;
|
|
18
18
|
readonly overrides: import("ethers").CallOverrides | undefined;
|
|
19
19
|
}];
|
|
20
|
-
export declare function useContractInfiniteReads<TPageParam = any>({ cacheKey, cacheTime, contracts, enabled: enabled_, getNextPageParam, isDataEqual, keepPreviousData, onError, onSettled, onSuccess, overrides, select, staleTime, suspense, }: UseContractInfiniteReadsConfig<TPageParam>): Pick<import("react-query").InfiniteQueryObserverResult<import("ethers/lib/utils").Result, Error>, "
|
|
20
|
+
export declare function useContractInfiniteReads<TPageParam = any>({ cacheKey, cacheTime, contracts, enabled: enabled_, getNextPageParam, isDataEqual, keepPreviousData, onError, onSettled, onSuccess, overrides, select, staleTime, suspense, }: UseContractInfiniteReadsConfig<TPageParam>): Pick<import("react-query").InfiniteQueryObserverResult<import("ethers/lib/utils").Result, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch" | "fetchNextPage" | "hasNextPage" | "isFetchingNextPage"> & {
|
|
21
21
|
isIdle: boolean;
|
|
22
22
|
status: "error" | "success" | "idle" | "loading";
|
|
23
23
|
internal: Pick<import("react-query").InfiniteQueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -19,7 +19,7 @@ export declare const queryKey: ([{ addressOrName, args, chainId, contractInterfa
|
|
|
19
19
|
readonly functionName: string;
|
|
20
20
|
readonly overrides: import("ethers").CallOverrides | undefined;
|
|
21
21
|
}];
|
|
22
|
-
export declare function useContractRead({ addressOrName, contractInterface, functionName, args, chainId: chainId_, overrides, cacheOnBlock, cacheTime, enabled: enabled_, isDataEqual, select, staleTime, suspense, watch, onError, onSettled, onSuccess, }: UseContractReadArgs & UseContractReadConfig): Pick<import("react-query").QueryObserverResult<import("ethers/lib/utils").Result, Error>, "
|
|
22
|
+
export declare function useContractRead({ addressOrName, contractInterface, functionName, args, chainId: chainId_, overrides, cacheOnBlock, cacheTime, enabled: enabled_, isDataEqual, select, staleTime, suspense, watch, onError, onSettled, onSuccess, }: UseContractReadArgs & UseContractReadConfig): Pick<import("react-query").QueryObserverResult<import("ethers/lib/utils").Result, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
23
23
|
isIdle: boolean;
|
|
24
24
|
status: "error" | "success" | "idle" | "loading"; /** Subscribe to changes */
|
|
25
25
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -17,7 +17,7 @@ export declare const queryKey: ([{ allowFailure, contracts, overrides }, { block
|
|
|
17
17
|
readonly contracts: import("@wagmi/core/src/actions/contracts/readContracts").ReadContractsContract[];
|
|
18
18
|
readonly overrides: import("ethers").CallOverrides | undefined;
|
|
19
19
|
}];
|
|
20
|
-
export declare function useContractReads({ allowFailure, cacheOnBlock, cacheTime, contracts, overrides, enabled: enabled_, isDataEqual, keepPreviousData, onError, onSettled, onSuccess, select, staleTime, suspense, watch, }: UseContractReadsConfig): Pick<import("react-query").QueryObserverResult<import("ethers/lib/utils").Result[], Error>, "
|
|
20
|
+
export declare function useContractReads({ allowFailure, cacheOnBlock, cacheTime, contracts, overrides, enabled: enabled_, isDataEqual, keepPreviousData, onError, onSettled, onSuccess, select, staleTime, suspense, watch, }: UseContractReadsConfig): Pick<import("react-query").QueryObserverResult<import("ethers/lib/utils").Result[], Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
21
21
|
isIdle: boolean;
|
|
22
22
|
status: "error" | "success" | "idle" | "loading";
|
|
23
23
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -1,18 +1,70 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WriteContractArgs, WriteContractPreparedArgs, WriteContractResult } from '@wagmi/core';
|
|
2
2
|
import { MutationConfig } from '../../types';
|
|
3
|
-
export declare type UseContractWriteArgs =
|
|
4
|
-
|
|
3
|
+
export declare type UseContractWriteArgs = Omit<WriteContractArgs, 'request' | 'type'> & ({
|
|
4
|
+
/**
|
|
5
|
+
* `recklesslyUnprepared`: Allow to pass through unprepared config. Note: This has harmful
|
|
6
|
+
* [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks), it is highly recommended
|
|
7
|
+
* to not use this and instead prepare the config upfront using the `usePrepareContractWrite` hook.
|
|
8
|
+
*
|
|
9
|
+
* `prepared`: The config has been prepared with parameters required for performing a contract write
|
|
10
|
+
* via the [`usePrepareContractWrite` hook](https://wagmi.sh/docs/prepare-hooks/usePrepareContractWrite)
|
|
11
|
+
* */
|
|
12
|
+
mode: 'prepared';
|
|
13
|
+
/** The prepared request to perform a contract write. */
|
|
14
|
+
request: WriteContractPreparedArgs['request'] | undefined;
|
|
15
|
+
} | {
|
|
16
|
+
mode: 'recklesslyUnprepared';
|
|
17
|
+
request?: undefined;
|
|
18
|
+
});
|
|
19
|
+
export declare type UseContractWriteMutationArgs = {
|
|
20
|
+
/**
|
|
21
|
+
* Recklessly pass through unprepared config. Note: This has
|
|
22
|
+
* [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks),
|
|
23
|
+
* it is highly recommended to not use this and instead prepare the config upfront
|
|
24
|
+
* using the `usePrepareContractWrite` function.
|
|
25
|
+
*/
|
|
26
|
+
recklesslySetUnpreparedArgs?: WriteContractArgs['args'];
|
|
27
|
+
recklesslySetUnpreparedOverrides?: WriteContractArgs['overrides'];
|
|
28
|
+
};
|
|
5
29
|
export declare type UseContractWriteConfig = MutationConfig<WriteContractResult, Error, UseContractWriteArgs>;
|
|
6
|
-
|
|
30
|
+
declare type ContractWriteFn = (overrideConfig?: UseContractWriteMutationArgs) => void;
|
|
31
|
+
declare type ContractWriteAsyncFn = (overrideConfig?: UseContractWriteMutationArgs) => Promise<WriteContractResult>;
|
|
32
|
+
declare type MutateFnReturnValue<Args, Fn> = Args extends {
|
|
33
|
+
mode: 'recklesslyUnprepared';
|
|
34
|
+
} ? Fn : Fn | undefined;
|
|
35
|
+
export declare const mutationKey: ([{ addressOrName, args, chainId, contractInterface, functionName, overrides, request, },]: [UseContractWriteArgs]) => readonly [{
|
|
7
36
|
readonly entity: "writeContract";
|
|
8
37
|
readonly addressOrName: string;
|
|
9
38
|
readonly args: any;
|
|
10
39
|
readonly chainId: number | undefined;
|
|
11
40
|
readonly contractInterface: import("ethers").ContractInterface;
|
|
41
|
+
readonly functionName: string;
|
|
12
42
|
readonly overrides: import("ethers").CallOverrides | undefined;
|
|
43
|
+
readonly request: (import("ethers").PopulatedTransaction & {
|
|
44
|
+
to: `0x${string}`;
|
|
45
|
+
gasLimit: import("ethers").BigNumber;
|
|
46
|
+
}) | undefined;
|
|
13
47
|
}];
|
|
14
|
-
|
|
15
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @description Hook for calling an ethers Contract [write](https://docs.ethers.io/v5/api/contract/contract/#Contract--write)
|
|
50
|
+
* method.
|
|
51
|
+
*
|
|
52
|
+
* It is highly recommended to pair this with the [`usePrepareContractWrite` hook](/docs/prepare-hooks/usePrepareContractWrite)
|
|
53
|
+
* to [avoid UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks).
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* import { useContractWrite, usePrepareContractWrite } from 'wagmi'
|
|
57
|
+
*
|
|
58
|
+
* const { config } = usePrepareContractWrite({
|
|
59
|
+
* addressOrName: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1',
|
|
60
|
+
* contractInterface: wagmigotchiABI,
|
|
61
|
+
* functionName: 'feed',
|
|
62
|
+
* })
|
|
63
|
+
* const { data, isLoading, isSuccess, write } = useContractWrite(config)
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
export declare function useContractWrite<Args extends UseContractWriteArgs = UseContractWriteArgs>({ addressOrName, args, chainId, contractInterface, functionName, mode, overrides, request, onError, onMutate, onSettled, onSuccess, }: Args & UseContractWriteConfig): {
|
|
67
|
+
data: import("@wagmi/core").SendTransactionResult | undefined;
|
|
16
68
|
error: Error | null;
|
|
17
69
|
isError: boolean;
|
|
18
70
|
isIdle: boolean;
|
|
@@ -20,7 +72,8 @@ export declare function useContractWrite({ addressOrName, args, chainId, contrac
|
|
|
20
72
|
isSuccess: boolean;
|
|
21
73
|
reset: () => void;
|
|
22
74
|
status: "error" | "success" | "idle" | "loading";
|
|
23
|
-
variables:
|
|
24
|
-
write:
|
|
25
|
-
writeAsync:
|
|
75
|
+
variables: WriteContractArgs | undefined;
|
|
76
|
+
write: MutateFnReturnValue<Args, ContractWriteFn>;
|
|
77
|
+
writeAsync: MutateFnReturnValue<Args, ContractWriteAsyncFn>;
|
|
26
78
|
};
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DeprecatedWriteContractConfig, DeprecatedWriteContractResult } from '@wagmi/core';
|
|
2
|
+
import { MutationConfig } from '../../types';
|
|
3
|
+
export declare type UseDeprecatedContractWriteArgs = DeprecatedWriteContractConfig;
|
|
4
|
+
export declare type UseDeprecatedContractWriteMutationArgs = Pick<DeprecatedWriteContractConfig, 'args' | 'overrides'>;
|
|
5
|
+
export declare type UseDeprecatedContractWriteConfig = MutationConfig<DeprecatedWriteContractResult, Error, UseDeprecatedContractWriteArgs>;
|
|
6
|
+
export declare const mutationKey: ([{ addressOrName, args, chainId, contractInterface, overrides },]: [DeprecatedWriteContractConfig]) => readonly [{
|
|
7
|
+
readonly entity: "writeContract";
|
|
8
|
+
readonly addressOrName: string;
|
|
9
|
+
readonly args: any;
|
|
10
|
+
readonly chainId: number | undefined;
|
|
11
|
+
readonly contractInterface: import("ethers").ContractInterface;
|
|
12
|
+
readonly overrides: import("ethers").CallOverrides | undefined;
|
|
13
|
+
}];
|
|
14
|
+
/** @deprecated */
|
|
15
|
+
export declare function useDeprecatedContractWrite({ addressOrName, args, chainId, contractInterface, functionName, overrides, signerOrProvider, onError, onMutate, onSettled, onSuccess, }: UseDeprecatedContractWriteArgs & UseDeprecatedContractWriteConfig): {
|
|
16
|
+
data: import("@ethersproject/providers").TransactionResponse | undefined;
|
|
17
|
+
error: Error | null;
|
|
18
|
+
isError: boolean;
|
|
19
|
+
isIdle: boolean;
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
isSuccess: boolean;
|
|
22
|
+
reset: () => void;
|
|
23
|
+
status: "error" | "success" | "idle" | "loading";
|
|
24
|
+
variables: DeprecatedWriteContractConfig | undefined;
|
|
25
|
+
write: (overrideConfig?: UseDeprecatedContractWriteMutationArgs | undefined) => void;
|
|
26
|
+
writeAsync: (overrideConfig?: UseDeprecatedContractWriteMutationArgs | undefined) => Promise<import("@ethersproject/providers").TransactionResponse>;
|
|
27
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FetchSignerResult, PrepareWriteContractConfig, PrepareWriteContractResult } from '@wagmi/core';
|
|
2
|
+
import { providers } from 'ethers';
|
|
3
|
+
import { QueryConfig } from '../../types';
|
|
4
|
+
export declare type UsePrepareContractWriteArgs = Omit<PrepareWriteContractConfig, 'signerOrProvider'>;
|
|
5
|
+
export declare type UsePrepareContractWriteConfig = QueryConfig<PrepareWriteContractResult, Error>;
|
|
6
|
+
export declare const queryKey: ({ args, addressOrName, contractInterface, functionName, overrides, }: UsePrepareContractWriteArgs, { chainId, signer, }: {
|
|
7
|
+
chainId?: number | undefined;
|
|
8
|
+
signer?: FetchSignerResult<providers.JsonRpcSigner> | undefined;
|
|
9
|
+
}) => readonly [{
|
|
10
|
+
readonly entity: "prepareContractTransaction";
|
|
11
|
+
readonly addressOrName: string;
|
|
12
|
+
readonly args: any;
|
|
13
|
+
readonly chainId: number | undefined;
|
|
14
|
+
readonly contractInterface: import("ethers").ContractInterface;
|
|
15
|
+
readonly functionName: string;
|
|
16
|
+
readonly overrides: import("ethers").CallOverrides | undefined;
|
|
17
|
+
readonly signer: FetchSignerResult<providers.JsonRpcSigner> | undefined;
|
|
18
|
+
}];
|
|
19
|
+
/**
|
|
20
|
+
* @description Hook for preparing a contract write to be sent via [`useContractWrite`](/docs/hooks/useContractWrite).
|
|
21
|
+
*
|
|
22
|
+
* Eagerly fetches the parameters required for sending a contract write transaction such as the gas estimate.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* import { useContractWrite, usePrepareContractWrite } from 'wagmi'
|
|
26
|
+
*
|
|
27
|
+
* const { config } = usePrepareContractWrite({
|
|
28
|
+
* addressOrName: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1',
|
|
29
|
+
* contractInterface: wagmigotchiABI,
|
|
30
|
+
* functionName: 'feed',
|
|
31
|
+
* })
|
|
32
|
+
* const { data, isLoading, isSuccess, write } = useContractWrite(config)
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
export declare function usePrepareContractWrite({ addressOrName, contractInterface, functionName, args, overrides, cacheTime, enabled, staleTime, suspense, onError, onSettled, onSuccess, }: UsePrepareContractWriteArgs & UsePrepareContractWriteConfig): Pick<import("react-query").QueryObserverResult<PrepareWriteContractResult<import("ethers").Signer>, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
36
|
+
isIdle: boolean;
|
|
37
|
+
status: "error" | "success" | "idle" | "loading";
|
|
38
|
+
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
39
|
+
} & {
|
|
40
|
+
config: PrepareWriteContractResult<import("ethers").Signer>;
|
|
41
|
+
};
|
|
@@ -11,7 +11,7 @@ export declare const queryKey: ({ address, chainId, formatUnits, }: Partial<Fetc
|
|
|
11
11
|
readonly formatUnits: number | "wei" | "kwei" | "mwei" | "gwei" | "szabo" | "finney" | "ether" | undefined;
|
|
12
12
|
}];
|
|
13
13
|
export declare function useToken({ address, chainId: chainId_, formatUnits, cacheTime, enabled, staleTime, // 24 hours
|
|
14
|
-
suspense, onError, onSettled, onSuccess, }?: UseTokenArgs & UseTokenConfig): Pick<import("react-query").QueryObserverResult<FetchTokenResult, Error>, "
|
|
14
|
+
suspense, onError, onSettled, onSuccess, }?: UseTokenArgs & UseTokenConfig): Pick<import("react-query").QueryObserverResult<FetchTokenResult, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
15
15
|
isIdle: boolean;
|
|
16
16
|
status: "error" | "success" | "idle" | "loading";
|
|
17
17
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -11,7 +11,7 @@ export declare const queryKey: ({ chainId, name, }: {
|
|
|
11
11
|
readonly name: string | undefined;
|
|
12
12
|
}];
|
|
13
13
|
export declare function useEnsAddress({ cacheTime, chainId: chainId_, enabled, name, staleTime, // 24 hours
|
|
14
|
-
suspense, onError, onSettled, onSuccess, }?: UseEnsAddressArgs & UseEnsAddressConfig): Pick<import("react-query").QueryObserverResult<FetchEnsAddressResult, Error>, "
|
|
14
|
+
suspense, onError, onSettled, onSuccess, }?: UseEnsAddressArgs & UseEnsAddressConfig): Pick<import("react-query").QueryObserverResult<FetchEnsAddressResult, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
15
15
|
isIdle: boolean;
|
|
16
16
|
status: "error" | "success" | "idle" | "loading";
|
|
17
17
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -11,7 +11,7 @@ export declare const queryKey: ({ addressOrName, chainId, }: {
|
|
|
11
11
|
readonly chainId: number | undefined;
|
|
12
12
|
}];
|
|
13
13
|
export declare function useEnsAvatar({ addressOrName, cacheTime, chainId: chainId_, enabled, staleTime, // 24 hours
|
|
14
|
-
suspense, onError, onSettled, onSuccess, }?: UseEnsAvatarArgs & UseEnsLookupConfig): Pick<import("react-query").QueryObserverResult<FetchEnsAvatarResult, Error>, "
|
|
14
|
+
suspense, onError, onSettled, onSuccess, }?: UseEnsAvatarArgs & UseEnsLookupConfig): Pick<import("react-query").QueryObserverResult<FetchEnsAvatarResult, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
15
15
|
isIdle: boolean;
|
|
16
16
|
status: "error" | "success" | "idle" | "loading";
|
|
17
17
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -11,7 +11,7 @@ export declare const queryKey: ({ address, chainId, }: {
|
|
|
11
11
|
readonly chainId: number | undefined;
|
|
12
12
|
}];
|
|
13
13
|
export declare function useEnsName({ address, cacheTime, chainId: chainId_, enabled, staleTime, // 24 hours
|
|
14
|
-
suspense, onError, onSettled, onSuccess, }?: UseEnsNameArgs & UseEnsNameConfig): Pick<import("react-query").QueryObserverResult<FetchEnsNameResult, Error>, "
|
|
14
|
+
suspense, onError, onSettled, onSuccess, }?: UseEnsNameArgs & UseEnsNameConfig): Pick<import("react-query").QueryObserverResult<FetchEnsNameResult, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
15
15
|
isIdle: boolean;
|
|
16
16
|
status: "error" | "success" | "idle" | "loading";
|
|
17
17
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -11,7 +11,7 @@ export declare const queryKey: ({ chainId, name, }: {
|
|
|
11
11
|
readonly name: string | undefined;
|
|
12
12
|
}];
|
|
13
13
|
export declare function useEnsResolver({ cacheTime, chainId: chainId_, enabled, name, staleTime, // 24 hours
|
|
14
|
-
suspense, onError, onSettled, onSuccess, }?: UseEnsResolverArgs & UseEnsResolverConfig): Pick<import("react-query").QueryObserverResult<FetchEnsResolverResult, Error>, "
|
|
14
|
+
suspense, onError, onSettled, onSuccess, }?: UseEnsResolverArgs & UseEnsResolverConfig): Pick<import("react-query").QueryObserverResult<FetchEnsResolverResult, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
15
15
|
isIdle: boolean;
|
|
16
16
|
status: "error" | "success" | "idle" | "loading";
|
|
17
17
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { useAccount, useBalance, useConnect, useDisconnect, useNetwork, useSigner, useSignMessage, useSignTypedData, useSwitchNetwork, } from './accounts';
|
|
2
|
-
export { paginatedIndexesConfig, useContract, useContractEvent, useContractInfiniteReads, useContractRead, useContractReads, useContractWrite, useToken, } from './contracts';
|
|
2
|
+
export { paginatedIndexesConfig, useContract, useContractEvent, useContractInfiniteReads, useContractRead, useContractReads, useContractWrite, useDeprecatedContractWrite, usePrepareContractWrite, useToken, } from './contracts';
|
|
3
3
|
export { useEnsAddress, useEnsAvatar, useEnsName, useEnsResolver } from './ens';
|
|
4
4
|
export { useBlockNumber, useFeeData } from './network-status';
|
|
5
5
|
export { useProvider, useWebSocketProvider } from './providers';
|
|
6
|
-
export { useSendTransaction, useWaitForTransaction } from './transactions';
|
|
6
|
+
export { useDeprecatedSendTransaction, useSendTransaction, usePrepareSendTransaction, useTransaction, useWaitForTransaction, } from './transactions';
|
|
7
7
|
export { useChainId, useBaseQuery, useQuery, useInfiniteQuery } from './utils';
|
|
@@ -13,7 +13,7 @@ export declare const queryKey: ({ chainId }: {
|
|
|
13
13
|
readonly entity: "blockNumber";
|
|
14
14
|
readonly chainId: number | undefined;
|
|
15
15
|
}];
|
|
16
|
-
export declare function useBlockNumber({ cacheTime, chainId: chainId_, enabled, staleTime, suspense, watch, onBlock, onError, onSettled, onSuccess, }?: UseBlockNumberArgs & UseBlockNumberConfig): Pick<import("react-query").QueryObserverResult<number, Error>, "
|
|
16
|
+
export declare function useBlockNumber({ cacheTime, chainId: chainId_, enabled, staleTime, suspense, watch, onBlock, onError, onSettled, onSuccess, }?: UseBlockNumberArgs & UseBlockNumberConfig): Pick<import("react-query").QueryObserverResult<number, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
17
17
|
isIdle: boolean;
|
|
18
18
|
status: "error" | "success" | "idle" | "loading";
|
|
19
19
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -12,7 +12,7 @@ export declare const queryKey: ({ chainId, formatUnits, }: Partial<FetchFeeDataA
|
|
|
12
12
|
readonly chainId: number | undefined;
|
|
13
13
|
readonly formatUnits: number | "wei" | "kwei" | "mwei" | "gwei" | "szabo" | "finney" | "ether" | undefined;
|
|
14
14
|
}];
|
|
15
|
-
export declare function useFeeData({ cacheTime, chainId: chainId_, enabled, formatUnits, staleTime, suspense, watch, onError, onSettled, onSuccess, }?: UseFeeDataArgs & UseFeedDataConfig): Pick<import("react-query").QueryObserverResult<FetchFeeDataResult, Error>, "
|
|
15
|
+
export declare function useFeeData({ cacheTime, chainId: chainId_, enabled, formatUnits, staleTime, suspense, watch, onError, onSettled, onSuccess, }?: UseFeeDataArgs & UseFeedDataConfig): Pick<import("react-query").QueryObserverResult<FetchFeeDataResult, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
16
16
|
isIdle: boolean;
|
|
17
17
|
status: "error" | "success" | "idle" | "loading";
|
|
18
18
|
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
export { useDeprecatedSendTransaction } from './useDeprecatedSendTransaction';
|
|
2
|
+
export { usePrepareSendTransaction } from './usePrepareSendTransaction';
|
|
1
3
|
export { useSendTransaction } from './useSendTransaction';
|
|
4
|
+
export { useTransaction } from './useTransaction';
|
|
2
5
|
export { useWaitForTransaction } from './useWaitForTransaction';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DeprecatedSendTransactionArgs, DeprecatedSendTransactionResult } from '@wagmi/core';
|
|
2
|
+
import { MutationConfig } from '../../types';
|
|
3
|
+
export declare type UseDeprecatedSendTransactionArgs = Partial<DeprecatedSendTransactionArgs>;
|
|
4
|
+
export declare type UseDeprecatedSendTransactionConfig = MutationConfig<DeprecatedSendTransactionResult, Error, UseDeprecatedSendTransactionArgs>;
|
|
5
|
+
export declare const mutationKey: (args: UseDeprecatedSendTransactionArgs) => readonly [{
|
|
6
|
+
readonly chainId?: number | undefined;
|
|
7
|
+
readonly request?: import("@ethersproject/providers").TransactionRequest | undefined;
|
|
8
|
+
readonly entity: "sendTransaction";
|
|
9
|
+
}];
|
|
10
|
+
/** @deprecated */
|
|
11
|
+
export declare function useDeprecatedSendTransaction({ chainId, request, onError, onMutate, onSettled, onSuccess, }?: UseDeprecatedSendTransactionArgs & UseDeprecatedSendTransactionConfig): {
|
|
12
|
+
data: import("@ethersproject/providers").TransactionResponse | undefined;
|
|
13
|
+
error: Error | null;
|
|
14
|
+
isError: boolean;
|
|
15
|
+
isIdle: boolean;
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
isSuccess: boolean;
|
|
18
|
+
reset: () => void;
|
|
19
|
+
sendTransaction: (args?: DeprecatedSendTransactionArgs | undefined) => void;
|
|
20
|
+
sendTransactionAsync: (args?: DeprecatedSendTransactionArgs | undefined) => Promise<import("@ethersproject/providers").TransactionResponse>;
|
|
21
|
+
status: "error" | "success" | "idle" | "loading";
|
|
22
|
+
variables: Partial<DeprecatedSendTransactionArgs> | undefined;
|
|
23
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PrepareSendTransactionArgs, PrepareSendTransactionResult } from '@wagmi/core';
|
|
2
|
+
import { QueryConfig } from '../../types';
|
|
3
|
+
export declare type UsePrepareSendTransactionArgs = Omit<PrepareSendTransactionArgs, 'request'> & {
|
|
4
|
+
request: Partial<PrepareSendTransactionArgs['request']>;
|
|
5
|
+
};
|
|
6
|
+
export declare type UsePrepareSendTransactionConfig = QueryConfig<PrepareSendTransactionResult, Error>;
|
|
7
|
+
export declare const queryKey: ({ chainId, request, }: Omit<PrepareSendTransactionArgs, "request"> & {
|
|
8
|
+
request: Partial<PrepareSendTransactionArgs['request']>;
|
|
9
|
+
} & {
|
|
10
|
+
chainId?: number | undefined;
|
|
11
|
+
}) => readonly [{
|
|
12
|
+
readonly entity: "prepareSendTransaction";
|
|
13
|
+
readonly chainId: number | undefined;
|
|
14
|
+
readonly request: Partial<import("@ethersproject/providers").TransactionRequest & {
|
|
15
|
+
to: string;
|
|
16
|
+
}>;
|
|
17
|
+
}];
|
|
18
|
+
/**
|
|
19
|
+
* @description Hook for preparing a transaction to be sent via [`useSendTransaction`](/docs/hooks/useSendTransaction).
|
|
20
|
+
*
|
|
21
|
+
* Eagerly fetches the parameters required for sending a transaction such as the gas estimate and resolving an ENS address (if required).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import { useSendTransaction, usePrepareSendTransaction } from 'wagmi'
|
|
25
|
+
*
|
|
26
|
+
* const config = usePrepareSendTransaction({
|
|
27
|
+
* to: 'moxey.eth',
|
|
28
|
+
* value: parseEther('1'),
|
|
29
|
+
* })
|
|
30
|
+
* const result = useSendTransaction(config)
|
|
31
|
+
*/
|
|
32
|
+
export declare function usePrepareSendTransaction({ request, cacheTime, enabled, staleTime, // 24 hours
|
|
33
|
+
suspense, onError, onSettled, onSuccess, }: UsePrepareSendTransactionArgs & UsePrepareSendTransactionConfig): Pick<import("react-query").QueryObserverResult<PrepareSendTransactionResult, Error>, "error" | "data" | "fetchStatus" | "isError" | "isFetched" | "isFetching" | "isLoading" | "isRefetching" | "isSuccess" | "refetch"> & {
|
|
34
|
+
isIdle: boolean;
|
|
35
|
+
status: "error" | "success" | "idle" | "loading";
|
|
36
|
+
internal: Pick<import("react-query").QueryObserverResult<unknown, unknown>, "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isFetchedAfterMount" | "isLoadingError" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isRefetchError" | "isStale" | "remove">;
|
|
37
|
+
} & {
|
|
38
|
+
config: PrepareSendTransactionResult;
|
|
39
|
+
};
|