wagmi 2.0.0 → 2.0.2
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 +13 -0
- package/actions/package.json +5 -0
- package/chains/package.json +5 -0
- package/codegen/package.json +5 -0
- package/connectors/package.json +5 -0
- package/dist/esm/context.js +6 -11
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/errors/base.js +1 -1
- package/dist/esm/errors/base.js.map +1 -1
- package/dist/esm/errors/context.js +3 -1
- package/dist/esm/errors/context.js.map +1 -1
- package/dist/esm/exports/actions.js +2 -1
- package/dist/esm/exports/actions.js.map +1 -1
- package/dist/esm/exports/chains.js +1 -0
- package/dist/esm/exports/chains.js.map +1 -1
- package/dist/esm/exports/codegen.js +12 -0
- package/dist/esm/exports/codegen.js.map +1 -0
- package/dist/esm/exports/connectors.js +1 -0
- package/dist/esm/exports/connectors.js.map +1 -1
- package/dist/esm/exports/index.js +43 -15
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/query.js +1 -0
- package/dist/esm/exports/query.js.map +1 -1
- package/dist/esm/hooks/codegen/createUseReadContract.js +33 -0
- package/dist/esm/hooks/codegen/createUseReadContract.js.map +1 -0
- package/dist/esm/hooks/codegen/createUseSimulateContract.js +33 -0
- package/dist/esm/hooks/codegen/createUseSimulateContract.js.map +1 -0
- package/dist/esm/hooks/codegen/createUseWatchContractEvent.js +32 -0
- package/dist/esm/hooks/codegen/createUseWatchContractEvent.js.map +1 -0
- package/dist/esm/hooks/codegen/createUseWriteContract.js +95 -0
- package/dist/esm/hooks/codegen/createUseWriteContract.js.map +1 -0
- package/dist/esm/hooks/useAccount.js +1 -1
- package/dist/esm/hooks/useAccount.js.map +1 -1
- package/dist/esm/hooks/useAccountEffect.js +10 -3
- package/dist/esm/hooks/useAccountEffect.js.map +1 -1
- package/dist/esm/hooks/useBalance.js +4 -4
- package/dist/esm/hooks/useBalance.js.map +1 -1
- package/dist/esm/hooks/useBlock.js +36 -0
- package/dist/esm/hooks/useBlock.js.map +1 -0
- package/dist/esm/hooks/useBlockNumber.js +6 -8
- package/dist/esm/hooks/useBlockNumber.js.map +1 -1
- package/dist/esm/hooks/useBlockTransactionCount.js +20 -0
- package/dist/esm/hooks/useBlockTransactionCount.js.map +1 -0
- package/dist/esm/hooks/useChainId.js +2 -2
- package/dist/esm/hooks/useChainId.js.map +1 -1
- package/dist/esm/hooks/useClient.js +1 -1
- package/dist/esm/hooks/useClient.js.map +1 -1
- package/dist/esm/hooks/useConfig.js +1 -1
- package/dist/esm/hooks/useConfig.js.map +1 -1
- package/dist/esm/hooks/useConnect.js +12 -2
- package/dist/esm/hooks/useConnect.js.map +1 -1
- package/dist/esm/hooks/useConnections.js +2 -2
- package/dist/esm/hooks/useConnections.js.map +1 -1
- package/dist/esm/hooks/useConnectorClient.js +2 -3
- package/dist/esm/hooks/useConnectorClient.js.map +1 -1
- package/dist/esm/hooks/useConnectors.js +10 -0
- package/dist/esm/hooks/useConnectors.js.map +1 -0
- package/dist/esm/hooks/useDisconnect.js +1 -1
- package/dist/esm/hooks/useDisconnect.js.map +1 -1
- package/dist/esm/hooks/useEnsAddress.js +4 -4
- package/dist/esm/hooks/useEnsAddress.js.map +1 -1
- package/dist/esm/hooks/useEnsAvatar.js +4 -4
- package/dist/esm/hooks/useEnsAvatar.js.map +1 -1
- package/dist/esm/hooks/useEnsName.js +4 -4
- package/dist/esm/hooks/useEnsName.js.map +1 -1
- package/dist/esm/hooks/useEnsResolver.js +4 -4
- package/dist/esm/hooks/useEnsResolver.js.map +1 -1
- package/dist/esm/hooks/useEstimateFeesPerGas.js +4 -4
- package/dist/esm/hooks/useEstimateFeesPerGas.js.map +1 -1
- package/dist/esm/hooks/useEstimateGas.js +3 -3
- package/dist/esm/hooks/useEstimateGas.js.map +1 -1
- package/dist/esm/hooks/useEstimateMaxPriorityFeePerGas.js +19 -0
- package/dist/esm/hooks/useEstimateMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/hooks/useFeeHistory.js +20 -0
- package/dist/esm/hooks/useFeeHistory.js.map +1 -0
- package/dist/esm/hooks/useGasPrice.js +20 -0
- package/dist/esm/hooks/useGasPrice.js.map +1 -0
- package/dist/esm/hooks/useInfiniteReadContracts.js +24 -0
- package/dist/esm/hooks/useInfiniteReadContracts.js.map +1 -0
- package/dist/esm/hooks/usePublicClient.js +1 -1
- package/dist/esm/hooks/usePublicClient.js.map +1 -1
- package/dist/esm/hooks/{useContractRead.js → useReadContract.js} +5 -8
- package/dist/esm/hooks/useReadContract.js.map +1 -0
- package/dist/esm/hooks/{useContractReads.js → useReadContracts.js} +7 -9
- package/dist/esm/hooks/useReadContracts.js.map +1 -0
- package/dist/esm/hooks/useReconnect.js +1 -1
- package/dist/esm/hooks/useReconnect.js.map +1 -1
- package/dist/esm/hooks/useSendTransaction.js +1 -1
- package/dist/esm/hooks/useSendTransaction.js.map +1 -1
- package/dist/esm/hooks/useSignMessage.js +1 -1
- package/dist/esm/hooks/useSignMessage.js.map +1 -1
- package/dist/esm/hooks/useSignTypedData.js +1 -1
- package/dist/esm/hooks/useSignTypedData.js.map +1 -1
- package/dist/esm/hooks/{useContractSimulate.js → useSimulateContract.js} +6 -6
- package/dist/esm/hooks/useSimulateContract.js.map +1 -0
- package/dist/esm/hooks/useSwitchAccount.js +1 -1
- package/dist/esm/hooks/useSwitchAccount.js.map +1 -1
- package/dist/esm/hooks/useSwitchChain.js +1 -1
- package/dist/esm/hooks/useSwitchChain.js.map +1 -1
- package/dist/esm/hooks/useToken.js +8 -4
- package/dist/esm/hooks/useToken.js.map +1 -1
- package/dist/esm/hooks/useTransaction.js +8 -4
- package/dist/esm/hooks/useTransaction.js.map +1 -1
- package/dist/esm/hooks/useTransactionCount.js +19 -0
- package/dist/esm/hooks/useTransactionCount.js.map +1 -0
- package/dist/esm/hooks/useVerifyMessage.js +19 -0
- package/dist/esm/hooks/useVerifyMessage.js.map +1 -0
- package/dist/esm/hooks/useVerifyTypedData.js +25 -0
- package/dist/esm/hooks/useVerifyTypedData.js.map +1 -0
- package/dist/esm/hooks/useWaitForTransactionReceipt.js +9 -5
- package/dist/esm/hooks/useWaitForTransactionReceipt.js.map +1 -1
- package/dist/esm/hooks/useWalletClient.js +2 -3
- package/dist/esm/hooks/useWalletClient.js.map +1 -1
- package/dist/esm/hooks/useWatchBlockNumber.js +1 -1
- package/dist/esm/hooks/useWatchBlockNumber.js.map +1 -1
- package/dist/esm/hooks/useWatchBlocks.js +25 -0
- package/dist/esm/hooks/useWatchBlocks.js.map +1 -0
- package/dist/esm/hooks/useWatchContractEvent.js +1 -1
- package/dist/esm/hooks/useWatchContractEvent.js.map +1 -1
- package/dist/esm/hooks/useWatchPendingTransactions.js +1 -1
- package/dist/esm/hooks/useWatchPendingTransactions.js.map +1 -1
- package/dist/esm/hooks/{useContractWrite.js → useWriteContract.js} +5 -5
- package/dist/esm/hooks/useWriteContract.js.map +1 -0
- package/dist/esm/hydrate.js +28 -0
- package/dist/esm/hydrate.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/properties.js +3 -1
- package/dist/esm/types/properties.js.map +1 -1
- package/dist/esm/utils/query.js +10 -1
- package/dist/esm/utils/query.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/context.d.ts +6 -7
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/errors/base.d.ts +3 -0
- package/dist/types/errors/base.d.ts.map +1 -1
- package/dist/types/errors/context.d.ts +3 -0
- package/dist/types/errors/context.d.ts.map +1 -1
- package/dist/types/exports/actions.d.ts.map +1 -1
- package/dist/types/exports/chains.d.ts.map +1 -1
- package/dist/types/exports/codegen.d.ts +6 -0
- package/dist/types/exports/codegen.d.ts.map +1 -0
- package/dist/types/exports/connectors.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +33 -10
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/query.d.ts.map +1 -1
- package/dist/types/hooks/codegen/createUseReadContract.d.ts +18 -0
- package/dist/types/hooks/codegen/createUseReadContract.d.ts.map +1 -0
- package/dist/types/hooks/codegen/createUseSimulateContract.d.ts +21 -0
- package/dist/types/hooks/codegen/createUseSimulateContract.d.ts.map +1 -0
- package/dist/types/hooks/codegen/createUseWatchContractEvent.d.ts +14 -0
- package/dist/types/hooks/codegen/createUseWatchContractEvent.d.ts.map +1 -0
- package/dist/types/hooks/codegen/createUseWriteContract.d.ts +27 -0
- package/dist/types/hooks/codegen/createUseWriteContract.d.ts.map +1 -0
- package/dist/types/hooks/useAccount.d.ts +1 -1
- package/dist/types/hooks/useAccount.d.ts.map +1 -1
- package/dist/types/hooks/useAccountEffect.d.ts +2 -2
- package/dist/types/hooks/useAccountEffect.d.ts.map +1 -1
- package/dist/types/hooks/useBalance.d.ts +6 -8
- package/dist/types/hooks/useBalance.d.ts.map +1 -1
- package/dist/types/hooks/useBlock.d.ts +14 -0
- package/dist/types/hooks/useBlock.d.ts.map +1 -0
- package/dist/types/hooks/useBlockNumber.d.ts +8 -9
- package/dist/types/hooks/useBlockNumber.d.ts.map +1 -1
- package/dist/types/hooks/useBlockTransactionCount.d.ts +10 -0
- package/dist/types/hooks/useBlockTransactionCount.d.ts.map +1 -0
- package/dist/types/hooks/useChainId.d.ts +1 -1
- package/dist/types/hooks/useChainId.d.ts.map +1 -1
- package/dist/types/hooks/useClient.d.ts +1 -1
- package/dist/types/hooks/useClient.d.ts.map +1 -1
- package/dist/types/hooks/useConfig.d.ts +1 -1
- package/dist/types/hooks/useConfig.d.ts.map +1 -1
- package/dist/types/hooks/useConnect.d.ts +5 -5
- package/dist/types/hooks/useConnect.d.ts.map +1 -1
- package/dist/types/hooks/useConnections.d.ts +1 -1
- package/dist/types/hooks/useConnections.d.ts.map +1 -1
- package/dist/types/hooks/useConnectorClient.d.ts +4 -4
- package/dist/types/hooks/useConnectorClient.d.ts.map +1 -1
- package/dist/types/hooks/useConnectors.d.ts +7 -0
- package/dist/types/hooks/useConnectors.d.ts.map +1 -0
- package/dist/types/hooks/useDisconnect.d.ts +4 -4
- package/dist/types/hooks/useDisconnect.d.ts.map +1 -1
- package/dist/types/hooks/useEnsAddress.d.ts +6 -8
- package/dist/types/hooks/useEnsAddress.d.ts.map +1 -1
- package/dist/types/hooks/useEnsAvatar.d.ts +6 -8
- package/dist/types/hooks/useEnsAvatar.d.ts.map +1 -1
- package/dist/types/hooks/useEnsName.d.ts +6 -8
- package/dist/types/hooks/useEnsName.d.ts.map +1 -1
- package/dist/types/hooks/useEnsResolver.d.ts +6 -8
- package/dist/types/hooks/useEnsResolver.d.ts.map +1 -1
- package/dist/types/hooks/useEstimateFeesPerGas.d.ts +6 -8
- package/dist/types/hooks/useEstimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/hooks/useEstimateGas.d.ts +6 -8
- package/dist/types/hooks/useEstimateGas.d.ts.map +1 -1
- package/dist/types/hooks/useEstimateMaxPriorityFeePerGas.d.ts +10 -0
- package/dist/types/hooks/useEstimateMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/types/hooks/useFeeHistory.d.ts +10 -0
- package/dist/types/hooks/useFeeHistory.d.ts.map +1 -0
- package/dist/types/hooks/useGasPrice.d.ts +10 -0
- package/dist/types/hooks/useGasPrice.d.ts.map +1 -0
- package/dist/types/hooks/useInfiniteReadContracts.d.ts +11 -0
- package/dist/types/hooks/useInfiniteReadContracts.d.ts.map +1 -0
- package/dist/types/hooks/usePublicClient.d.ts +1 -1
- package/dist/types/hooks/usePublicClient.d.ts.map +1 -1
- package/dist/types/hooks/{useContractRead.d.ts → useReadContract.d.ts} +8 -10
- package/dist/types/hooks/useReadContract.d.ts.map +1 -0
- package/dist/types/hooks/useReadContracts.d.ts +11 -0
- package/dist/types/hooks/useReadContracts.d.ts.map +1 -0
- package/dist/types/hooks/useReconnect.d.ts +4 -4
- package/dist/types/hooks/useReconnect.d.ts.map +1 -1
- package/dist/types/hooks/useSendTransaction.d.ts +4 -4
- package/dist/types/hooks/useSendTransaction.d.ts.map +1 -1
- package/dist/types/hooks/useSignMessage.d.ts +4 -4
- package/dist/types/hooks/useSignMessage.d.ts.map +1 -1
- package/dist/types/hooks/useSignTypedData.d.ts +4 -4
- package/dist/types/hooks/useSignTypedData.d.ts.map +1 -1
- package/dist/types/hooks/{useContractSimulate.d.ts → useSimulateContract.d.ts} +8 -10
- package/dist/types/hooks/useSimulateContract.d.ts.map +1 -0
- package/dist/types/hooks/useSwitchAccount.d.ts +4 -4
- package/dist/types/hooks/useSwitchAccount.d.ts.map +1 -1
- package/dist/types/hooks/useSwitchChain.d.ts +4 -4
- package/dist/types/hooks/useSwitchChain.d.ts.map +1 -1
- package/dist/types/hooks/useToken.d.ts +10 -8
- package/dist/types/hooks/useToken.d.ts.map +1 -1
- package/dist/types/hooks/useTransaction.d.ts +6 -8
- package/dist/types/hooks/useTransaction.d.ts.map +1 -1
- package/dist/types/hooks/useTransactionCount.d.ts +11 -0
- package/dist/types/hooks/useTransactionCount.d.ts.map +1 -0
- package/dist/types/hooks/useVerifyMessage.d.ts +11 -0
- package/dist/types/hooks/useVerifyMessage.d.ts.map +1 -0
- package/dist/types/hooks/useVerifyTypedData.d.ts +11 -0
- package/dist/types/hooks/useVerifyTypedData.d.ts.map +1 -0
- package/dist/types/hooks/useWaitForTransactionReceipt.d.ts +6 -8
- package/dist/types/hooks/useWaitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/hooks/useWalletClient.d.ts +4 -4
- package/dist/types/hooks/useWalletClient.d.ts.map +1 -1
- package/dist/types/hooks/useWatchBlockNumber.d.ts +1 -1
- package/dist/types/hooks/useWatchBlockNumber.d.ts.map +1 -1
- package/dist/types/hooks/useWatchBlocks.d.ts +9 -0
- package/dist/types/hooks/useWatchBlocks.d.ts.map +1 -0
- package/dist/types/hooks/useWatchContractEvent.d.ts +1 -1
- package/dist/types/hooks/useWatchContractEvent.d.ts.map +1 -1
- package/dist/types/hooks/useWatchPendingTransactions.d.ts +1 -1
- package/dist/types/hooks/useWatchPendingTransactions.d.ts.map +1 -1
- package/dist/types/hooks/useWriteContract.d.ts +15 -0
- package/dist/types/hooks/useWriteContract.d.ts.map +1 -0
- package/dist/types/hydrate.d.ts +9 -0
- package/dist/types/hydrate.d.ts.map +1 -0
- package/dist/types/types/properties.d.ts +10 -1
- package/dist/types/types/properties.d.ts.map +1 -1
- package/dist/types/utils/query.d.ts +12 -3
- package/dist/types/utils/query.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +26 -34
- package/query/package.json +5 -0
- package/src/context.ts +15 -14
- package/src/errors/base.ts +2 -1
- package/src/errors/context.ts +6 -1
- package/src/exports/actions.ts +2 -1
- package/src/exports/chains.ts +1 -0
- package/src/exports/codegen.ts +17 -0
- package/src/exports/connectors.ts +1 -0
- package/src/exports/index.ts +135 -37
- package/src/exports/query.ts +1 -0
- package/src/hooks/codegen/createUseReadContract.ts +128 -0
- package/src/hooks/codegen/createUseSimulateContract.ts +121 -0
- package/src/hooks/codegen/createUseWatchContractEvent.ts +98 -0
- package/src/hooks/codegen/createUseWriteContract.ts +290 -0
- package/src/hooks/useAccount.ts +1 -1
- package/src/hooks/useAccountEffect.ts +11 -4
- package/src/hooks/useBalance.ts +14 -21
- package/src/hooks/useBlock.ts +129 -0
- package/src/hooks/useBlockNumber.ts +30 -32
- package/src/hooks/useBlockTransactionCount.ts +65 -0
- package/src/hooks/useChainId.ts +2 -1
- package/src/hooks/useClient.ts +1 -1
- package/src/hooks/useConfig.ts +1 -1
- package/src/hooks/useConnect.ts +21 -6
- package/src/hooks/useConnections.ts +2 -1
- package/src/hooks/useConnectorClient.ts +9 -7
- package/src/hooks/useConnectors.ts +28 -0
- package/src/hooks/useDisconnect.ts +4 -4
- package/src/hooks/useEnsAddress.ts +18 -21
- package/src/hooks/useEnsAvatar.ts +18 -19
- package/src/hooks/useEnsName.ts +14 -21
- package/src/hooks/useEnsResolver.ts +18 -21
- package/src/hooks/useEstimateFeesPerGas.ts +14 -21
- package/src/hooks/useEstimateGas.ts +19 -22
- package/src/hooks/useEstimateMaxPriorityFeePerGas.ts +61 -0
- package/src/hooks/useFeeHistory.ts +62 -0
- package/src/hooks/useGasPrice.ts +60 -0
- package/src/hooks/useInfiniteReadContracts.ts +89 -0
- package/src/hooks/usePublicClient.ts +1 -1
- package/src/hooks/{useContractRead.ts → useReadContract.ts} +22 -25
- package/src/hooks/{useContractReads.ts → useReadContracts.ts} +27 -28
- package/src/hooks/useReconnect.ts +4 -4
- package/src/hooks/useSendTransaction.ts +4 -4
- package/src/hooks/useSignMessage.ts +4 -4
- package/src/hooks/useSignTypedData.ts +4 -4
- package/src/hooks/{useContractSimulate.ts → useSimulateContract.ts} +26 -27
- package/src/hooks/useSwitchAccount.ts +4 -4
- package/src/hooks/useSwitchChain.ts +8 -4
- package/src/hooks/useToken.ts +18 -21
- package/src/hooks/useTransaction.ts +22 -21
- package/src/hooks/useTransactionCount.ts +59 -0
- package/src/hooks/useVerifyMessage.ts +59 -0
- package/src/hooks/useVerifyTypedData.ts +81 -0
- package/src/hooks/useWaitForTransactionReceipt.ts +19 -22
- package/src/hooks/useWalletClient.ts +25 -21
- package/src/hooks/useWatchBlockNumber.ts +1 -1
- package/src/hooks/useWatchBlocks.ts +61 -0
- package/src/hooks/useWatchContractEvent.ts +1 -1
- package/src/hooks/useWatchPendingTransactions.ts +1 -1
- package/src/hooks/{useContractWrite.ts → useWriteContract.ts} +18 -14
- package/src/hydrate.ts +36 -0
- package/src/types/properties.ts +43 -1
- package/src/utils/query.ts +66 -15
- package/src/version.ts +1 -1
- package/dist/esm/hooks/useContractRead.js.map +0 -1
- package/dist/esm/hooks/useContractReads.js.map +0 -1
- package/dist/esm/hooks/useContractSimulate.js.map +0 -1
- package/dist/esm/hooks/useContractWrite.js.map +0 -1
- package/dist/types/hooks/useContractRead.d.ts.map +0 -1
- package/dist/types/hooks/useContractReads.d.ts +0 -13
- package/dist/types/hooks/useContractReads.d.ts.map +0 -1
- package/dist/types/hooks/useContractSimulate.d.ts.map +0 -1
- package/dist/types/hooks/useContractWrite.d.ts +0 -15
- package/dist/types/hooks/useContractWrite.d.ts.map +0 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
Config,
|
|
5
|
+
GetEnsAvatarErrorType,
|
|
6
|
+
ResolvedRegister,
|
|
7
|
+
} from '@wagmi/core'
|
|
4
8
|
import { type Evaluate } from '@wagmi/core/internal'
|
|
5
9
|
import {
|
|
6
10
|
type GetEnsAvatarData,
|
|
@@ -10,12 +14,8 @@ import {
|
|
|
10
14
|
getEnsAvatarQueryOptions,
|
|
11
15
|
} from '@wagmi/core/query'
|
|
12
16
|
|
|
13
|
-
import type { ConfigParameter } from '../types/properties.js'
|
|
14
|
-
import {
|
|
15
|
-
type UseQueryParameters,
|
|
16
|
-
type UseQueryReturnType,
|
|
17
|
-
useQuery,
|
|
18
|
-
} from '../utils/query.js'
|
|
17
|
+
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
18
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
19
|
import { useChainId } from './useChainId.js'
|
|
20
20
|
import { useConfig } from './useConfig.js'
|
|
21
21
|
|
|
@@ -24,20 +24,19 @@ export type UseEnsAvatarParameters<
|
|
|
24
24
|
selectData = GetEnsAvatarData,
|
|
25
25
|
> = Evaluate<
|
|
26
26
|
GetEnsAvatarOptions<config> &
|
|
27
|
-
ConfigParameter<config> &
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
27
|
+
ConfigParameter<config> &
|
|
28
|
+
QueryParameter<
|
|
29
|
+
GetEnsAvatarQueryFnData,
|
|
30
|
+
GetEnsAvatarErrorType,
|
|
31
|
+
selectData,
|
|
32
|
+
GetEnsAvatarQueryKey<config>
|
|
33
|
+
>
|
|
35
34
|
>
|
|
36
35
|
|
|
37
36
|
export type UseEnsAvatarReturnType<selectData = GetEnsAvatarData> =
|
|
38
|
-
UseQueryReturnType<selectData,
|
|
37
|
+
UseQueryReturnType<selectData, GetEnsAvatarErrorType>
|
|
39
38
|
|
|
40
|
-
/** https://
|
|
39
|
+
/** https://wagmi.sh/react/api/hooks/useEnsAvatar */
|
|
41
40
|
export function useEnsAvatar<
|
|
42
41
|
config extends Config = ResolvedRegister['config'],
|
|
43
42
|
selectData = GetEnsAvatarData,
|
|
@@ -49,11 +48,11 @@ export function useEnsAvatar<
|
|
|
49
48
|
const config = useConfig(parameters)
|
|
50
49
|
const chainId = useChainId()
|
|
51
50
|
|
|
52
|
-
const
|
|
51
|
+
const options = getEnsAvatarQueryOptions(config, {
|
|
53
52
|
...parameters,
|
|
54
53
|
chainId: parameters.chainId ?? chainId,
|
|
55
54
|
})
|
|
56
55
|
const enabled = Boolean(name && (query.enabled ?? true))
|
|
57
56
|
|
|
58
|
-
return useQuery({ ...
|
|
57
|
+
return useQuery({ ...query, ...options, enabled })
|
|
59
58
|
}
|
package/src/hooks/useEnsName.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import type { Config,
|
|
3
|
+
import type { Config, GetEnsNameErrorType, ResolvedRegister } from '@wagmi/core'
|
|
4
4
|
import { type Evaluate } from '@wagmi/core/internal'
|
|
5
5
|
import {
|
|
6
6
|
type GetEnsNameData,
|
|
@@ -10,12 +10,8 @@ import {
|
|
|
10
10
|
getEnsNameQueryOptions,
|
|
11
11
|
} from '@wagmi/core/query'
|
|
12
12
|
|
|
13
|
-
import type { ConfigParameter } from '../types/properties.js'
|
|
14
|
-
import {
|
|
15
|
-
type UseQueryParameters,
|
|
16
|
-
type UseQueryReturnType,
|
|
17
|
-
useQuery,
|
|
18
|
-
} from '../utils/query.js'
|
|
13
|
+
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
14
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
15
|
import { useChainId } from './useChainId.js'
|
|
20
16
|
import { useConfig } from './useConfig.js'
|
|
21
17
|
|
|
@@ -24,22 +20,19 @@ export type UseEnsNameParameters<
|
|
|
24
20
|
selectData = GetEnsNameData,
|
|
25
21
|
> = Evaluate<
|
|
26
22
|
GetEnsNameOptions<config> &
|
|
27
|
-
ConfigParameter<config> &
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
>
|
|
35
|
-
| undefined
|
|
36
|
-
}
|
|
23
|
+
ConfigParameter<config> &
|
|
24
|
+
QueryParameter<
|
|
25
|
+
GetEnsNameQueryFnData,
|
|
26
|
+
GetEnsNameErrorType,
|
|
27
|
+
selectData,
|
|
28
|
+
GetEnsNameQueryKey<config>
|
|
29
|
+
>
|
|
37
30
|
>
|
|
38
31
|
|
|
39
32
|
export type UseEnsNameReturnType<selectData = GetEnsNameData> =
|
|
40
|
-
UseQueryReturnType<selectData,
|
|
33
|
+
UseQueryReturnType<selectData, GetEnsNameErrorType>
|
|
41
34
|
|
|
42
|
-
/** https://
|
|
35
|
+
/** https://wagmi.sh/react/api/hooks/useEnsName */
|
|
43
36
|
export function useEnsName<
|
|
44
37
|
config extends Config = ResolvedRegister['config'],
|
|
45
38
|
selectData = GetEnsNameData,
|
|
@@ -51,11 +44,11 @@ export function useEnsName<
|
|
|
51
44
|
const config = useConfig(parameters)
|
|
52
45
|
const chainId = useChainId()
|
|
53
46
|
|
|
54
|
-
const
|
|
47
|
+
const options = getEnsNameQueryOptions(config, {
|
|
55
48
|
...parameters,
|
|
56
49
|
chainId: parameters.chainId ?? chainId,
|
|
57
50
|
})
|
|
58
51
|
const enabled = Boolean(address && (query.enabled ?? true))
|
|
59
52
|
|
|
60
|
-
return useQuery({ ...
|
|
53
|
+
return useQuery({ ...query, ...options, enabled })
|
|
61
54
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
Config,
|
|
5
|
+
GetEnsResolverErrorType,
|
|
6
|
+
ResolvedRegister,
|
|
7
|
+
} from '@wagmi/core'
|
|
4
8
|
import { type Evaluate } from '@wagmi/core/internal'
|
|
5
9
|
import {
|
|
6
10
|
type GetEnsResolverData,
|
|
@@ -10,12 +14,8 @@ import {
|
|
|
10
14
|
getEnsResolverQueryOptions,
|
|
11
15
|
} from '@wagmi/core/query'
|
|
12
16
|
|
|
13
|
-
import type { ConfigParameter } from '../types/properties.js'
|
|
14
|
-
import {
|
|
15
|
-
type UseQueryParameters,
|
|
16
|
-
type UseQueryReturnType,
|
|
17
|
-
useQuery,
|
|
18
|
-
} from '../utils/query.js'
|
|
17
|
+
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
18
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
19
|
import { useChainId } from './useChainId.js'
|
|
20
20
|
import { useConfig } from './useConfig.js'
|
|
21
21
|
|
|
@@ -24,22 +24,19 @@ export type UseEnsResolverParameters<
|
|
|
24
24
|
selectData = GetEnsResolverData,
|
|
25
25
|
> = Evaluate<
|
|
26
26
|
GetEnsResolverOptions<config> &
|
|
27
|
-
ConfigParameter<config> &
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
>
|
|
35
|
-
| undefined
|
|
36
|
-
}
|
|
27
|
+
ConfigParameter<config> &
|
|
28
|
+
QueryParameter<
|
|
29
|
+
GetEnsResolverQueryFnData,
|
|
30
|
+
GetEnsResolverErrorType,
|
|
31
|
+
selectData,
|
|
32
|
+
GetEnsResolverQueryKey<config>
|
|
33
|
+
>
|
|
37
34
|
>
|
|
38
35
|
|
|
39
36
|
export type UseEnsResolverReturnType<selectData = GetEnsResolverData> =
|
|
40
|
-
UseQueryReturnType<selectData,
|
|
37
|
+
UseQueryReturnType<selectData, GetEnsResolverErrorType>
|
|
41
38
|
|
|
42
|
-
/** https://
|
|
39
|
+
/** https://wagmi.sh/react/api/hooks/useEnsResolver */
|
|
43
40
|
export function useEnsResolver<
|
|
44
41
|
config extends Config = ResolvedRegister['config'],
|
|
45
42
|
selectData = GetEnsResolverData,
|
|
@@ -51,11 +48,11 @@ export function useEnsResolver<
|
|
|
51
48
|
const config = useConfig(parameters)
|
|
52
49
|
const chainId = useChainId()
|
|
53
50
|
|
|
54
|
-
const
|
|
51
|
+
const options = getEnsResolverQueryOptions(config, {
|
|
55
52
|
...parameters,
|
|
56
53
|
chainId: parameters.chainId ?? chainId,
|
|
57
54
|
})
|
|
58
55
|
const enabled = Boolean(name && (query.enabled ?? true))
|
|
59
56
|
|
|
60
|
-
return useQuery({ ...
|
|
57
|
+
return useQuery({ ...query, ...options, enabled })
|
|
61
58
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
type Config,
|
|
5
|
-
type
|
|
5
|
+
type EstimateFeesPerGasErrorType,
|
|
6
6
|
type ResolvedRegister,
|
|
7
7
|
} from '@wagmi/core'
|
|
8
8
|
import { type Evaluate } from '@wagmi/core/internal'
|
|
@@ -15,12 +15,8 @@ import {
|
|
|
15
15
|
} from '@wagmi/core/query'
|
|
16
16
|
import type { FeeValuesType } from 'viem'
|
|
17
17
|
|
|
18
|
-
import type { ConfigParameter } from '../types/properties.js'
|
|
19
|
-
import {
|
|
20
|
-
type UseQueryParameters,
|
|
21
|
-
type UseQueryReturnType,
|
|
22
|
-
useQuery,
|
|
23
|
-
} from '../utils/query.js'
|
|
18
|
+
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
19
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
24
20
|
import { useChainId } from './useChainId.js'
|
|
25
21
|
import { useConfig } from './useConfig.js'
|
|
26
22
|
|
|
@@ -30,24 +26,21 @@ export type UseEstimateFeesPerGasParameters<
|
|
|
30
26
|
selectData = EstimateFeesPerGasData<type>,
|
|
31
27
|
> = Evaluate<
|
|
32
28
|
EstimateFeesPerGasOptions<type, config> &
|
|
33
|
-
ConfigParameter<config> &
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>
|
|
41
|
-
| undefined
|
|
42
|
-
}
|
|
29
|
+
ConfigParameter<config> &
|
|
30
|
+
QueryParameter<
|
|
31
|
+
EstimateFeesPerGasQueryFnData<type>,
|
|
32
|
+
EstimateFeesPerGasErrorType,
|
|
33
|
+
selectData,
|
|
34
|
+
EstimateFeesPerGasQueryKey<config, type>
|
|
35
|
+
>
|
|
43
36
|
>
|
|
44
37
|
|
|
45
38
|
export type UseEstimateFeesPerGasReturnType<
|
|
46
39
|
type extends FeeValuesType = FeeValuesType,
|
|
47
40
|
selectData = EstimateFeesPerGasData<type>,
|
|
48
|
-
> = UseQueryReturnType<selectData,
|
|
41
|
+
> = UseQueryReturnType<selectData, EstimateFeesPerGasErrorType>
|
|
49
42
|
|
|
50
|
-
/** https://
|
|
43
|
+
/** https://wagmi.sh/react/api/hooks/useEstimateFeesPerGas */
|
|
51
44
|
export function useEstimateFeesPerGas<
|
|
52
45
|
config extends Config = ResolvedRegister['config'],
|
|
53
46
|
type extends FeeValuesType = 'eip1559',
|
|
@@ -60,10 +53,10 @@ export function useEstimateFeesPerGas<
|
|
|
60
53
|
const config = useConfig(parameters)
|
|
61
54
|
const chainId = useChainId()
|
|
62
55
|
|
|
63
|
-
const
|
|
56
|
+
const options = estimateFeesPerGasQueryOptions(config, {
|
|
64
57
|
...parameters,
|
|
65
58
|
chainId: parameters.chainId ?? chainId,
|
|
66
59
|
})
|
|
67
60
|
|
|
68
|
-
return useQuery({ ...
|
|
61
|
+
return useQuery({ ...query, ...options })
|
|
69
62
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
Config,
|
|
5
|
+
EstimateGasErrorType,
|
|
6
|
+
ResolvedRegister,
|
|
7
|
+
} from '@wagmi/core'
|
|
4
8
|
import {
|
|
5
9
|
type EstimateGasData,
|
|
6
10
|
type EstimateGasOptions,
|
|
@@ -9,12 +13,8 @@ import {
|
|
|
9
13
|
estimateGasQueryOptions,
|
|
10
14
|
} from '@wagmi/core/query'
|
|
11
15
|
|
|
12
|
-
import type { ConfigParameter } from '../types/properties.js'
|
|
13
|
-
import {
|
|
14
|
-
type UseQueryParameters,
|
|
15
|
-
type UseQueryReturnType,
|
|
16
|
-
useQuery,
|
|
17
|
-
} from '../utils/query.js'
|
|
16
|
+
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
17
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
18
18
|
import { useChainId } from './useChainId.js'
|
|
19
19
|
import { useConfig } from './useConfig.js'
|
|
20
20
|
import { useConnectorClient } from './useConnectorClient.js'
|
|
@@ -24,21 +24,18 @@ export type UseEstimateGasParameters<
|
|
|
24
24
|
chainId extends config['chains'][number]['id'] | undefined = undefined,
|
|
25
25
|
selectData = EstimateGasData,
|
|
26
26
|
> = EstimateGasOptions<config, chainId> &
|
|
27
|
-
ConfigParameter<config> &
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
>
|
|
35
|
-
| undefined
|
|
36
|
-
}
|
|
27
|
+
ConfigParameter<config> &
|
|
28
|
+
QueryParameter<
|
|
29
|
+
EstimateGasQueryFnData,
|
|
30
|
+
EstimateGasErrorType,
|
|
31
|
+
selectData,
|
|
32
|
+
EstimateGasQueryKey<config, chainId>
|
|
33
|
+
>
|
|
37
34
|
|
|
38
35
|
export type UseEstimateGasReturnType<selectData = EstimateGasData> =
|
|
39
|
-
UseQueryReturnType<selectData,
|
|
36
|
+
UseQueryReturnType<selectData, EstimateGasErrorType>
|
|
40
37
|
|
|
41
|
-
/** https://
|
|
38
|
+
/** https://wagmi.sh/react/api/hooks/useEstimateGas */
|
|
42
39
|
export function useEstimateGas<
|
|
43
40
|
config extends Config = ResolvedRegister['config'],
|
|
44
41
|
chainId extends config['chains'][number]['id'] | undefined = undefined,
|
|
@@ -60,13 +57,13 @@ export function useEstimateGas(
|
|
|
60
57
|
const account = parameters.account ?? connectorClient?.account
|
|
61
58
|
const chainId = useChainId()
|
|
62
59
|
|
|
63
|
-
const
|
|
64
|
-
...
|
|
60
|
+
const options = estimateGasQueryOptions(config, {
|
|
61
|
+
...parameters,
|
|
65
62
|
account,
|
|
66
63
|
chainId: parameters.chainId ?? chainId,
|
|
67
64
|
connector,
|
|
68
65
|
})
|
|
69
66
|
const enabled = Boolean((account || connector) && (query.enabled ?? true))
|
|
70
67
|
|
|
71
|
-
return useQuery({ ...
|
|
68
|
+
return useQuery({ ...query, ...options, enabled })
|
|
72
69
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type Config,
|
|
5
|
+
type EstimateMaxPriorityFeePerGasErrorType,
|
|
6
|
+
type ResolvedRegister,
|
|
7
|
+
} from '@wagmi/core'
|
|
8
|
+
import { type Evaluate } from '@wagmi/core/internal'
|
|
9
|
+
import {
|
|
10
|
+
type EstimateMaxPriorityFeePerGasData,
|
|
11
|
+
type EstimateMaxPriorityFeePerGasOptions,
|
|
12
|
+
type EstimateMaxPriorityFeePerGasQueryFnData,
|
|
13
|
+
type EstimateMaxPriorityFeePerGasQueryKey,
|
|
14
|
+
estimateMaxPriorityFeePerGasQueryOptions,
|
|
15
|
+
} from '@wagmi/core/query'
|
|
16
|
+
|
|
17
|
+
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
18
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
|
+
import { useChainId } from './useChainId.js'
|
|
20
|
+
import { useConfig } from './useConfig.js'
|
|
21
|
+
|
|
22
|
+
export type UseEstimateMaxPriorityFeePerGasParameters<
|
|
23
|
+
config extends Config = Config,
|
|
24
|
+
selectData = EstimateMaxPriorityFeePerGasData,
|
|
25
|
+
> = Evaluate<
|
|
26
|
+
EstimateMaxPriorityFeePerGasOptions<config> &
|
|
27
|
+
ConfigParameter<config> &
|
|
28
|
+
QueryParameter<
|
|
29
|
+
EstimateMaxPriorityFeePerGasQueryFnData,
|
|
30
|
+
EstimateMaxPriorityFeePerGasErrorType,
|
|
31
|
+
selectData,
|
|
32
|
+
EstimateMaxPriorityFeePerGasQueryKey<config>
|
|
33
|
+
>
|
|
34
|
+
>
|
|
35
|
+
|
|
36
|
+
export type UseEstimateMaxPriorityFeePerGasReturnType<
|
|
37
|
+
selectData = EstimateMaxPriorityFeePerGasData,
|
|
38
|
+
> = UseQueryReturnType<selectData, EstimateMaxPriorityFeePerGasErrorType>
|
|
39
|
+
|
|
40
|
+
/** https://wagmi.sh/react/api/hooks/useEstimateMaxPriorityFeePerGas */
|
|
41
|
+
export function useEstimateMaxPriorityFeePerGas<
|
|
42
|
+
config extends Config = ResolvedRegister['config'],
|
|
43
|
+
selectData = EstimateMaxPriorityFeePerGasData,
|
|
44
|
+
>(
|
|
45
|
+
parameters: UseEstimateMaxPriorityFeePerGasParameters<
|
|
46
|
+
config,
|
|
47
|
+
selectData
|
|
48
|
+
> = {},
|
|
49
|
+
): UseEstimateMaxPriorityFeePerGasReturnType<selectData> {
|
|
50
|
+
const { query = {} } = parameters
|
|
51
|
+
|
|
52
|
+
const config = useConfig(parameters)
|
|
53
|
+
const chainId = useChainId()
|
|
54
|
+
|
|
55
|
+
const options = estimateMaxPriorityFeePerGasQueryOptions(config, {
|
|
56
|
+
...parameters,
|
|
57
|
+
chainId: parameters.chainId ?? chainId,
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
return useQuery({ ...query, ...options })
|
|
61
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type Config,
|
|
5
|
+
type GetFeeHistoryErrorType,
|
|
6
|
+
type ResolvedRegister,
|
|
7
|
+
} from '@wagmi/core'
|
|
8
|
+
import { type Evaluate } from '@wagmi/core/internal'
|
|
9
|
+
import {
|
|
10
|
+
type GetFeeHistoryData,
|
|
11
|
+
type GetFeeHistoryOptions,
|
|
12
|
+
type GetFeeHistoryQueryFnData,
|
|
13
|
+
type GetFeeHistoryQueryKey,
|
|
14
|
+
getFeeHistoryQueryOptions,
|
|
15
|
+
} from '@wagmi/core/query'
|
|
16
|
+
|
|
17
|
+
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
18
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
|
+
import { useChainId } from './useChainId.js'
|
|
20
|
+
import { useConfig } from './useConfig.js'
|
|
21
|
+
|
|
22
|
+
export type UseFeeHistoryParameters<
|
|
23
|
+
config extends Config = Config,
|
|
24
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
+
selectData = GetFeeHistoryData,
|
|
26
|
+
> = Evaluate<
|
|
27
|
+
GetFeeHistoryOptions<config, chainId> &
|
|
28
|
+
ConfigParameter<config> &
|
|
29
|
+
QueryParameter<
|
|
30
|
+
GetFeeHistoryQueryFnData,
|
|
31
|
+
GetFeeHistoryErrorType,
|
|
32
|
+
selectData,
|
|
33
|
+
GetFeeHistoryQueryKey<config, chainId>
|
|
34
|
+
>
|
|
35
|
+
>
|
|
36
|
+
|
|
37
|
+
export type UseFeeHistoryReturnType<selectData = GetFeeHistoryData> =
|
|
38
|
+
UseQueryReturnType<selectData, GetFeeHistoryErrorType>
|
|
39
|
+
|
|
40
|
+
/** https://wagmi.sh/react/api/hooks/useFeeHistory */
|
|
41
|
+
export function useFeeHistory<
|
|
42
|
+
config extends Config = ResolvedRegister['config'],
|
|
43
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
44
|
+
selectData = GetFeeHistoryData,
|
|
45
|
+
>(
|
|
46
|
+
parameters: UseFeeHistoryParameters<config, chainId, selectData> = {},
|
|
47
|
+
): UseFeeHistoryReturnType<selectData> {
|
|
48
|
+
const { blockCount, rewardPercentiles, query = {} } = parameters
|
|
49
|
+
|
|
50
|
+
const config = useConfig(parameters)
|
|
51
|
+
const chainId = useChainId()
|
|
52
|
+
|
|
53
|
+
const options = getFeeHistoryQueryOptions(config, {
|
|
54
|
+
...parameters,
|
|
55
|
+
chainId: parameters.chainId ?? chainId,
|
|
56
|
+
})
|
|
57
|
+
const enabled = Boolean(
|
|
58
|
+
blockCount && rewardPercentiles && (query.enabled ?? true),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
return useQuery({ ...query, ...options, enabled })
|
|
62
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type Config,
|
|
5
|
+
type GetGasPriceErrorType,
|
|
6
|
+
type ResolvedRegister,
|
|
7
|
+
} from '@wagmi/core'
|
|
8
|
+
import { type Evaluate } from '@wagmi/core/internal'
|
|
9
|
+
import {
|
|
10
|
+
type GetGasPriceData,
|
|
11
|
+
type GetGasPriceOptions,
|
|
12
|
+
type GetGasPriceQueryFnData,
|
|
13
|
+
type GetGasPriceQueryKey,
|
|
14
|
+
getGasPriceQueryOptions,
|
|
15
|
+
} from '@wagmi/core/query'
|
|
16
|
+
|
|
17
|
+
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
18
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
|
+
import { useChainId } from './useChainId.js'
|
|
20
|
+
import { useConfig } from './useConfig.js'
|
|
21
|
+
|
|
22
|
+
export type UseGasPriceParameters<
|
|
23
|
+
config extends Config = Config,
|
|
24
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
+
selectData = GetGasPriceData,
|
|
26
|
+
> = Evaluate<
|
|
27
|
+
GetGasPriceOptions<config, chainId> &
|
|
28
|
+
ConfigParameter<config> &
|
|
29
|
+
QueryParameter<
|
|
30
|
+
GetGasPriceQueryFnData,
|
|
31
|
+
GetGasPriceErrorType,
|
|
32
|
+
selectData,
|
|
33
|
+
GetGasPriceQueryKey<config, chainId>
|
|
34
|
+
>
|
|
35
|
+
>
|
|
36
|
+
|
|
37
|
+
export type UseGasPriceReturnType<selectData = GetGasPriceData> =
|
|
38
|
+
UseQueryReturnType<selectData, GetGasPriceErrorType>
|
|
39
|
+
|
|
40
|
+
/** https://wagmi.sh/react/api/hooks/useGasPrice */
|
|
41
|
+
export function useGasPrice<
|
|
42
|
+
config extends Config = ResolvedRegister['config'],
|
|
43
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
44
|
+
selectData = GetGasPriceData,
|
|
45
|
+
>(
|
|
46
|
+
parameters: UseGasPriceParameters<config, chainId, selectData> = {},
|
|
47
|
+
): UseGasPriceReturnType<selectData> {
|
|
48
|
+
const { query = {} } = parameters
|
|
49
|
+
|
|
50
|
+
const config = useConfig(parameters)
|
|
51
|
+
const configChainId = useChainId()
|
|
52
|
+
const chainId = parameters.chainId ?? configChainId
|
|
53
|
+
|
|
54
|
+
const options = getGasPriceQueryOptions(config, {
|
|
55
|
+
...parameters,
|
|
56
|
+
chainId,
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
return useQuery({ ...query, ...options })
|
|
60
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
Config,
|
|
5
|
+
ReadContractsErrorType,
|
|
6
|
+
ResolvedRegister,
|
|
7
|
+
} from '@wagmi/core'
|
|
8
|
+
import {
|
|
9
|
+
type InfiniteReadContractsQueryFnData,
|
|
10
|
+
type InfiniteReadContractsQueryKey,
|
|
11
|
+
infiniteReadContractsQueryOptions,
|
|
12
|
+
} from '@wagmi/core/query'
|
|
13
|
+
import type { ContractFunctionParameters } from 'viem'
|
|
14
|
+
|
|
15
|
+
import type {
|
|
16
|
+
InfiniteReadContractsData,
|
|
17
|
+
InfiniteReadContractsOptions,
|
|
18
|
+
} from '../exports/query.js'
|
|
19
|
+
import type {
|
|
20
|
+
ConfigParameter,
|
|
21
|
+
InfiniteQueryParameter,
|
|
22
|
+
} from '../types/properties.js'
|
|
23
|
+
import {
|
|
24
|
+
type UseInfiniteQueryParameters,
|
|
25
|
+
type UseInfiniteQueryReturnType,
|
|
26
|
+
structuralSharing,
|
|
27
|
+
useInfiniteQuery,
|
|
28
|
+
} from '../utils/query.js'
|
|
29
|
+
import { useChainId } from './useChainId.js'
|
|
30
|
+
import { useConfig } from './useConfig.js'
|
|
31
|
+
|
|
32
|
+
export type UseInfiniteContractReadsParameters<
|
|
33
|
+
contracts extends readonly unknown[] = readonly ContractFunctionParameters[],
|
|
34
|
+
allowFailure extends boolean = true,
|
|
35
|
+
config extends Config = Config,
|
|
36
|
+
pageParam = unknown,
|
|
37
|
+
selectData = InfiniteReadContractsData<contracts, allowFailure>,
|
|
38
|
+
> = InfiniteReadContractsOptions<contracts, allowFailure, pageParam, config> &
|
|
39
|
+
ConfigParameter<config> &
|
|
40
|
+
InfiniteQueryParameter<
|
|
41
|
+
InfiniteReadContractsQueryFnData<contracts, allowFailure>,
|
|
42
|
+
ReadContractsErrorType,
|
|
43
|
+
selectData,
|
|
44
|
+
InfiniteReadContractsData<contracts, allowFailure>,
|
|
45
|
+
InfiniteReadContractsQueryKey<contracts, allowFailure, pageParam, config>,
|
|
46
|
+
pageParam
|
|
47
|
+
>
|
|
48
|
+
|
|
49
|
+
export type UseInfiniteContractReadsReturnType<
|
|
50
|
+
contracts extends readonly unknown[] = readonly ContractFunctionParameters[],
|
|
51
|
+
allowFailure extends boolean = true,
|
|
52
|
+
selectData = InfiniteReadContractsData<contracts, allowFailure>,
|
|
53
|
+
> = UseInfiniteQueryReturnType<selectData, ReadContractsErrorType>
|
|
54
|
+
|
|
55
|
+
/** https://wagmi.sh/react/api/hooks/useInfiniteReadContracts */
|
|
56
|
+
export function useInfiniteReadContracts<
|
|
57
|
+
const contracts extends readonly unknown[],
|
|
58
|
+
allowFailure extends boolean = true,
|
|
59
|
+
config extends Config = ResolvedRegister['config'],
|
|
60
|
+
pageParam = unknown,
|
|
61
|
+
selectData = InfiniteReadContractsData<contracts, allowFailure>,
|
|
62
|
+
>(
|
|
63
|
+
parameters: UseInfiniteContractReadsParameters<
|
|
64
|
+
contracts,
|
|
65
|
+
allowFailure,
|
|
66
|
+
config,
|
|
67
|
+
pageParam,
|
|
68
|
+
selectData
|
|
69
|
+
>,
|
|
70
|
+
): UseInfiniteContractReadsReturnType<contracts, allowFailure, selectData> {
|
|
71
|
+
const { contracts = [], query } = parameters
|
|
72
|
+
|
|
73
|
+
const config = useConfig(parameters)
|
|
74
|
+
const chainId = useChainId()
|
|
75
|
+
|
|
76
|
+
const options = infiniteReadContractsQueryOptions(config, {
|
|
77
|
+
...parameters,
|
|
78
|
+
chainId,
|
|
79
|
+
contracts: contracts as UseInfiniteContractReadsParameters['contracts'],
|
|
80
|
+
query: query as UseInfiniteQueryParameters,
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
return useInfiniteQuery({
|
|
84
|
+
...(query as any),
|
|
85
|
+
...options,
|
|
86
|
+
initialPageParam: options.initialPageParam,
|
|
87
|
+
structuralSharing: query.structuralSharing ?? structuralSharing,
|
|
88
|
+
})
|
|
89
|
+
}
|
|
@@ -26,7 +26,7 @@ export type UsePublicClientReturnType<
|
|
|
26
26
|
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
27
27
|
> = GetPublicClientReturnType<config, chainId>
|
|
28
28
|
|
|
29
|
-
/** https://
|
|
29
|
+
/** https://wagmi.sh/react/api/hooks/usePublicClient */
|
|
30
30
|
export function usePublicClient<
|
|
31
31
|
config extends Config = ResolvedRegister['config'],
|
|
32
32
|
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|