@wagmi/core 3.2.0 → 3.2.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/actions/prepareTransactionRequest.js.map +1 -1
- package/dist/esm/actions/simulateContract.js.map +1 -1
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/exports/query.js.map +1 -1
- package/dist/esm/query/call.js +4 -3
- package/dist/esm/query/call.js.map +1 -1
- package/dist/esm/query/estimateFeesPerGas.js +3 -2
- package/dist/esm/query/estimateFeesPerGas.js.map +1 -1
- package/dist/esm/query/estimateGas.js +12 -7
- package/dist/esm/query/estimateGas.js.map +1 -1
- package/dist/esm/query/estimateMaxPriorityFeePerGas.js +3 -2
- package/dist/esm/query/estimateMaxPriorityFeePerGas.js.map +1 -1
- package/dist/esm/query/getBalance.js +6 -4
- package/dist/esm/query/getBalance.js.map +1 -1
- package/dist/esm/query/getBlock.js +3 -2
- package/dist/esm/query/getBlock.js.map +1 -1
- package/dist/esm/query/getBlockNumber.js +3 -2
- package/dist/esm/query/getBlockNumber.js.map +1 -1
- package/dist/esm/query/getBlockTransactionCount.js +3 -2
- package/dist/esm/query/getBlockTransactionCount.js.map +1 -1
- package/dist/esm/query/getBytecode.js +10 -5
- package/dist/esm/query/getBytecode.js.map +1 -1
- package/dist/esm/query/getCallsStatus.js +6 -8
- package/dist/esm/query/getCallsStatus.js.map +1 -1
- package/dist/esm/query/getCapabilities.js +6 -8
- package/dist/esm/query/getCapabilities.js.map +1 -1
- package/dist/esm/query/getConnectorClient.js +7 -9
- package/dist/esm/query/getConnectorClient.js.map +1 -1
- package/dist/esm/query/getEnsAddress.js +6 -4
- package/dist/esm/query/getEnsAddress.js.map +1 -1
- package/dist/esm/query/getEnsAvatar.js +6 -4
- package/dist/esm/query/getEnsAvatar.js.map +1 -1
- package/dist/esm/query/getEnsName.js +6 -4
- package/dist/esm/query/getEnsName.js.map +1 -1
- package/dist/esm/query/getEnsResolver.js +6 -4
- package/dist/esm/query/getEnsResolver.js.map +1 -1
- package/dist/esm/query/getEnsText.js +10 -4
- package/dist/esm/query/getEnsText.js.map +1 -1
- package/dist/esm/query/getFeeHistory.js +10 -6
- package/dist/esm/query/getFeeHistory.js.map +1 -1
- package/dist/esm/query/getGasPrice.js +3 -2
- package/dist/esm/query/getGasPrice.js.map +1 -1
- package/dist/esm/query/getProof.js +13 -5
- package/dist/esm/query/getProof.js.map +1 -1
- package/dist/esm/query/getStorageAt.js +11 -5
- package/dist/esm/query/getStorageAt.js.map +1 -1
- package/dist/esm/query/getTransaction.js +14 -8
- package/dist/esm/query/getTransaction.js.map +1 -1
- package/dist/esm/query/getTransactionConfirmations.js +8 -5
- package/dist/esm/query/getTransactionConfirmations.js.map +1 -1
- package/dist/esm/query/getTransactionCount.js +6 -4
- package/dist/esm/query/getTransactionCount.js.map +1 -1
- package/dist/esm/query/getTransactionReceipt.js +10 -5
- package/dist/esm/query/getTransactionReceipt.js.map +1 -1
- package/dist/esm/query/getWalletClient.js +12 -9
- package/dist/esm/query/getWalletClient.js.map +1 -1
- package/dist/esm/query/infiniteReadContracts.js +1 -1
- package/dist/esm/query/infiniteReadContracts.js.map +1 -1
- package/dist/esm/query/prepareTransactionRequest.js +7 -5
- package/dist/esm/query/prepareTransactionRequest.js.map +1 -1
- package/dist/esm/query/readContract.js +18 -21
- package/dist/esm/query/readContract.js.map +1 -1
- package/dist/esm/query/readContracts.js +5 -4
- package/dist/esm/query/readContracts.js.map +1 -1
- package/dist/esm/query/simulateContract.js +18 -10
- package/dist/esm/query/simulateContract.js.map +1 -1
- package/dist/esm/query/utils.js +3 -1
- package/dist/esm/query/utils.js.map +1 -1
- package/dist/esm/query/verifyMessage.js +20 -7
- package/dist/esm/query/verifyMessage.js.map +1 -1
- package/dist/esm/query/verifyTypedData.js +20 -13
- package/dist/esm/query/verifyTypedData.js.map +1 -1
- package/dist/esm/query/waitForCallsStatus.js +14 -11
- package/dist/esm/query/waitForCallsStatus.js.map +1 -1
- package/dist/esm/query/waitForTransactionReceipt.js +6 -4
- package/dist/esm/query/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/tempo/Connectors.js +39 -30
- package/dist/esm/tempo/Connectors.js.map +1 -1
- package/dist/esm/tempo/actions/amm.js +1 -1
- package/dist/esm/tempo/actions/amm.js.map +1 -1
- package/dist/esm/tempo/actions/fee.js +1 -1
- package/dist/esm/tempo/actions/fee.js.map +1 -1
- package/dist/esm/tempo/actions/nonce.js +1 -1
- package/dist/esm/tempo/actions/nonce.js.map +1 -1
- package/dist/esm/tempo/actions/utils.js +17 -1
- package/dist/esm/tempo/actions/utils.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/query.js +2 -0
- package/dist/esm/types/query.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/actions/prepareTransactionRequest.d.ts +2 -2
- package/dist/types/actions/prepareTransactionRequest.d.ts.map +1 -1
- package/dist/types/actions/simulateContract.d.ts +5 -3
- package/dist/types/actions/simulateContract.d.ts.map +1 -1
- package/dist/types/actions/verifyTypedData.d.ts +2 -2
- package/dist/types/actions/verifyTypedData.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +1 -0
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/exports/query.d.ts +34 -34
- package/dist/types/exports/query.d.ts.map +1 -1
- package/dist/types/query/call.d.ts +34 -13
- package/dist/types/query/call.d.ts.map +1 -1
- package/dist/types/query/estimateFeesPerGas.d.ts +7 -22
- package/dist/types/query/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/query/estimateGas.d.ts +12 -15
- package/dist/types/query/estimateGas.d.ts.map +1 -1
- package/dist/types/query/estimateMaxPriorityFeePerGas.d.ts +6 -19
- package/dist/types/query/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
- package/dist/types/query/getBalance.d.ts +8 -27
- package/dist/types/query/getBalance.d.ts.map +1 -1
- package/dist/types/query/getBlock.d.ts +13 -13
- package/dist/types/query/getBlock.d.ts.map +1 -1
- package/dist/types/query/getBlockNumber.d.ts +7 -23
- package/dist/types/query/getBlockNumber.d.ts.map +1 -1
- package/dist/types/query/getBlockTransactionCount.d.ts +12 -13
- package/dist/types/query/getBlockTransactionCount.d.ts.map +1 -1
- package/dist/types/query/getBytecode.d.ts +12 -13
- package/dist/types/query/getBytecode.d.ts.map +1 -1
- package/dist/types/query/getCallsStatus.d.ts +7 -36
- package/dist/types/query/getCallsStatus.d.ts.map +1 -1
- package/dist/types/query/getCapabilities.d.ts +8 -50
- package/dist/types/query/getCapabilities.d.ts.map +1 -1
- package/dist/types/query/getConnectorClient.d.ts +11 -521
- package/dist/types/query/getConnectorClient.d.ts.map +1 -1
- package/dist/types/query/getEnsAddress.d.ts +8 -35
- package/dist/types/query/getEnsAddress.d.ts.map +1 -1
- package/dist/types/query/getEnsAvatar.d.ts +7 -34
- package/dist/types/query/getEnsAvatar.d.ts.map +1 -1
- package/dist/types/query/getEnsName.d.ts +8 -35
- package/dist/types/query/getEnsName.d.ts.map +1 -1
- package/dist/types/query/getEnsResolver.d.ts +8 -29
- package/dist/types/query/getEnsResolver.d.ts.map +1 -1
- package/dist/types/query/getEnsText.d.ts +9 -36
- package/dist/types/query/getEnsText.d.ts.map +1 -1
- package/dist/types/query/getFeeHistory.d.ts +9 -30
- package/dist/types/query/getFeeHistory.d.ts.map +1 -1
- package/dist/types/query/getGasPrice.d.ts +6 -19
- package/dist/types/query/getGasPrice.d.ts.map +1 -1
- package/dist/types/query/getProof.d.ts +13 -13
- package/dist/types/query/getProof.d.ts.map +1 -1
- package/dist/types/query/getStorageAt.d.ts +13 -13
- package/dist/types/query/getStorageAt.d.ts.map +1 -1
- package/dist/types/query/getTransaction.d.ts +16 -15
- package/dist/types/query/getTransaction.d.ts.map +1 -1
- package/dist/types/query/getTransactionConfirmations.d.ts +9 -13
- package/dist/types/query/getTransactionConfirmations.d.ts.map +1 -1
- package/dist/types/query/getTransactionCount.d.ts +8 -27
- package/dist/types/query/getTransactionCount.d.ts.map +1 -1
- package/dist/types/query/getTransactionReceipt.d.ts +7 -24
- package/dist/types/query/getTransactionReceipt.d.ts.map +1 -1
- package/dist/types/query/getWalletClient.d.ts +11 -31
- package/dist/types/query/getWalletClient.d.ts.map +1 -1
- package/dist/types/query/infiniteReadContracts.d.ts +13 -13
- package/dist/types/query/infiniteReadContracts.d.ts.map +1 -1
- package/dist/types/query/prepareTransactionRequest.d.ts +9 -13
- package/dist/types/query/prepareTransactionRequest.d.ts.map +1 -1
- package/dist/types/query/readContract.d.ts +9 -167
- package/dist/types/query/readContract.d.ts.map +1 -1
- package/dist/types/query/readContracts.d.ts +18 -60
- package/dist/types/query/readContracts.d.ts.map +1 -1
- package/dist/types/query/simulateContract.d.ts +11 -14
- package/dist/types/query/simulateContract.d.ts.map +1 -1
- package/dist/types/query/utils.d.ts +9 -1
- package/dist/types/query/utils.d.ts.map +1 -1
- package/dist/types/query/verifyMessage.d.ts +8 -43
- package/dist/types/query/verifyMessage.d.ts.map +1 -1
- package/dist/types/query/verifyTypedData.d.ts +10 -14
- package/dist/types/query/verifyTypedData.d.ts.map +1 -1
- package/dist/types/query/waitForCallsStatus.d.ts +9 -56
- package/dist/types/query/waitForCallsStatus.d.ts.map +1 -1
- package/dist/types/query/waitForTransactionReceipt.d.ts +11 -46
- package/dist/types/query/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/tempo/Connectors.d.ts.map +1 -1
- package/dist/types/tempo/actions/amm.d.ts.map +1 -1
- package/dist/types/tempo/actions/fee.d.ts.map +1 -1
- package/dist/types/tempo/actions/nonce.d.ts.map +1 -1
- package/dist/types/tempo/actions/utils.d.ts +1 -0
- package/dist/types/tempo/actions/utils.d.ts.map +1 -1
- package/dist/types/types/query.d.ts +9 -0
- package/dist/types/types/query.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/actions/prepareTransactionRequest.ts +9 -12
- package/src/actions/simulateContract.ts +11 -19
- package/src/actions/verifyTypedData.ts +2 -2
- package/src/exports/internal.ts +2 -0
- package/src/exports/query.ts +34 -0
- package/src/query/call.ts +29 -16
- package/src/query/estimateFeesPerGas.ts +34 -12
- package/src/query/estimateGas.ts +53 -24
- package/src/query/estimateMaxPriorityFeePerGas.ts +37 -18
- package/src/query/getBalance.ts +38 -20
- package/src/query/getBlock.ts +50 -16
- package/src/query/getBlockNumber.ts +34 -13
- package/src/query/getBlockTransactionCount.ts +34 -15
- package/src/query/getBytecode.ts +41 -19
- package/src/query/getCallsStatus.ts +36 -21
- package/src/query/getCapabilities.ts +40 -18
- package/src/query/getConnectorClient.ts +45 -20
- package/src/query/getEnsAddress.ts +37 -19
- package/src/query/getEnsAvatar.ts +37 -19
- package/src/query/getEnsName.ts +37 -19
- package/src/query/getEnsResolver.ts +38 -18
- package/src/query/getEnsText.ts +44 -19
- package/src/query/getFeeHistory.ts +46 -28
- package/src/query/getGasPrice.ts +34 -13
- package/src/query/getProof.ts +45 -19
- package/src/query/getStorageAt.ts +44 -19
- package/src/query/getTransaction.ts +51 -19
- package/src/query/getTransactionConfirmations.ts +46 -23
- package/src/query/getTransactionCount.ts +41 -22
- package/src/query/getTransactionReceipt.ts +42 -14
- package/src/query/getWalletClient.ts +46 -20
- package/src/query/infiniteReadContracts.ts +1 -1
- package/src/query/prepareTransactionRequest.ts +45 -17
- package/src/query/readContract.ts +55 -36
- package/src/query/readContracts.ts +38 -16
- package/src/query/simulateContract.ts +68 -33
- package/src/query/utils.ts +14 -5
- package/src/query/verifyMessage.ts +50 -26
- package/src/query/verifyTypedData.ts +65 -38
- package/src/query/waitForCallsStatus.ts +47 -25
- package/src/query/waitForTransactionReceipt.ts +36 -16
- package/src/tempo/Connectors.ts +48 -38
- package/src/tempo/actions/amm.ts +2 -2
- package/src/tempo/actions/fee.ts +1 -1
- package/src/tempo/actions/nonce.ts +1 -1
- package/src/tempo/actions/utils.ts +26 -0
- package/src/types/query.ts +40 -0
- package/src/version.ts +1 -1
package/src/query/getEnsText.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { QueryOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
type GetEnsTextErrorType,
|
|
5
3
|
type GetEnsTextParameters,
|
|
@@ -8,30 +6,45 @@ import {
|
|
|
8
6
|
} from '../actions/getEnsText.js'
|
|
9
7
|
import type { Config } from '../createConfig.js'
|
|
10
8
|
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
9
|
+
import type { QueryOptions, QueryParameter } from '../types/query.js'
|
|
11
10
|
import type { Compute, ExactPartial } from '../types/utils.js'
|
|
12
11
|
import { filterQueryOptions } from './utils.js'
|
|
13
12
|
|
|
14
|
-
export type GetEnsTextOptions<
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export type GetEnsTextOptions<
|
|
14
|
+
config extends Config,
|
|
15
|
+
selectData = GetEnsTextData,
|
|
16
|
+
> = Compute<ExactPartial<GetEnsTextParameters<config>> & ScopeKeyParameter> &
|
|
17
|
+
QueryParameter<
|
|
18
|
+
GetEnsTextQueryFnData,
|
|
19
|
+
GetEnsTextErrorType,
|
|
20
|
+
selectData,
|
|
21
|
+
GetEnsTextQueryKey<config>
|
|
22
|
+
>
|
|
17
23
|
|
|
18
|
-
export function getEnsTextQueryOptions<
|
|
24
|
+
export function getEnsTextQueryOptions<
|
|
25
|
+
config extends Config,
|
|
26
|
+
selectData = GetEnsTextData,
|
|
27
|
+
>(
|
|
19
28
|
config: config,
|
|
20
|
-
options: GetEnsTextOptions<config> = {},
|
|
21
|
-
) {
|
|
29
|
+
options: GetEnsTextOptions<config, selectData> = {},
|
|
30
|
+
): GetEnsTextQueryOptions<config, selectData> {
|
|
22
31
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
...options.query,
|
|
33
|
+
enabled: Boolean(
|
|
34
|
+
options.key && options.name && (options.query?.enabled ?? true),
|
|
35
|
+
),
|
|
36
|
+
queryFn: async (context) => {
|
|
37
|
+
const [, { scopeKey: _, ...parameters }] = context.queryKey
|
|
38
|
+
if (!parameters.key || !parameters.name)
|
|
39
|
+
throw new Error('key and name are required')
|
|
40
|
+
return getEnsText(config, {
|
|
41
|
+
...parameters,
|
|
42
|
+
key: parameters.key,
|
|
43
|
+
name: parameters.name,
|
|
44
|
+
})
|
|
27
45
|
},
|
|
28
46
|
queryKey: getEnsTextQueryKey(options),
|
|
29
|
-
}
|
|
30
|
-
GetEnsTextQueryFnData,
|
|
31
|
-
GetEnsTextErrorType,
|
|
32
|
-
GetEnsTextData,
|
|
33
|
-
GetEnsTextQueryKey<config>
|
|
34
|
-
>
|
|
47
|
+
}
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
export type GetEnsTextQueryFnData = GetEnsTextReturnType
|
|
@@ -39,7 +52,9 @@ export type GetEnsTextQueryFnData = GetEnsTextReturnType
|
|
|
39
52
|
export type GetEnsTextData = GetEnsTextQueryFnData
|
|
40
53
|
|
|
41
54
|
export function getEnsTextQueryKey<config extends Config>(
|
|
42
|
-
options:
|
|
55
|
+
options: Compute<
|
|
56
|
+
ExactPartial<GetEnsTextParameters<config>> & ScopeKeyParameter
|
|
57
|
+
> = {},
|
|
43
58
|
) {
|
|
44
59
|
return ['ensText', filterQueryOptions(options)] as const
|
|
45
60
|
}
|
|
@@ -47,3 +62,13 @@ export function getEnsTextQueryKey<config extends Config>(
|
|
|
47
62
|
export type GetEnsTextQueryKey<config extends Config> = ReturnType<
|
|
48
63
|
typeof getEnsTextQueryKey<config>
|
|
49
64
|
>
|
|
65
|
+
|
|
66
|
+
export type GetEnsTextQueryOptions<
|
|
67
|
+
config extends Config,
|
|
68
|
+
selectData = GetEnsTextData,
|
|
69
|
+
> = QueryOptions<
|
|
70
|
+
GetEnsTextQueryFnData,
|
|
71
|
+
GetEnsTextErrorType,
|
|
72
|
+
selectData,
|
|
73
|
+
GetEnsTextQueryKey<config>
|
|
74
|
+
>
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { QueryOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
type GetFeeHistoryErrorType,
|
|
5
3
|
type GetFeeHistoryParameters,
|
|
@@ -8,48 +6,53 @@ import {
|
|
|
8
6
|
} from '../actions/getFeeHistory.js'
|
|
9
7
|
import type { Config } from '../createConfig.js'
|
|
10
8
|
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
11
|
-
import type {
|
|
9
|
+
import type { QueryOptions, QueryParameter } from '../types/query.js'
|
|
10
|
+
import type { Compute, ExactPartial } from '../types/utils.js'
|
|
12
11
|
import { filterQueryOptions } from './utils.js'
|
|
13
12
|
|
|
14
13
|
export type GetFeeHistoryOptions<
|
|
15
14
|
config extends Config,
|
|
16
15
|
chainId extends config['chains'][number]['id'],
|
|
16
|
+
selectData = GetFeeHistoryData,
|
|
17
17
|
> = Compute<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
ExactPartial<GetFeeHistoryParameters<config, chainId>> & ScopeKeyParameter
|
|
19
|
+
> &
|
|
20
|
+
QueryParameter<
|
|
21
|
+
GetFeeHistoryQueryFnData,
|
|
22
|
+
GetFeeHistoryErrorType,
|
|
23
|
+
selectData,
|
|
24
|
+
GetFeeHistoryQueryKey<config, chainId>
|
|
25
|
+
>
|
|
24
26
|
|
|
25
27
|
export function getFeeHistoryQueryOptions<
|
|
26
28
|
config extends Config,
|
|
27
29
|
chainId extends config['chains'][number]['id'],
|
|
28
|
-
|
|
30
|
+
selectData = GetFeeHistoryData,
|
|
31
|
+
>(
|
|
32
|
+
config: config,
|
|
33
|
+
options: GetFeeHistoryOptions<config, chainId, selectData> = {},
|
|
34
|
+
): GetFeeHistoryQueryOptions<config, chainId, selectData> {
|
|
29
35
|
return {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
rewardPercentiles
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (!
|
|
36
|
+
...options.query,
|
|
37
|
+
enabled: Boolean(
|
|
38
|
+
options.blockCount &&
|
|
39
|
+
options.rewardPercentiles &&
|
|
40
|
+
(options.query?.enabled ?? true),
|
|
41
|
+
),
|
|
42
|
+
queryFn: async (context) => {
|
|
43
|
+
const [, { scopeKey: _, ...parameters }] = context.queryKey
|
|
44
|
+
if (!parameters.blockCount) throw new Error('blockCount is required')
|
|
45
|
+
if (!parameters.rewardPercentiles)
|
|
46
|
+
throw new Error('rewardPercentiles is required')
|
|
39
47
|
const feeHistory = await getFeeHistory(config, {
|
|
40
48
|
...(parameters as GetFeeHistoryParameters),
|
|
41
|
-
blockCount,
|
|
42
|
-
rewardPercentiles,
|
|
49
|
+
blockCount: parameters.blockCount,
|
|
50
|
+
rewardPercentiles: parameters.rewardPercentiles,
|
|
43
51
|
})
|
|
44
52
|
return feeHistory ?? null
|
|
45
53
|
},
|
|
46
54
|
queryKey: getFeeHistoryQueryKey(options),
|
|
47
|
-
}
|
|
48
|
-
GetFeeHistoryQueryFnData,
|
|
49
|
-
GetFeeHistoryErrorType,
|
|
50
|
-
GetFeeHistoryData,
|
|
51
|
-
GetFeeHistoryQueryKey<config, chainId>
|
|
52
|
-
>
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
export type GetFeeHistoryQueryFnData = GetFeeHistoryReturnType
|
|
@@ -59,7 +62,11 @@ export type GetFeeHistoryData = GetFeeHistoryQueryFnData
|
|
|
59
62
|
export function getFeeHistoryQueryKey<
|
|
60
63
|
config extends Config,
|
|
61
64
|
chainId extends config['chains'][number]['id'],
|
|
62
|
-
>(
|
|
65
|
+
>(
|
|
66
|
+
options: Compute<
|
|
67
|
+
ExactPartial<GetFeeHistoryParameters<config, chainId>> & ScopeKeyParameter
|
|
68
|
+
> = {},
|
|
69
|
+
) {
|
|
63
70
|
return ['feeHistory', filterQueryOptions(options)] as const
|
|
64
71
|
}
|
|
65
72
|
|
|
@@ -67,3 +74,14 @@ export type GetFeeHistoryQueryKey<
|
|
|
67
74
|
config extends Config,
|
|
68
75
|
chainId extends config['chains'][number]['id'],
|
|
69
76
|
> = ReturnType<typeof getFeeHistoryQueryKey<config, chainId>>
|
|
77
|
+
|
|
78
|
+
export type GetFeeHistoryQueryOptions<
|
|
79
|
+
config extends Config,
|
|
80
|
+
chainId extends config['chains'][number]['id'],
|
|
81
|
+
selectData = GetFeeHistoryData,
|
|
82
|
+
> = QueryOptions<
|
|
83
|
+
GetFeeHistoryQueryFnData,
|
|
84
|
+
GetFeeHistoryErrorType,
|
|
85
|
+
selectData,
|
|
86
|
+
GetFeeHistoryQueryKey<config, chainId>
|
|
87
|
+
>
|
package/src/query/getGasPrice.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { QueryOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
type GetGasPriceErrorType,
|
|
5
3
|
type GetGasPriceParameters,
|
|
@@ -8,33 +6,41 @@ import {
|
|
|
8
6
|
} from '../actions/getGasPrice.js'
|
|
9
7
|
import type { Config } from '../createConfig.js'
|
|
10
8
|
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
9
|
+
import type { QueryOptions, QueryParameter } from '../types/query.js'
|
|
11
10
|
import type { Compute, ExactPartial } from '../types/utils.js'
|
|
12
11
|
import { filterQueryOptions } from './utils.js'
|
|
13
12
|
|
|
14
13
|
export type GetGasPriceOptions<
|
|
15
14
|
config extends Config,
|
|
16
15
|
chainId extends config['chains'][number]['id'],
|
|
16
|
+
selectData = GetGasPriceData,
|
|
17
17
|
> = Compute<
|
|
18
18
|
ExactPartial<GetGasPriceParameters<config, chainId>> & ScopeKeyParameter
|
|
19
|
-
>
|
|
19
|
+
> &
|
|
20
|
+
QueryParameter<
|
|
21
|
+
GetGasPriceQueryFnData,
|
|
22
|
+
GetGasPriceErrorType,
|
|
23
|
+
selectData,
|
|
24
|
+
GetGasPriceQueryKey<config, chainId>
|
|
25
|
+
>
|
|
20
26
|
|
|
21
27
|
export function getGasPriceQueryOptions<
|
|
22
28
|
config extends Config,
|
|
23
29
|
chainId extends config['chains'][number]['id'],
|
|
24
|
-
|
|
30
|
+
selectData = GetGasPriceData,
|
|
31
|
+
>(
|
|
32
|
+
config: config,
|
|
33
|
+
options: GetGasPriceOptions<config, chainId, selectData> = {},
|
|
34
|
+
): GetGasPriceQueryOptions<config, chainId, selectData> {
|
|
25
35
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
36
|
+
...options.query,
|
|
37
|
+
queryFn: async (context) => {
|
|
38
|
+
const [, { scopeKey: _, ...parameters }] = context.queryKey
|
|
28
39
|
const gasPrice = await getGasPrice(config, parameters)
|
|
29
40
|
return gasPrice ?? null
|
|
30
41
|
},
|
|
31
42
|
queryKey: getGasPriceQueryKey(options),
|
|
32
|
-
}
|
|
33
|
-
GetGasPriceQueryFnData,
|
|
34
|
-
GetGasPriceErrorType,
|
|
35
|
-
GetGasPriceData,
|
|
36
|
-
GetGasPriceQueryKey<config, chainId>
|
|
37
|
-
>
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
export type GetGasPriceQueryFnData = GetGasPriceReturnType
|
|
@@ -44,7 +50,11 @@ export type GetGasPriceData = GetGasPriceQueryFnData
|
|
|
44
50
|
export function getGasPriceQueryKey<
|
|
45
51
|
config extends Config,
|
|
46
52
|
chainId extends config['chains'][number]['id'],
|
|
47
|
-
>(
|
|
53
|
+
>(
|
|
54
|
+
options: Compute<
|
|
55
|
+
ExactPartial<GetGasPriceParameters<config, chainId>> & ScopeKeyParameter
|
|
56
|
+
> = {},
|
|
57
|
+
) {
|
|
48
58
|
return ['gasPrice', filterQueryOptions(options)] as const
|
|
49
59
|
}
|
|
50
60
|
|
|
@@ -52,3 +62,14 @@ export type GetGasPriceQueryKey<
|
|
|
52
62
|
config extends Config,
|
|
53
63
|
chainId extends config['chains'][number]['id'],
|
|
54
64
|
> = ReturnType<typeof getGasPriceQueryKey<config, chainId>>
|
|
65
|
+
|
|
66
|
+
export type GetGasPriceQueryOptions<
|
|
67
|
+
config extends Config,
|
|
68
|
+
chainId extends config['chains'][number]['id'],
|
|
69
|
+
selectData = GetGasPriceData,
|
|
70
|
+
> = QueryOptions<
|
|
71
|
+
GetGasPriceQueryFnData,
|
|
72
|
+
GetGasPriceErrorType,
|
|
73
|
+
selectData,
|
|
74
|
+
GetGasPriceQueryKey<config, chainId>
|
|
75
|
+
>
|
package/src/query/getProof.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { QueryOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
type GetProofErrorType,
|
|
5
3
|
type GetProofParameters,
|
|
@@ -8,31 +6,47 @@ import {
|
|
|
8
6
|
} from '../actions/getProof.js'
|
|
9
7
|
import type { Config } from '../createConfig.js'
|
|
10
8
|
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
9
|
+
import type { QueryOptions, QueryParameter } from '../types/query.js'
|
|
11
10
|
import type { Compute, ExactPartial } from '../types/utils.js'
|
|
12
11
|
import { filterQueryOptions } from './utils.js'
|
|
13
12
|
|
|
14
|
-
export type GetProofOptions<
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export type GetProofOptions<
|
|
14
|
+
config extends Config,
|
|
15
|
+
selectData = GetProofData,
|
|
16
|
+
> = Compute<ExactPartial<GetProofParameters<config>> & ScopeKeyParameter> &
|
|
17
|
+
QueryParameter<
|
|
18
|
+
GetProofQueryFnData,
|
|
19
|
+
GetProofErrorType,
|
|
20
|
+
selectData,
|
|
21
|
+
GetProofQueryKey<config>
|
|
22
|
+
>
|
|
17
23
|
|
|
18
|
-
export function getProofQueryOptions<
|
|
24
|
+
export function getProofQueryOptions<
|
|
25
|
+
config extends Config,
|
|
26
|
+
selectData = GetProofData,
|
|
27
|
+
>(
|
|
19
28
|
config: config,
|
|
20
|
-
options: GetProofOptions<config> = {},
|
|
21
|
-
) {
|
|
29
|
+
options: GetProofOptions<config, selectData> = {},
|
|
30
|
+
): GetProofQueryOptions<config, selectData> {
|
|
22
31
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
...options.query,
|
|
33
|
+
enabled: Boolean(
|
|
34
|
+
options.address &&
|
|
35
|
+
options.storageKeys &&
|
|
36
|
+
(options.query?.enabled ?? true),
|
|
37
|
+
),
|
|
38
|
+
queryFn: async (context) => {
|
|
39
|
+
const [, { scopeKey: _, ...parameters }] = context.queryKey
|
|
40
|
+
if (!parameters.address || !parameters.storageKeys)
|
|
26
41
|
throw new Error('address and storageKeys are required')
|
|
27
|
-
return getProof(config, {
|
|
42
|
+
return getProof(config, {
|
|
43
|
+
...(parameters as GetProofParameters),
|
|
44
|
+
address: parameters.address,
|
|
45
|
+
storageKeys: parameters.storageKeys,
|
|
46
|
+
})
|
|
28
47
|
},
|
|
29
48
|
queryKey: getProofQueryKey(options),
|
|
30
|
-
}
|
|
31
|
-
GetProofQueryFnData,
|
|
32
|
-
GetProofErrorType,
|
|
33
|
-
GetProofData,
|
|
34
|
-
GetProofQueryKey<config>
|
|
35
|
-
>
|
|
49
|
+
}
|
|
36
50
|
}
|
|
37
51
|
|
|
38
52
|
export type GetProofQueryFnData = GetProofReturnType
|
|
@@ -40,7 +54,9 @@ export type GetProofQueryFnData = GetProofReturnType
|
|
|
40
54
|
export type GetProofData = GetProofQueryFnData
|
|
41
55
|
|
|
42
56
|
export function getProofQueryKey<config extends Config>(
|
|
43
|
-
options:
|
|
57
|
+
options: Compute<
|
|
58
|
+
ExactPartial<GetProofParameters<config>> & ScopeKeyParameter
|
|
59
|
+
> = {},
|
|
44
60
|
) {
|
|
45
61
|
return ['getProof', filterQueryOptions(options)] as const
|
|
46
62
|
}
|
|
@@ -48,3 +64,13 @@ export function getProofQueryKey<config extends Config>(
|
|
|
48
64
|
export type GetProofQueryKey<config extends Config> = ReturnType<
|
|
49
65
|
typeof getProofQueryKey<config>
|
|
50
66
|
>
|
|
67
|
+
|
|
68
|
+
export type GetProofQueryOptions<
|
|
69
|
+
config extends Config,
|
|
70
|
+
selectData = GetProofData,
|
|
71
|
+
> = QueryOptions<
|
|
72
|
+
GetProofQueryFnData,
|
|
73
|
+
GetProofErrorType,
|
|
74
|
+
selectData,
|
|
75
|
+
GetProofQueryKey<config>
|
|
76
|
+
>
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { QueryOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
type GetStorageAtErrorType,
|
|
5
3
|
type GetStorageAtParameters,
|
|
@@ -8,30 +6,45 @@ import {
|
|
|
8
6
|
} from '../actions/getStorageAt.js'
|
|
9
7
|
import type { Config } from '../createConfig.js'
|
|
10
8
|
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
9
|
+
import type { QueryOptions, QueryParameter } from '../types/query.js'
|
|
11
10
|
import type { Compute, ExactPartial } from '../types/utils.js'
|
|
12
11
|
import { filterQueryOptions } from './utils.js'
|
|
13
12
|
|
|
14
|
-
export type GetStorageAtOptions<
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export type GetStorageAtOptions<
|
|
14
|
+
config extends Config,
|
|
15
|
+
selectData = GetStorageAtData,
|
|
16
|
+
> = Compute<ExactPartial<GetStorageAtParameters<config>> & ScopeKeyParameter> &
|
|
17
|
+
QueryParameter<
|
|
18
|
+
GetStorageAtQueryFnData,
|
|
19
|
+
GetStorageAtErrorType,
|
|
20
|
+
selectData,
|
|
21
|
+
GetStorageAtQueryKey<config>
|
|
22
|
+
>
|
|
17
23
|
|
|
18
|
-
export function getStorageAtQueryOptions<
|
|
24
|
+
export function getStorageAtQueryOptions<
|
|
25
|
+
config extends Config,
|
|
26
|
+
selectData = GetStorageAtData,
|
|
27
|
+
>(
|
|
19
28
|
config: config,
|
|
20
|
-
options: GetStorageAtOptions<config> = {},
|
|
21
|
-
) {
|
|
29
|
+
options: GetStorageAtOptions<config, selectData> = {},
|
|
30
|
+
): GetStorageAtQueryOptions<config, selectData> {
|
|
22
31
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
...options.query,
|
|
33
|
+
enabled: Boolean(
|
|
34
|
+
options.address && options.slot && (options.query?.enabled ?? true),
|
|
35
|
+
),
|
|
36
|
+
queryFn: async (context) => {
|
|
37
|
+
const [, { scopeKey: _, ...parameters }] = context.queryKey
|
|
38
|
+
if (!parameters.address || !parameters.slot)
|
|
39
|
+
throw new Error('address and slot are required')
|
|
40
|
+
return getStorageAt(config, {
|
|
41
|
+
...(parameters as GetStorageAtParameters),
|
|
42
|
+
address: parameters.address,
|
|
43
|
+
slot: parameters.slot,
|
|
44
|
+
})
|
|
27
45
|
},
|
|
28
46
|
queryKey: getStorageAtQueryKey(options),
|
|
29
|
-
}
|
|
30
|
-
GetStorageAtQueryFnData,
|
|
31
|
-
GetStorageAtErrorType,
|
|
32
|
-
GetStorageAtData,
|
|
33
|
-
GetStorageAtQueryKey<config>
|
|
34
|
-
>
|
|
47
|
+
}
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
export type GetStorageAtQueryFnData = GetStorageAtReturnType
|
|
@@ -39,7 +52,9 @@ export type GetStorageAtQueryFnData = GetStorageAtReturnType
|
|
|
39
52
|
export type GetStorageAtData = GetStorageAtQueryFnData
|
|
40
53
|
|
|
41
54
|
export function getStorageAtQueryKey<config extends Config>(
|
|
42
|
-
options:
|
|
55
|
+
options: Compute<
|
|
56
|
+
ExactPartial<GetStorageAtParameters<config>> & ScopeKeyParameter
|
|
57
|
+
> = {},
|
|
43
58
|
) {
|
|
44
59
|
return ['getStorageAt', filterQueryOptions(options)] as const
|
|
45
60
|
}
|
|
@@ -47,3 +62,13 @@ export function getStorageAtQueryKey<config extends Config>(
|
|
|
47
62
|
export type GetStorageAtQueryKey<config extends Config> = ReturnType<
|
|
48
63
|
typeof getStorageAtQueryKey<config>
|
|
49
64
|
>
|
|
65
|
+
|
|
66
|
+
export type GetStorageAtQueryOptions<
|
|
67
|
+
config extends Config,
|
|
68
|
+
selectData = GetStorageAtData,
|
|
69
|
+
> = QueryOptions<
|
|
70
|
+
GetStorageAtQueryFnData,
|
|
71
|
+
GetStorageAtErrorType,
|
|
72
|
+
selectData,
|
|
73
|
+
GetStorageAtQueryKey<config>
|
|
74
|
+
>
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { QueryOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
type GetTransactionErrorType,
|
|
5
3
|
type GetTransactionParameters,
|
|
@@ -8,42 +6,61 @@ import {
|
|
|
8
6
|
} from '../actions/getTransaction.js'
|
|
9
7
|
import type { Config } from '../createConfig.js'
|
|
10
8
|
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
9
|
+
import type { QueryOptions, QueryParameter } from '../types/query.js'
|
|
11
10
|
import type { Compute, ExactPartial } from '../types/utils.js'
|
|
12
11
|
import { filterQueryOptions } from './utils.js'
|
|
13
12
|
|
|
14
13
|
export type GetTransactionOptions<
|
|
15
14
|
config extends Config,
|
|
16
15
|
chainId extends config['chains'][number]['id'],
|
|
16
|
+
selectData = GetTransactionData<config, chainId>,
|
|
17
17
|
> = Compute<
|
|
18
18
|
ExactPartial<GetTransactionParameters<config, chainId>> & ScopeKeyParameter
|
|
19
|
-
>
|
|
19
|
+
> &
|
|
20
|
+
QueryParameter<
|
|
21
|
+
GetTransactionQueryFnData<config, chainId>,
|
|
22
|
+
GetTransactionErrorType,
|
|
23
|
+
selectData,
|
|
24
|
+
GetTransactionQueryKey<config, chainId>
|
|
25
|
+
>
|
|
20
26
|
|
|
21
27
|
export function getTransactionQueryOptions<
|
|
22
28
|
config extends Config,
|
|
23
29
|
chainId extends config['chains'][number]['id'],
|
|
24
|
-
|
|
30
|
+
selectData = GetTransactionData<config, chainId>,
|
|
31
|
+
>(
|
|
32
|
+
config: config,
|
|
33
|
+
options: GetTransactionOptions<config, chainId, selectData> = {},
|
|
34
|
+
): GetTransactionQueryOptions<config, chainId, selectData> {
|
|
25
35
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
...options.query,
|
|
37
|
+
enabled: Boolean(
|
|
38
|
+
(options.hash ||
|
|
39
|
+
(options.index &&
|
|
40
|
+
(options.blockHash || options.blockNumber || options.blockTag))) &&
|
|
41
|
+
(options.query?.enabled ?? true),
|
|
42
|
+
),
|
|
43
|
+
queryFn: async (context) => {
|
|
44
|
+
const [, { scopeKey: _, ...parameters }] = context.queryKey
|
|
45
|
+
if (
|
|
46
|
+
!(
|
|
47
|
+
parameters.hash ||
|
|
48
|
+
(parameters.index &&
|
|
49
|
+
(parameters.blockHash ||
|
|
50
|
+
parameters.blockNumber ||
|
|
51
|
+
parameters.blockTag))
|
|
52
|
+
)
|
|
53
|
+
)
|
|
31
54
|
throw new Error(
|
|
32
|
-
'
|
|
55
|
+
'hash OR index AND blockHash, blockNumber, blockTag is required',
|
|
33
56
|
)
|
|
34
|
-
const { scopeKey: _, ...rest } = queryKey[1]
|
|
35
57
|
return getTransaction(
|
|
36
58
|
config,
|
|
37
|
-
|
|
59
|
+
parameters as GetTransactionParameters,
|
|
38
60
|
) as unknown as Promise<GetTransactionQueryFnData<config, chainId>>
|
|
39
61
|
},
|
|
40
62
|
queryKey: getTransactionQueryKey(options),
|
|
41
|
-
}
|
|
42
|
-
GetTransactionQueryFnData<config, chainId>,
|
|
43
|
-
GetTransactionErrorType,
|
|
44
|
-
GetTransactionData<config, chainId>,
|
|
45
|
-
GetTransactionQueryKey<config, chainId>
|
|
46
|
-
>
|
|
63
|
+
}
|
|
47
64
|
}
|
|
48
65
|
|
|
49
66
|
export type GetTransactionQueryFnData<
|
|
@@ -59,7 +76,11 @@ export type GetTransactionData<
|
|
|
59
76
|
export function getTransactionQueryKey<
|
|
60
77
|
config extends Config,
|
|
61
78
|
chainId extends config['chains'][number]['id'],
|
|
62
|
-
>(
|
|
79
|
+
>(
|
|
80
|
+
options: Compute<
|
|
81
|
+
ExactPartial<GetTransactionParameters<config, chainId>> & ScopeKeyParameter
|
|
82
|
+
> = {},
|
|
83
|
+
) {
|
|
63
84
|
return ['transaction', filterQueryOptions(options)] as const
|
|
64
85
|
}
|
|
65
86
|
|
|
@@ -67,3 +88,14 @@ export type GetTransactionQueryKey<
|
|
|
67
88
|
config extends Config,
|
|
68
89
|
chainId extends config['chains'][number]['id'],
|
|
69
90
|
> = ReturnType<typeof getTransactionQueryKey<config, chainId>>
|
|
91
|
+
|
|
92
|
+
export type GetTransactionQueryOptions<
|
|
93
|
+
config extends Config,
|
|
94
|
+
chainId extends config['chains'][number]['id'],
|
|
95
|
+
selectData = GetTransactionData<config, chainId>,
|
|
96
|
+
> = QueryOptions<
|
|
97
|
+
GetTransactionQueryFnData<config, chainId>,
|
|
98
|
+
GetTransactionErrorType,
|
|
99
|
+
selectData,
|
|
100
|
+
GetTransactionQueryKey<config, chainId>
|
|
101
|
+
>
|