wagmi 3.3.1 → 3.3.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/dist/esm/hooks/codegen/createUseReadContract.js.map +1 -1
- package/dist/esm/hooks/codegen/createUseSimulateContract.js.map +1 -1
- package/dist/esm/hooks/useBalance.js +2 -3
- package/dist/esm/hooks/useBalance.js.map +1 -1
- package/dist/esm/hooks/useBlock.js +10 -13
- package/dist/esm/hooks/useBlock.js.map +1 -1
- package/dist/esm/hooks/useBlockNumber.js +10 -9
- package/dist/esm/hooks/useBlockNumber.js.map +1 -1
- package/dist/esm/hooks/useBlockTransactionCount.js +4 -5
- package/dist/esm/hooks/useBlockTransactionCount.js.map +1 -1
- package/dist/esm/hooks/useBytecode.js +2 -3
- package/dist/esm/hooks/useBytecode.js.map +1 -1
- package/dist/esm/hooks/useCall.js +2 -2
- package/dist/esm/hooks/useCall.js.map +1 -1
- package/dist/esm/hooks/useCallsStatus.js +8 -3
- package/dist/esm/hooks/useCallsStatus.js.map +1 -1
- package/dist/esm/hooks/useCapabilities.js +5 -7
- package/dist/esm/hooks/useCapabilities.js.map +1 -1
- package/dist/esm/hooks/useConnectorClient.js +10 -20
- package/dist/esm/hooks/useConnectorClient.js.map +1 -1
- package/dist/esm/hooks/useEnsAddress.js +2 -3
- package/dist/esm/hooks/useEnsAddress.js.map +1 -1
- package/dist/esm/hooks/useEnsAvatar.js +2 -3
- package/dist/esm/hooks/useEnsAvatar.js.map +1 -1
- package/dist/esm/hooks/useEnsName.js +2 -3
- package/dist/esm/hooks/useEnsName.js.map +1 -1
- package/dist/esm/hooks/useEnsResolver.js +2 -3
- package/dist/esm/hooks/useEnsResolver.js.map +1 -1
- package/dist/esm/hooks/useEnsText.js +2 -3
- package/dist/esm/hooks/useEnsText.js.map +1 -1
- package/dist/esm/hooks/useEstimateFeesPerGas.js +2 -2
- package/dist/esm/hooks/useEstimateFeesPerGas.js.map +1 -1
- package/dist/esm/hooks/useEstimateGas.js +6 -12
- package/dist/esm/hooks/useEstimateGas.js.map +1 -1
- package/dist/esm/hooks/useEstimateMaxPriorityFeePerGas.js +2 -2
- package/dist/esm/hooks/useEstimateMaxPriorityFeePerGas.js.map +1 -1
- package/dist/esm/hooks/useFeeHistory.js +2 -3
- package/dist/esm/hooks/useFeeHistory.js.map +1 -1
- package/dist/esm/hooks/useGasPrice.js +4 -5
- package/dist/esm/hooks/useGasPrice.js.map +1 -1
- package/dist/esm/hooks/usePrepareTransactionRequest.js +2 -7
- package/dist/esm/hooks/usePrepareTransactionRequest.js.map +1 -1
- package/dist/esm/hooks/useProof.js +2 -3
- package/dist/esm/hooks/useProof.js.map +1 -1
- package/dist/esm/hooks/useReadContract.js +6 -11
- package/dist/esm/hooks/useReadContract.js.map +1 -1
- package/dist/esm/hooks/useReadContracts.js +9 -24
- package/dist/esm/hooks/useReadContracts.js.map +1 -1
- package/dist/esm/hooks/useSimulateContract.js +6 -10
- package/dist/esm/hooks/useSimulateContract.js.map +1 -1
- package/dist/esm/hooks/useStorageAt.js +2 -3
- package/dist/esm/hooks/useStorageAt.js.map +1 -1
- package/dist/esm/hooks/useTransaction.js +2 -7
- package/dist/esm/hooks/useTransaction.js.map +1 -1
- package/dist/esm/hooks/useTransactionConfirmations.js +2 -5
- package/dist/esm/hooks/useTransactionConfirmations.js.map +1 -1
- package/dist/esm/hooks/useTransactionCount.js +2 -3
- package/dist/esm/hooks/useTransactionCount.js.map +1 -1
- package/dist/esm/hooks/useTransactionReceipt.js +2 -7
- package/dist/esm/hooks/useTransactionReceipt.js.map +1 -1
- package/dist/esm/hooks/useVerifyMessage.js +2 -3
- package/dist/esm/hooks/useVerifyMessage.js.map +1 -1
- package/dist/esm/hooks/useVerifyTypedData.js +2 -8
- package/dist/esm/hooks/useVerifyTypedData.js.map +1 -1
- package/dist/esm/hooks/useWaitForCallsStatus.js +8 -4
- package/dist/esm/hooks/useWaitForCallsStatus.js.map +1 -1
- package/dist/esm/hooks/useWaitForTransactionReceipt.js +2 -7
- package/dist/esm/hooks/useWaitForTransactionReceipt.js.map +1 -1
- package/dist/esm/hooks/useWalletClient.js +9 -19
- package/dist/esm/hooks/useWalletClient.js.map +1 -1
- package/dist/esm/tempo/hooks/amm.js.map +1 -1
- package/dist/esm/tempo/hooks/dex.js.map +1 -1
- package/dist/esm/tempo/hooks/fee.js.map +1 -1
- package/dist/esm/tempo/hooks/nonce.js.map +1 -1
- package/dist/esm/tempo/hooks/policy.js.map +1 -1
- package/dist/esm/tempo/hooks/reward.js.map +1 -1
- package/dist/esm/tempo/hooks/token.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/exports/internal.d.ts +1 -1
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/hooks/codegen/createUseReadContract.d.ts +5 -5
- package/dist/types/hooks/codegen/createUseReadContract.d.ts.map +1 -1
- package/dist/types/hooks/codegen/createUseSimulateContract.d.ts +5 -5
- package/dist/types/hooks/codegen/createUseSimulateContract.d.ts.map +1 -1
- package/dist/types/hooks/useBalance.d.ts +3 -4
- package/dist/types/hooks/useBalance.d.ts.map +1 -1
- package/dist/types/hooks/useBlock.d.ts +3 -3
- package/dist/types/hooks/useBlock.d.ts.map +1 -1
- package/dist/types/hooks/useBlockNumber.d.ts +3 -3
- package/dist/types/hooks/useBlockNumber.d.ts.map +1 -1
- package/dist/types/hooks/useBlockTransactionCount.d.ts +3 -3
- package/dist/types/hooks/useBlockTransactionCount.d.ts.map +1 -1
- package/dist/types/hooks/useBytecode.d.ts +3 -4
- package/dist/types/hooks/useBytecode.d.ts.map +1 -1
- package/dist/types/hooks/useCall.d.ts +3 -4
- package/dist/types/hooks/useCall.d.ts.map +1 -1
- package/dist/types/hooks/useCallsStatus.d.ts +3 -3
- package/dist/types/hooks/useCallsStatus.d.ts.map +1 -1
- package/dist/types/hooks/useCapabilities.d.ts +3 -3
- package/dist/types/hooks/useCapabilities.d.ts.map +1 -1
- package/dist/types/hooks/useConnectorClient.d.ts +4 -6
- package/dist/types/hooks/useConnectorClient.d.ts.map +1 -1
- package/dist/types/hooks/useEnsAddress.d.ts +3 -3
- package/dist/types/hooks/useEnsAddress.d.ts.map +1 -1
- package/dist/types/hooks/useEnsAvatar.d.ts +3 -3
- package/dist/types/hooks/useEnsAvatar.d.ts.map +1 -1
- package/dist/types/hooks/useEnsName.d.ts +3 -3
- package/dist/types/hooks/useEnsName.d.ts.map +1 -1
- package/dist/types/hooks/useEnsResolver.d.ts +3 -3
- package/dist/types/hooks/useEnsResolver.d.ts.map +1 -1
- package/dist/types/hooks/useEnsText.d.ts +3 -3
- package/dist/types/hooks/useEnsText.d.ts.map +1 -1
- package/dist/types/hooks/useEstimateFeesPerGas.d.ts +3 -3
- package/dist/types/hooks/useEstimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/hooks/useEstimateGas.d.ts +3 -3
- package/dist/types/hooks/useEstimateGas.d.ts.map +1 -1
- package/dist/types/hooks/useEstimateMaxPriorityFeePerGas.d.ts +3 -3
- package/dist/types/hooks/useEstimateMaxPriorityFeePerGas.d.ts.map +1 -1
- package/dist/types/hooks/useFeeHistory.d.ts +3 -3
- package/dist/types/hooks/useFeeHistory.d.ts.map +1 -1
- package/dist/types/hooks/useGasPrice.d.ts +3 -3
- package/dist/types/hooks/useGasPrice.d.ts.map +1 -1
- package/dist/types/hooks/usePrepareTransactionRequest.d.ts +3 -4
- package/dist/types/hooks/usePrepareTransactionRequest.d.ts.map +1 -1
- package/dist/types/hooks/useProof.d.ts +3 -4
- package/dist/types/hooks/useProof.d.ts.map +1 -1
- package/dist/types/hooks/useReadContract.d.ts +3 -3
- package/dist/types/hooks/useReadContract.d.ts.map +1 -1
- package/dist/types/hooks/useReadContracts.d.ts +3 -3
- package/dist/types/hooks/useReadContracts.d.ts.map +1 -1
- package/dist/types/hooks/useSimulateContract.d.ts +4 -4
- package/dist/types/hooks/useSimulateContract.d.ts.map +1 -1
- package/dist/types/hooks/useStorageAt.d.ts +3 -4
- package/dist/types/hooks/useStorageAt.d.ts.map +1 -1
- package/dist/types/hooks/useTransaction.d.ts +3 -3
- package/dist/types/hooks/useTransaction.d.ts.map +1 -1
- package/dist/types/hooks/useTransactionConfirmations.d.ts +3 -3
- package/dist/types/hooks/useTransactionConfirmations.d.ts.map +1 -1
- package/dist/types/hooks/useTransactionCount.d.ts +3 -4
- package/dist/types/hooks/useTransactionCount.d.ts.map +1 -1
- package/dist/types/hooks/useTransactionReceipt.d.ts +3 -4
- package/dist/types/hooks/useTransactionReceipt.d.ts.map +1 -1
- package/dist/types/hooks/useVerifyMessage.d.ts +3 -4
- package/dist/types/hooks/useVerifyMessage.d.ts.map +1 -1
- package/dist/types/hooks/useVerifyTypedData.d.ts +3 -4
- package/dist/types/hooks/useVerifyTypedData.d.ts.map +1 -1
- package/dist/types/hooks/useWaitForCallsStatus.d.ts +3 -3
- package/dist/types/hooks/useWaitForCallsStatus.d.ts.map +1 -1
- package/dist/types/hooks/useWaitForTransactionReceipt.d.ts +3 -3
- package/dist/types/hooks/useWaitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/hooks/useWalletClient.d.ts +4 -6
- package/dist/types/hooks/useWalletClient.d.ts.map +1 -1
- package/dist/types/tempo/hooks/amm.d.ts +3 -3
- package/dist/types/tempo/hooks/amm.d.ts.map +1 -1
- package/dist/types/tempo/hooks/dex.d.ts +7 -7
- package/dist/types/tempo/hooks/dex.d.ts.map +1 -1
- package/dist/types/tempo/hooks/fee.d.ts +2 -2
- package/dist/types/tempo/hooks/fee.d.ts.map +1 -1
- package/dist/types/tempo/hooks/nonce.d.ts +2 -2
- package/dist/types/tempo/hooks/nonce.d.ts.map +1 -1
- package/dist/types/tempo/hooks/policy.d.ts +3 -3
- package/dist/types/tempo/hooks/policy.d.ts.map +1 -1
- package/dist/types/tempo/hooks/reward.d.ts +3 -3
- package/dist/types/tempo/hooks/reward.d.ts.map +1 -1
- package/dist/types/tempo/hooks/token.d.ts +6 -6
- package/dist/types/tempo/hooks/token.d.ts.map +1 -1
- package/dist/types/types/properties.d.ts +1 -4
- package/dist/types/types/properties.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/exports/internal.ts +1 -4
- package/src/hooks/codegen/createUseReadContract.ts +9 -10
- package/src/hooks/codegen/createUseSimulateContract.ts +9 -6
- package/src/hooks/useBalance.ts +4 -21
- package/src/hooks/useBlock.ts +13 -36
- package/src/hooks/useBlockNumber.ts +13 -26
- package/src/hooks/useBlockTransactionCount.ts +7 -21
- package/src/hooks/useBytecode.ts +4 -20
- package/src/hooks/useCall.ts +4 -20
- package/src/hooks/useCallsStatus.ts +10 -21
- package/src/hooks/useCapabilities.ts +7 -23
- package/src/hooks/useConnectorClient.ts +13 -50
- package/src/hooks/useEnsAddress.ts +4 -21
- package/src/hooks/useEnsAvatar.ts +4 -21
- package/src/hooks/useEnsName.ts +4 -21
- package/src/hooks/useEnsResolver.ts +4 -21
- package/src/hooks/useEnsText.ts +4 -21
- package/src/hooks/useEstimateFeesPerGas.ts +4 -18
- package/src/hooks/useEstimateGas.ts +8 -28
- package/src/hooks/useEstimateMaxPriorityFeePerGas.ts +5 -18
- package/src/hooks/useFeeHistory.ts +4 -21
- package/src/hooks/useGasPrice.ts +6 -21
- package/src/hooks/usePrepareTransactionRequest.ts +5 -28
- package/src/hooks/useProof.ts +4 -21
- package/src/hooks/useReadContract.ts +9 -33
- package/src/hooks/useReadContracts.ts +13 -45
- package/src/hooks/useSimulateContract.ts +19 -37
- package/src/hooks/useStorageAt.ts +4 -20
- package/src/hooks/useTransaction.ts +4 -25
- package/src/hooks/useTransactionConfirmations.ts +5 -23
- package/src/hooks/useTransactionCount.ts +4 -19
- package/src/hooks/useTransactionReceipt.ts +5 -22
- package/src/hooks/useVerifyMessage.ts +4 -22
- package/src/hooks/useVerifyTypedData.ts +9 -39
- package/src/hooks/useWaitForCallsStatus.ts +10 -22
- package/src/hooks/useWaitForTransactionReceipt.ts +5 -23
- package/src/hooks/useWalletClient.ts +15 -56
- package/src/tempo/hooks/amm.ts +5 -23
- package/src/tempo/hooks/dex.ts +13 -55
- package/src/tempo/hooks/fee.ts +3 -10
- package/src/tempo/hooks/nonce.ts +2 -11
- package/src/tempo/hooks/policy.ts +3 -21
- package/src/tempo/hooks/reward.ts +7 -25
- package/src/tempo/hooks/token.ts +6 -51
- package/src/types/properties.ts +1 -18
- package/src/version.ts +1 -1
package/src/hooks/useBytecode.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type {
|
|
4
3
|
Config,
|
|
5
4
|
GetBytecodeErrorType,
|
|
6
5
|
ResolvedRegister,
|
|
7
6
|
} from '@wagmi/core'
|
|
8
7
|
import type { Compute } from '@wagmi/core/internal'
|
|
9
|
-
import type { GetBytecodeQueryFnData } from '@wagmi/core/query'
|
|
10
8
|
import {
|
|
11
9
|
type GetBytecodeData,
|
|
12
10
|
type GetBytecodeOptions,
|
|
13
|
-
type GetBytecodeQueryKey,
|
|
14
11
|
getBytecodeQueryOptions,
|
|
15
12
|
} from '@wagmi/core/query'
|
|
16
|
-
import type { ConfigParameter
|
|
13
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
17
14
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
18
15
|
import { useChainId } from './useChainId.js'
|
|
19
16
|
import { useConfig } from './useConfig.js'
|
|
@@ -21,16 +18,7 @@ import { useConfig } from './useConfig.js'
|
|
|
21
18
|
export type UseBytecodeParameters<
|
|
22
19
|
config extends Config = Config,
|
|
23
20
|
selectData = GetBytecodeData,
|
|
24
|
-
> = Compute<
|
|
25
|
-
GetBytecodeOptions<config> &
|
|
26
|
-
ConfigParameter<config> &
|
|
27
|
-
QueryParameter<
|
|
28
|
-
GetBytecodeQueryFnData,
|
|
29
|
-
GetBytecodeErrorType,
|
|
30
|
-
selectData,
|
|
31
|
-
GetBytecodeQueryKey<config>
|
|
32
|
-
>
|
|
33
|
-
>
|
|
21
|
+
> = Compute<GetBytecodeOptions<config, selectData> & ConfigParameter<config>>
|
|
34
22
|
|
|
35
23
|
export type UseBytecodeReturnType<selectData = GetBytecodeData> =
|
|
36
24
|
UseQueryReturnType<selectData, GetBytecodeErrorType>
|
|
@@ -42,16 +30,12 @@ export function useBytecode<
|
|
|
42
30
|
>(
|
|
43
31
|
parameters: UseBytecodeParameters<config, selectData> = {},
|
|
44
32
|
): UseBytecodeReturnType<selectData> {
|
|
45
|
-
const { address, query = {} } = parameters
|
|
46
|
-
|
|
47
33
|
const config = useConfig(parameters)
|
|
48
34
|
const chainId = useChainId({ config })
|
|
49
|
-
|
|
50
35
|
const options = getBytecodeQueryOptions(config, {
|
|
51
36
|
...parameters,
|
|
52
37
|
chainId: parameters.chainId ?? chainId,
|
|
38
|
+
query: parameters.query,
|
|
53
39
|
})
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return useQuery({ ...query, ...options, enabled })
|
|
40
|
+
return useQuery(options)
|
|
57
41
|
}
|
package/src/hooks/useCall.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type { CallErrorType, Config, ResolvedRegister } from '@wagmi/core'
|
|
4
3
|
import type { Compute } from '@wagmi/core/internal'
|
|
5
|
-
import type { CallQueryFnData } from '@wagmi/core/query'
|
|
6
4
|
import {
|
|
7
5
|
type CallData,
|
|
8
6
|
type CallOptions,
|
|
9
|
-
type CallQueryKey,
|
|
10
7
|
callQueryOptions,
|
|
11
8
|
} from '@wagmi/core/query'
|
|
12
|
-
|
|
13
|
-
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
9
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
14
10
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
15
11
|
import { useChainId } from './useChainId.js'
|
|
16
12
|
import { useConfig } from './useConfig.js'
|
|
@@ -18,16 +14,7 @@ import { useConfig } from './useConfig.js'
|
|
|
18
14
|
export type UseCallParameters<
|
|
19
15
|
config extends Config = Config,
|
|
20
16
|
selectData = CallData,
|
|
21
|
-
> = Compute<
|
|
22
|
-
CallOptions<config> &
|
|
23
|
-
ConfigParameter<config> &
|
|
24
|
-
QueryParameter<
|
|
25
|
-
CallQueryFnData,
|
|
26
|
-
CallErrorType,
|
|
27
|
-
selectData,
|
|
28
|
-
CallQueryKey<config>
|
|
29
|
-
>
|
|
30
|
-
>
|
|
17
|
+
> = Compute<CallOptions<config, selectData> & ConfigParameter<config>>
|
|
31
18
|
|
|
32
19
|
export type UseCallReturnType<selectData = CallData> = UseQueryReturnType<
|
|
33
20
|
selectData,
|
|
@@ -41,15 +28,12 @@ export function useCall<
|
|
|
41
28
|
>(
|
|
42
29
|
parameters: UseCallParameters<config, selectData> = {},
|
|
43
30
|
): UseCallReturnType<selectData> {
|
|
44
|
-
const { query = {} } = parameters
|
|
45
|
-
|
|
46
31
|
const config = useConfig(parameters)
|
|
47
32
|
const chainId = useChainId({ config })
|
|
48
|
-
|
|
49
33
|
const options = callQueryOptions(config, {
|
|
50
34
|
...parameters,
|
|
51
35
|
chainId: parameters.chainId ?? chainId,
|
|
36
|
+
query: parameters.query,
|
|
52
37
|
})
|
|
53
|
-
|
|
54
|
-
return useQuery({ ...query, ...options })
|
|
38
|
+
return useQuery(options)
|
|
55
39
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type {
|
|
4
3
|
Config,
|
|
5
4
|
GetCallsStatusErrorType,
|
|
@@ -9,28 +8,17 @@ import type { Compute } from '@wagmi/core/internal'
|
|
|
9
8
|
import {
|
|
10
9
|
type GetCallsStatusData,
|
|
11
10
|
type GetCallsStatusOptions,
|
|
12
|
-
type GetCallsStatusQueryFnData,
|
|
13
|
-
type GetCallsStatusQueryKey,
|
|
14
11
|
getCallsStatusQueryOptions,
|
|
15
12
|
} from '@wagmi/core/query'
|
|
16
|
-
|
|
17
|
-
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
13
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
18
14
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
15
|
import { useConfig } from './useConfig.js'
|
|
16
|
+
import { useConnection } from './useConnection.js'
|
|
20
17
|
|
|
21
18
|
export type UseCallsStatusParameters<
|
|
22
19
|
config extends Config = Config,
|
|
23
20
|
selectData = GetCallsStatusData,
|
|
24
|
-
> = Compute<
|
|
25
|
-
GetCallsStatusOptions &
|
|
26
|
-
ConfigParameter<config> &
|
|
27
|
-
QueryParameter<
|
|
28
|
-
GetCallsStatusQueryFnData,
|
|
29
|
-
GetCallsStatusErrorType,
|
|
30
|
-
selectData,
|
|
31
|
-
GetCallsStatusQueryKey
|
|
32
|
-
>
|
|
33
|
-
>
|
|
21
|
+
> = Compute<GetCallsStatusOptions<selectData> & ConfigParameter<config>>
|
|
34
22
|
|
|
35
23
|
export type UseCallsStatusReturnType<selectData = GetCallsStatusData> =
|
|
36
24
|
UseQueryReturnType<selectData, GetCallsStatusErrorType>
|
|
@@ -42,11 +30,12 @@ export function useCallsStatus<
|
|
|
42
30
|
>(
|
|
43
31
|
parameters: UseCallsStatusParameters<config, selectData>,
|
|
44
32
|
): UseCallsStatusReturnType<selectData> {
|
|
45
|
-
const { query = {} } = parameters
|
|
46
|
-
|
|
47
33
|
const config = useConfig(parameters)
|
|
48
|
-
|
|
49
|
-
const options = getCallsStatusQueryOptions(config,
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
const { connector } = useConnection({ config })
|
|
35
|
+
const options = getCallsStatusQueryOptions(config, {
|
|
36
|
+
...parameters,
|
|
37
|
+
connector: parameters.connector ?? connector,
|
|
38
|
+
query: parameters.query,
|
|
39
|
+
})
|
|
40
|
+
return useQuery(options)
|
|
52
41
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type {
|
|
4
3
|
Config,
|
|
5
4
|
GetCapabilitiesErrorType,
|
|
@@ -9,12 +8,9 @@ import type { Compute } from '@wagmi/core/internal'
|
|
|
9
8
|
import {
|
|
10
9
|
type GetCapabilitiesData,
|
|
11
10
|
type GetCapabilitiesOptions,
|
|
12
|
-
type GetCapabilitiesQueryFnData,
|
|
13
|
-
type GetCapabilitiesQueryKey,
|
|
14
11
|
getCapabilitiesQueryOptions,
|
|
15
12
|
} from '@wagmi/core/query'
|
|
16
|
-
|
|
17
|
-
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
13
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
18
14
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
15
|
import { useConfig } from './useConfig.js'
|
|
20
16
|
import { useConnection } from './useConnection.js'
|
|
@@ -24,14 +20,7 @@ export type UseCapabilitiesParameters<
|
|
|
24
20
|
chainId extends config['chains'][number]['id'] | undefined = undefined,
|
|
25
21
|
selectData = GetCapabilitiesData<config, chainId>,
|
|
26
22
|
> = Compute<
|
|
27
|
-
GetCapabilitiesOptions<config, chainId> &
|
|
28
|
-
ConfigParameter<config> &
|
|
29
|
-
QueryParameter<
|
|
30
|
-
GetCapabilitiesQueryFnData<config, chainId>,
|
|
31
|
-
GetCapabilitiesErrorType,
|
|
32
|
-
selectData,
|
|
33
|
-
GetCapabilitiesQueryKey<config, chainId>
|
|
34
|
-
>
|
|
23
|
+
GetCapabilitiesOptions<config, chainId, selectData> & ConfigParameter<config>
|
|
35
24
|
>
|
|
36
25
|
|
|
37
26
|
export type UseCapabilitiesReturnType<
|
|
@@ -48,18 +37,13 @@ export function useCapabilities<
|
|
|
48
37
|
>(
|
|
49
38
|
parameters: UseCapabilitiesParameters<config, chainId, selectData> = {},
|
|
50
39
|
): UseCapabilitiesReturnType<config, chainId, selectData> {
|
|
51
|
-
const { account, query = {} } = parameters
|
|
52
|
-
|
|
53
|
-
const { address } = useConnection()
|
|
54
40
|
const config = useConfig(parameters)
|
|
55
|
-
|
|
41
|
+
const { address, connector } = useConnection({ config })
|
|
56
42
|
const options = getCapabilitiesQueryOptions(config, {
|
|
57
43
|
...parameters,
|
|
58
|
-
account: account ?? address,
|
|
44
|
+
account: parameters.account ?? address,
|
|
45
|
+
connector: parameters.connector ?? connector,
|
|
46
|
+
query: parameters.query,
|
|
59
47
|
})
|
|
60
|
-
|
|
61
|
-
return useQuery({
|
|
62
|
-
...query,
|
|
63
|
-
...options,
|
|
64
|
-
} as never) as UseCapabilitiesReturnType<config, chainId, selectData>
|
|
48
|
+
return useQuery(options as never) as any
|
|
65
49
|
}
|
|
@@ -6,22 +6,16 @@ import type {
|
|
|
6
6
|
GetConnectorClientErrorType,
|
|
7
7
|
ResolvedRegister,
|
|
8
8
|
} from '@wagmi/core'
|
|
9
|
-
import type { Compute
|
|
9
|
+
import type { Compute } from '@wagmi/core/internal'
|
|
10
10
|
import {
|
|
11
11
|
type GetConnectorClientData,
|
|
12
12
|
type GetConnectorClientOptions,
|
|
13
|
-
type GetConnectorClientQueryFnData,
|
|
14
|
-
type GetConnectorClientQueryKey,
|
|
15
13
|
getConnectorClientQueryOptions,
|
|
16
14
|
} from '@wagmi/core/query'
|
|
17
15
|
import { useEffect, useRef } from 'react'
|
|
18
16
|
|
|
19
17
|
import type { ConfigParameter } from '../types/properties.js'
|
|
20
|
-
import {
|
|
21
|
-
type UseQueryParameters,
|
|
22
|
-
type UseQueryReturnType,
|
|
23
|
-
useQuery,
|
|
24
|
-
} from '../utils/query.js'
|
|
18
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
25
19
|
import { useChainId } from './useChainId.js'
|
|
26
20
|
import { useConfig } from './useConfig.js'
|
|
27
21
|
import { useConnection } from './useConnection.js'
|
|
@@ -32,22 +26,8 @@ export type UseConnectorClientParameters<
|
|
|
32
26
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
33
27
|
selectData = GetConnectorClientData<config, chainId>,
|
|
34
28
|
> = Compute<
|
|
35
|
-
GetConnectorClientOptions<config, chainId> &
|
|
36
|
-
ConfigParameter<config>
|
|
37
|
-
query?:
|
|
38
|
-
| Compute<
|
|
39
|
-
Omit<
|
|
40
|
-
UseQueryParameters<
|
|
41
|
-
GetConnectorClientQueryFnData<config, chainId>,
|
|
42
|
-
GetConnectorClientErrorType,
|
|
43
|
-
selectData,
|
|
44
|
-
GetConnectorClientQueryKey<config, chainId>
|
|
45
|
-
>,
|
|
46
|
-
'gcTime' | 'staleTime'
|
|
47
|
-
>
|
|
48
|
-
>
|
|
49
|
-
| undefined
|
|
50
|
-
}
|
|
29
|
+
GetConnectorClientOptions<config, chainId, selectData> &
|
|
30
|
+
ConfigParameter<config>
|
|
51
31
|
>
|
|
52
32
|
|
|
53
33
|
export type UseConnectorClientReturnType<
|
|
@@ -66,48 +46,31 @@ export function useConnectorClient<
|
|
|
66
46
|
>(
|
|
67
47
|
parameters: UseConnectorClientParameters<config, chainId, selectData> = {},
|
|
68
48
|
): UseConnectorClientReturnType<config, chainId, selectData> {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const config = useConfig(rest)
|
|
72
|
-
const queryClient = useQueryClient()
|
|
73
|
-
const { address, connector, status } = useConnection({ config })
|
|
49
|
+
const config = useConfig(parameters)
|
|
74
50
|
const chainId = useChainId({ config })
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const { queryKey, ...options } = getConnectorClientQueryOptions<
|
|
78
|
-
config,
|
|
79
|
-
chainId
|
|
80
|
-
>(config, {
|
|
51
|
+
const { address, connector } = useConnection({ config })
|
|
52
|
+
const options = getConnectorClientQueryOptions(config, {
|
|
81
53
|
...parameters,
|
|
82
54
|
chainId: parameters.chainId ?? chainId,
|
|
83
|
-
connector:
|
|
55
|
+
connector: parameters.connector ?? connector,
|
|
56
|
+
query: parameters.query as any,
|
|
84
57
|
})
|
|
85
|
-
const enabled = Boolean(
|
|
86
|
-
(status === 'connected' ||
|
|
87
|
-
(status === 'reconnecting' && activeConnector?.getProvider)) &&
|
|
88
|
-
(query.enabled ?? true),
|
|
89
|
-
)
|
|
90
58
|
|
|
91
59
|
const addressRef = useRef(address)
|
|
60
|
+
const queryClient = useQueryClient()
|
|
92
61
|
// biome-ignore lint/correctness/useExhaustiveDependencies: `queryKey` not required
|
|
93
62
|
useEffect(() => {
|
|
94
63
|
const previousAddress = addressRef.current
|
|
95
64
|
if (!address && previousAddress) {
|
|
96
65
|
// remove when account is disconnected
|
|
97
|
-
queryClient.removeQueries({ queryKey })
|
|
66
|
+
queryClient.removeQueries({ queryKey: options.queryKey })
|
|
98
67
|
addressRef.current = undefined
|
|
99
68
|
} else if (address !== previousAddress) {
|
|
100
69
|
// invalidate when address changes
|
|
101
|
-
queryClient.invalidateQueries({ queryKey })
|
|
70
|
+
queryClient.invalidateQueries({ queryKey: options.queryKey })
|
|
102
71
|
addressRef.current = address
|
|
103
72
|
}
|
|
104
73
|
}, [address, queryClient])
|
|
105
74
|
|
|
106
|
-
return useQuery(
|
|
107
|
-
...query,
|
|
108
|
-
...options,
|
|
109
|
-
queryKey,
|
|
110
|
-
enabled,
|
|
111
|
-
staleTime: Number.POSITIVE_INFINITY,
|
|
112
|
-
})
|
|
75
|
+
return useQuery(options) as any
|
|
113
76
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type {
|
|
4
3
|
Config,
|
|
5
4
|
GetEnsAddressErrorType,
|
|
@@ -9,12 +8,9 @@ import type { Compute } from '@wagmi/core/internal'
|
|
|
9
8
|
import {
|
|
10
9
|
type GetEnsAddressData,
|
|
11
10
|
type GetEnsAddressOptions,
|
|
12
|
-
type GetEnsAddressQueryFnData,
|
|
13
|
-
type GetEnsAddressQueryKey,
|
|
14
11
|
getEnsAddressQueryOptions,
|
|
15
12
|
} from '@wagmi/core/query'
|
|
16
|
-
|
|
17
|
-
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
13
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
18
14
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
15
|
import { useChainId } from './useChainId.js'
|
|
20
16
|
import { useConfig } from './useConfig.js'
|
|
@@ -22,16 +18,7 @@ import { useConfig } from './useConfig.js'
|
|
|
22
18
|
export type UseEnsAddressParameters<
|
|
23
19
|
config extends Config = Config,
|
|
24
20
|
selectData = GetEnsAddressData,
|
|
25
|
-
> = Compute<
|
|
26
|
-
GetEnsAddressOptions<config> &
|
|
27
|
-
ConfigParameter<config> &
|
|
28
|
-
QueryParameter<
|
|
29
|
-
GetEnsAddressQueryFnData,
|
|
30
|
-
GetEnsAddressErrorType,
|
|
31
|
-
selectData,
|
|
32
|
-
GetEnsAddressQueryKey<config>
|
|
33
|
-
>
|
|
34
|
-
>
|
|
21
|
+
> = Compute<GetEnsAddressOptions<config, selectData> & ConfigParameter<config>>
|
|
35
22
|
|
|
36
23
|
export type UseEnsAddressReturnType<selectData = GetEnsAddressData> =
|
|
37
24
|
UseQueryReturnType<selectData, GetEnsAddressErrorType>
|
|
@@ -43,16 +30,12 @@ export function useEnsAddress<
|
|
|
43
30
|
>(
|
|
44
31
|
parameters: UseEnsAddressParameters<config, selectData> = {},
|
|
45
32
|
): UseEnsAddressReturnType<selectData> {
|
|
46
|
-
const { name, query = {} } = parameters
|
|
47
|
-
|
|
48
33
|
const config = useConfig(parameters)
|
|
49
34
|
const chainId = useChainId({ config })
|
|
50
|
-
|
|
51
35
|
const options = getEnsAddressQueryOptions(config, {
|
|
52
36
|
...parameters,
|
|
53
37
|
chainId: parameters.chainId ?? chainId,
|
|
38
|
+
query: parameters.query,
|
|
54
39
|
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return useQuery({ ...query, ...options, enabled })
|
|
40
|
+
return useQuery(options)
|
|
58
41
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type {
|
|
4
3
|
Config,
|
|
5
4
|
GetEnsAvatarErrorType,
|
|
@@ -9,12 +8,9 @@ import type { Compute } from '@wagmi/core/internal'
|
|
|
9
8
|
import {
|
|
10
9
|
type GetEnsAvatarData,
|
|
11
10
|
type GetEnsAvatarOptions,
|
|
12
|
-
type GetEnsAvatarQueryFnData,
|
|
13
|
-
type GetEnsAvatarQueryKey,
|
|
14
11
|
getEnsAvatarQueryOptions,
|
|
15
12
|
} from '@wagmi/core/query'
|
|
16
|
-
|
|
17
|
-
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
13
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
18
14
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
15
|
import { useChainId } from './useChainId.js'
|
|
20
16
|
import { useConfig } from './useConfig.js'
|
|
@@ -22,16 +18,7 @@ import { useConfig } from './useConfig.js'
|
|
|
22
18
|
export type UseEnsAvatarParameters<
|
|
23
19
|
config extends Config = Config,
|
|
24
20
|
selectData = GetEnsAvatarData,
|
|
25
|
-
> = Compute<
|
|
26
|
-
GetEnsAvatarOptions<config> &
|
|
27
|
-
ConfigParameter<config> &
|
|
28
|
-
QueryParameter<
|
|
29
|
-
GetEnsAvatarQueryFnData,
|
|
30
|
-
GetEnsAvatarErrorType,
|
|
31
|
-
selectData,
|
|
32
|
-
GetEnsAvatarQueryKey<config>
|
|
33
|
-
>
|
|
34
|
-
>
|
|
21
|
+
> = Compute<GetEnsAvatarOptions<config, selectData> & ConfigParameter<config>>
|
|
35
22
|
|
|
36
23
|
export type UseEnsAvatarReturnType<selectData = GetEnsAvatarData> =
|
|
37
24
|
UseQueryReturnType<selectData, GetEnsAvatarErrorType>
|
|
@@ -43,16 +30,12 @@ export function useEnsAvatar<
|
|
|
43
30
|
>(
|
|
44
31
|
parameters: UseEnsAvatarParameters<config, selectData> = {},
|
|
45
32
|
): UseEnsAvatarReturnType<selectData> {
|
|
46
|
-
const { name, query = {} } = parameters
|
|
47
|
-
|
|
48
33
|
const config = useConfig(parameters)
|
|
49
34
|
const chainId = useChainId({ config })
|
|
50
|
-
|
|
51
35
|
const options = getEnsAvatarQueryOptions(config, {
|
|
52
36
|
...parameters,
|
|
53
37
|
chainId: parameters.chainId ?? chainId,
|
|
38
|
+
query: parameters.query,
|
|
54
39
|
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return useQuery({ ...query, ...options, enabled })
|
|
40
|
+
return useQuery(options)
|
|
58
41
|
}
|
package/src/hooks/useEnsName.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type { Config, GetEnsNameErrorType, ResolvedRegister } from '@wagmi/core'
|
|
4
3
|
import type { Compute } from '@wagmi/core/internal'
|
|
5
4
|
import {
|
|
6
5
|
type GetEnsNameData,
|
|
7
6
|
type GetEnsNameOptions,
|
|
8
|
-
type GetEnsNameQueryFnData,
|
|
9
|
-
type GetEnsNameQueryKey,
|
|
10
7
|
getEnsNameQueryOptions,
|
|
11
8
|
} from '@wagmi/core/query'
|
|
12
|
-
|
|
13
|
-
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
9
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
14
10
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
15
11
|
import { useChainId } from './useChainId.js'
|
|
16
12
|
import { useConfig } from './useConfig.js'
|
|
@@ -18,16 +14,7 @@ import { useConfig } from './useConfig.js'
|
|
|
18
14
|
export type UseEnsNameParameters<
|
|
19
15
|
config extends Config = Config,
|
|
20
16
|
selectData = GetEnsNameData,
|
|
21
|
-
> = Compute<
|
|
22
|
-
GetEnsNameOptions<config> &
|
|
23
|
-
ConfigParameter<config> &
|
|
24
|
-
QueryParameter<
|
|
25
|
-
GetEnsNameQueryFnData,
|
|
26
|
-
GetEnsNameErrorType,
|
|
27
|
-
selectData,
|
|
28
|
-
GetEnsNameQueryKey<config>
|
|
29
|
-
>
|
|
30
|
-
>
|
|
17
|
+
> = Compute<GetEnsNameOptions<config, selectData> & ConfigParameter<config>>
|
|
31
18
|
|
|
32
19
|
export type UseEnsNameReturnType<selectData = GetEnsNameData> =
|
|
33
20
|
UseQueryReturnType<selectData, GetEnsNameErrorType>
|
|
@@ -39,16 +26,12 @@ export function useEnsName<
|
|
|
39
26
|
>(
|
|
40
27
|
parameters: UseEnsNameParameters<config, selectData> = {},
|
|
41
28
|
): UseEnsNameReturnType<selectData> {
|
|
42
|
-
const { address, query = {} } = parameters
|
|
43
|
-
|
|
44
29
|
const config = useConfig(parameters)
|
|
45
30
|
const chainId = useChainId({ config })
|
|
46
|
-
|
|
47
31
|
const options = getEnsNameQueryOptions(config, {
|
|
48
32
|
...parameters,
|
|
49
33
|
chainId: parameters.chainId ?? chainId,
|
|
34
|
+
query: parameters.query,
|
|
50
35
|
})
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return useQuery({ ...query, ...options, enabled })
|
|
36
|
+
return useQuery(options)
|
|
54
37
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type {
|
|
4
3
|
Config,
|
|
5
4
|
GetEnsResolverErrorType,
|
|
@@ -9,12 +8,9 @@ import type { Compute } from '@wagmi/core/internal'
|
|
|
9
8
|
import {
|
|
10
9
|
type GetEnsResolverData,
|
|
11
10
|
type GetEnsResolverOptions,
|
|
12
|
-
type GetEnsResolverQueryFnData,
|
|
13
|
-
type GetEnsResolverQueryKey,
|
|
14
11
|
getEnsResolverQueryOptions,
|
|
15
12
|
} from '@wagmi/core/query'
|
|
16
|
-
|
|
17
|
-
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
13
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
18
14
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
19
15
|
import { useChainId } from './useChainId.js'
|
|
20
16
|
import { useConfig } from './useConfig.js'
|
|
@@ -22,16 +18,7 @@ import { useConfig } from './useConfig.js'
|
|
|
22
18
|
export type UseEnsResolverParameters<
|
|
23
19
|
config extends Config = Config,
|
|
24
20
|
selectData = GetEnsResolverData,
|
|
25
|
-
> = Compute<
|
|
26
|
-
GetEnsResolverOptions<config> &
|
|
27
|
-
ConfigParameter<config> &
|
|
28
|
-
QueryParameter<
|
|
29
|
-
GetEnsResolverQueryFnData,
|
|
30
|
-
GetEnsResolverErrorType,
|
|
31
|
-
selectData,
|
|
32
|
-
GetEnsResolverQueryKey<config>
|
|
33
|
-
>
|
|
34
|
-
>
|
|
21
|
+
> = Compute<GetEnsResolverOptions<config, selectData> & ConfigParameter<config>>
|
|
35
22
|
|
|
36
23
|
export type UseEnsResolverReturnType<selectData = GetEnsResolverData> =
|
|
37
24
|
UseQueryReturnType<selectData, GetEnsResolverErrorType>
|
|
@@ -43,16 +30,12 @@ export function useEnsResolver<
|
|
|
43
30
|
>(
|
|
44
31
|
parameters: UseEnsResolverParameters<config, selectData> = {},
|
|
45
32
|
): UseEnsResolverReturnType<selectData> {
|
|
46
|
-
const { name, query = {} } = parameters
|
|
47
|
-
|
|
48
33
|
const config = useConfig(parameters)
|
|
49
34
|
const chainId = useChainId({ config })
|
|
50
|
-
|
|
51
35
|
const options = getEnsResolverQueryOptions(config, {
|
|
52
36
|
...parameters,
|
|
53
37
|
chainId: parameters.chainId ?? chainId,
|
|
38
|
+
query: parameters.query,
|
|
54
39
|
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return useQuery({ ...query, ...options, enabled })
|
|
40
|
+
return useQuery(options)
|
|
58
41
|
}
|
package/src/hooks/useEnsText.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type { Config, GetEnsTextErrorType, ResolvedRegister } from '@wagmi/core'
|
|
4
3
|
import type { Compute } from '@wagmi/core/internal'
|
|
5
4
|
import {
|
|
6
5
|
type GetEnsTextData,
|
|
7
6
|
type GetEnsTextOptions,
|
|
8
|
-
type GetEnsTextQueryFnData,
|
|
9
|
-
type GetEnsTextQueryKey,
|
|
10
7
|
getEnsTextQueryOptions,
|
|
11
8
|
} from '@wagmi/core/query'
|
|
12
|
-
|
|
13
|
-
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
9
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
14
10
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
15
11
|
import { useChainId } from './useChainId.js'
|
|
16
12
|
import { useConfig } from './useConfig.js'
|
|
@@ -18,16 +14,7 @@ import { useConfig } from './useConfig.js'
|
|
|
18
14
|
export type UseEnsTextParameters<
|
|
19
15
|
config extends Config = Config,
|
|
20
16
|
selectData = GetEnsTextData,
|
|
21
|
-
> = Compute<
|
|
22
|
-
GetEnsTextOptions<config> &
|
|
23
|
-
ConfigParameter<config> &
|
|
24
|
-
QueryParameter<
|
|
25
|
-
GetEnsTextQueryFnData,
|
|
26
|
-
GetEnsTextErrorType,
|
|
27
|
-
selectData,
|
|
28
|
-
GetEnsTextQueryKey<config>
|
|
29
|
-
>
|
|
30
|
-
>
|
|
17
|
+
> = Compute<GetEnsTextOptions<config, selectData> & ConfigParameter<config>>
|
|
31
18
|
|
|
32
19
|
export type UseEnsTextReturnType<selectData = GetEnsTextData> =
|
|
33
20
|
UseQueryReturnType<selectData, GetEnsTextErrorType>
|
|
@@ -39,16 +26,12 @@ export function useEnsText<
|
|
|
39
26
|
>(
|
|
40
27
|
parameters: UseEnsTextParameters<config, selectData> = {},
|
|
41
28
|
): UseEnsTextReturnType<selectData> {
|
|
42
|
-
const { key, name, query = {} } = parameters
|
|
43
|
-
|
|
44
29
|
const config = useConfig(parameters)
|
|
45
30
|
const chainId = useChainId({ config })
|
|
46
|
-
|
|
47
31
|
const options = getEnsTextQueryOptions(config, {
|
|
48
32
|
...parameters,
|
|
49
33
|
chainId: parameters.chainId ?? chainId,
|
|
34
|
+
query: parameters.query,
|
|
50
35
|
})
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return useQuery({ ...query, ...options, enabled })
|
|
36
|
+
return useQuery(options)
|
|
54
37
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
2
|
import type {
|
|
4
3
|
Config,
|
|
5
4
|
EstimateFeesPerGasErrorType,
|
|
@@ -9,13 +8,10 @@ import type { Compute } from '@wagmi/core/internal'
|
|
|
9
8
|
import {
|
|
10
9
|
type EstimateFeesPerGasData,
|
|
11
10
|
type EstimateFeesPerGasOptions,
|
|
12
|
-
type EstimateFeesPerGasQueryFnData,
|
|
13
|
-
type EstimateFeesPerGasQueryKey,
|
|
14
11
|
estimateFeesPerGasQueryOptions,
|
|
15
12
|
} from '@wagmi/core/query'
|
|
16
13
|
import type { FeeValuesType } from 'viem'
|
|
17
|
-
|
|
18
|
-
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
14
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
19
15
|
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
20
16
|
import { useChainId } from './useChainId.js'
|
|
21
17
|
import { useConfig } from './useConfig.js'
|
|
@@ -25,14 +21,7 @@ export type UseEstimateFeesPerGasParameters<
|
|
|
25
21
|
config extends Config = Config,
|
|
26
22
|
selectData = EstimateFeesPerGasData<type>,
|
|
27
23
|
> = Compute<
|
|
28
|
-
EstimateFeesPerGasOptions<type, config> &
|
|
29
|
-
ConfigParameter<config> &
|
|
30
|
-
QueryParameter<
|
|
31
|
-
EstimateFeesPerGasQueryFnData<type>,
|
|
32
|
-
EstimateFeesPerGasErrorType,
|
|
33
|
-
selectData,
|
|
34
|
-
EstimateFeesPerGasQueryKey<config, type>
|
|
35
|
-
>
|
|
24
|
+
EstimateFeesPerGasOptions<type, config, selectData> & ConfigParameter<config>
|
|
36
25
|
>
|
|
37
26
|
|
|
38
27
|
export type UseEstimateFeesPerGasReturnType<
|
|
@@ -48,15 +37,12 @@ export function useEstimateFeesPerGas<
|
|
|
48
37
|
>(
|
|
49
38
|
parameters: UseEstimateFeesPerGasParameters<type, config, selectData> = {},
|
|
50
39
|
): UseEstimateFeesPerGasReturnType<type, selectData> {
|
|
51
|
-
const { query = {} } = parameters
|
|
52
|
-
|
|
53
40
|
const config = useConfig(parameters)
|
|
54
41
|
const chainId = useChainId({ config })
|
|
55
|
-
|
|
56
42
|
const options = estimateFeesPerGasQueryOptions(config, {
|
|
57
43
|
...parameters,
|
|
58
44
|
chainId: parameters.chainId ?? chainId,
|
|
45
|
+
query: parameters.query,
|
|
59
46
|
})
|
|
60
|
-
|
|
61
|
-
return useQuery({ ...query, ...options })
|
|
47
|
+
return useQuery(options)
|
|
62
48
|
}
|