@wagmi/core 2.1.2 → 2.2.1

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.
Files changed (105) hide show
  1. package/dist/esm/actions/getAccount.js +1 -1
  2. package/dist/esm/actions/getAccount.js.map +1 -1
  3. package/dist/esm/actions/getBlock.js +2 -2
  4. package/dist/esm/actions/getBlock.js.map +1 -1
  5. package/dist/esm/actions/getBlockNumber.js +2 -2
  6. package/dist/esm/actions/getBlockNumber.js.map +1 -1
  7. package/dist/esm/actions/getBlockTransactionCount.js +2 -2
  8. package/dist/esm/actions/getBlockTransactionCount.js.map +1 -1
  9. package/dist/esm/actions/getBytecode.js +11 -0
  10. package/dist/esm/actions/getBytecode.js.map +1 -0
  11. package/dist/esm/actions/getEnsAddress.js +2 -2
  12. package/dist/esm/actions/getEnsAddress.js.map +1 -1
  13. package/dist/esm/actions/getEnsAvatar.js +2 -2
  14. package/dist/esm/actions/getEnsAvatar.js.map +1 -1
  15. package/dist/esm/actions/getEnsName.js +2 -2
  16. package/dist/esm/actions/getEnsName.js.map +1 -1
  17. package/dist/esm/actions/getEnsResolver.js +2 -2
  18. package/dist/esm/actions/getEnsResolver.js.map +1 -1
  19. package/dist/esm/actions/getFeeHistory.js +2 -2
  20. package/dist/esm/actions/getFeeHistory.js.map +1 -1
  21. package/dist/esm/actions/getProof.js +11 -0
  22. package/dist/esm/actions/getProof.js.map +1 -0
  23. package/dist/esm/actions/getStorageAt.js +11 -0
  24. package/dist/esm/actions/getStorageAt.js.map +1 -0
  25. package/dist/esm/actions/getTransaction.js +2 -2
  26. package/dist/esm/actions/getTransaction.js.map +1 -1
  27. package/dist/esm/actions/getTransactionReceipt.js +12 -0
  28. package/dist/esm/actions/getTransactionReceipt.js.map +1 -0
  29. package/dist/esm/actions/readContract.js +2 -2
  30. package/dist/esm/actions/readContract.js.map +1 -1
  31. package/dist/esm/exports/actions.js +4 -0
  32. package/dist/esm/exports/actions.js.map +1 -1
  33. package/dist/esm/exports/index.js +4 -0
  34. package/dist/esm/exports/index.js.map +1 -1
  35. package/dist/esm/exports/query.js +4 -0
  36. package/dist/esm/exports/query.js.map +1 -1
  37. package/dist/esm/query/getBytecode.js +22 -0
  38. package/dist/esm/query/getBytecode.js.map +1 -0
  39. package/dist/esm/query/getProof.js +21 -0
  40. package/dist/esm/query/getProof.js.map +1 -0
  41. package/dist/esm/query/getStorageAt.js +19 -0
  42. package/dist/esm/query/getStorageAt.js.map +1 -0
  43. package/dist/esm/query/getTransactionReceipt.js +22 -0
  44. package/dist/esm/query/getTransactionReceipt.js.map +1 -0
  45. package/dist/esm/query/verifyTypedData.js +1 -1
  46. package/dist/esm/query/verifyTypedData.js.map +1 -1
  47. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  48. package/dist/esm/version.js +1 -1
  49. package/dist/types/actions/getAccount.d.ts +6 -6
  50. package/dist/types/actions/getAccount.d.ts.map +1 -1
  51. package/dist/types/actions/getBytecode.d.ts +10 -0
  52. package/dist/types/actions/getBytecode.d.ts.map +1 -0
  53. package/dist/types/actions/getProof.d.ts +10 -0
  54. package/dist/types/actions/getProof.d.ts.map +1 -0
  55. package/dist/types/actions/getStorageAt.d.ts +10 -0
  56. package/dist/types/actions/getStorageAt.d.ts.map +1 -0
  57. package/dist/types/actions/getTransactionReceipt.d.ts +16 -0
  58. package/dist/types/actions/getTransactionReceipt.d.ts.map +1 -0
  59. package/dist/types/exports/actions.d.ts +4 -0
  60. package/dist/types/exports/actions.d.ts.map +1 -1
  61. package/dist/types/exports/index.d.ts +4 -0
  62. package/dist/types/exports/index.d.ts.map +1 -1
  63. package/dist/types/exports/query.d.ts +4 -0
  64. package/dist/types/exports/query.d.ts.map +1 -1
  65. package/dist/types/query/call.d.ts +2 -2
  66. package/dist/types/query/call.d.ts.map +1 -1
  67. package/dist/types/query/getBytecode.d.ts +18 -0
  68. package/dist/types/query/getBytecode.d.ts.map +1 -0
  69. package/dist/types/query/getProof.d.ts +18 -0
  70. package/dist/types/query/getProof.d.ts.map +1 -0
  71. package/dist/types/query/getStorageAt.d.ts +18 -0
  72. package/dist/types/query/getStorageAt.d.ts.map +1 -0
  73. package/dist/types/query/getTransactionReceipt.d.ts +35 -0
  74. package/dist/types/query/getTransactionReceipt.d.ts.map +1 -0
  75. package/dist/types/query/verifyMessage.d.ts +3 -3
  76. package/dist/types/query/verifyMessage.d.ts.map +1 -1
  77. package/dist/types/query/verifyTypedData.d.ts.map +1 -1
  78. package/dist/types/version.d.ts +1 -1
  79. package/package.json +1 -1
  80. package/src/actions/getAccount.ts +16 -8
  81. package/src/actions/getBlock.ts +2 -2
  82. package/src/actions/getBlockNumber.ts +2 -2
  83. package/src/actions/getBlockTransactionCount.ts +2 -2
  84. package/src/actions/getBytecode.ts +28 -0
  85. package/src/actions/getEnsAddress.ts +2 -2
  86. package/src/actions/getEnsAvatar.ts +2 -2
  87. package/src/actions/getEnsName.ts +2 -2
  88. package/src/actions/getEnsResolver.ts +2 -2
  89. package/src/actions/getFeeHistory.ts +2 -2
  90. package/src/actions/getProof.ts +28 -0
  91. package/src/actions/getStorageAt.ts +28 -0
  92. package/src/actions/getTransaction.ts +2 -2
  93. package/src/actions/getTransactionReceipt.ts +47 -0
  94. package/src/actions/readContract.ts +2 -2
  95. package/src/exports/actions.ts +28 -0
  96. package/src/exports/index.ts +28 -0
  97. package/src/exports/query.ts +36 -0
  98. package/src/query/call.ts +4 -2
  99. package/src/query/getBytecode.ts +49 -0
  100. package/src/query/getProof.ts +50 -0
  101. package/src/query/getStorageAt.ts +49 -0
  102. package/src/query/getTransactionReceipt.ts +60 -0
  103. package/src/query/verifyMessage.ts +4 -2
  104. package/src/query/verifyTypedData.ts +2 -1
  105. package/src/version.ts +1 -1
@@ -26,7 +26,7 @@ export function getBlockNumber<
26
26
  config: config,
27
27
  parameters: GetBlockNumberParameters<config, chainId> = {},
28
28
  ): Promise<GetBlockNumberReturnType> {
29
- const { chainId } = parameters
29
+ const { chainId, ...rest } = parameters
30
30
  const client = config.getClient({ chainId })
31
- return viem_getBlockNumber(client, parameters)
31
+ return viem_getBlockNumber(client, rest)
32
32
  }
@@ -30,7 +30,7 @@ export function getBlockTransactionCount<
30
30
  config: config,
31
31
  parameters: GetBlockTransactionCountParameters<config, chainId> = {},
32
32
  ): Promise<GetBlockTransactionCountReturnType> {
33
- const { chainId } = parameters
33
+ const { chainId, ...rest } = parameters
34
34
  const client = config.getClient({ chainId })
35
- return viem_getBlockTransactionCount(client, parameters)
35
+ return viem_getBlockTransactionCount(client, rest)
36
36
  }
@@ -0,0 +1,28 @@
1
+ import {
2
+ type GetBytecodeErrorType as viem_GetBytecodeErrorType,
3
+ type GetBytecodeParameters as viem_GetBytecodeParameters,
4
+ type GetBytecodeReturnType as viem_GetBytecodeReturnType,
5
+ getBytecode as viem_getBytecode,
6
+ } from 'viem/actions'
7
+
8
+ import { type Config } from '../createConfig.js'
9
+ import { type ChainIdParameter } from '../types/properties.js'
10
+ import { type Evaluate } from '../types/utils.js'
11
+
12
+ export type GetBytecodeParameters<config extends Config = Config> = Evaluate<
13
+ viem_GetBytecodeParameters & ChainIdParameter<config>
14
+ >
15
+
16
+ export type GetBytecodeReturnType = viem_GetBytecodeReturnType
17
+
18
+ export type GetBytecodeErrorType = viem_GetBytecodeErrorType
19
+
20
+ /** https://wagmi.sh/core/api/actions/getBytecode */
21
+ export async function getBytecode<config extends Config>(
22
+ config: config,
23
+ parameters: GetBytecodeParameters<config>,
24
+ ): Promise<GetBytecodeReturnType> {
25
+ const { chainId, ...rest } = parameters
26
+ const client = config.getClient({ chainId })
27
+ return viem_getBytecode(client, rest)
28
+ }
@@ -22,7 +22,7 @@ export function getEnsAddress<config extends Config>(
22
22
  config: config,
23
23
  parameters: GetEnsAddressParameters<config>,
24
24
  ): Promise<GetEnsAddressReturnType> {
25
- const { chainId } = parameters
25
+ const { chainId, ...rest } = parameters
26
26
  const client = config.getClient({ chainId })
27
- return viem_getEnsAddress(client, parameters)
27
+ return viem_getEnsAddress(client, rest)
28
28
  }
@@ -22,7 +22,7 @@ export function getEnsAvatar<config extends Config>(
22
22
  config: config,
23
23
  parameters: GetEnsAvatarParameters<config>,
24
24
  ): Promise<GetEnsAvatarReturnType> {
25
- const { chainId } = parameters
25
+ const { chainId, ...rest } = parameters
26
26
  const client = config.getClient({ chainId })
27
- return viem_getEnsAvatar(client, parameters)
27
+ return viem_getEnsAvatar(client, rest)
28
28
  }
@@ -22,7 +22,7 @@ export function getEnsName<config extends Config>(
22
22
  config: config,
23
23
  parameters: GetEnsNameParameters<config>,
24
24
  ): Promise<GetEnsNameReturnType> {
25
- const { chainId } = parameters
25
+ const { chainId, ...rest } = parameters
26
26
  const client = config.getClient({ chainId })
27
- return viem_getEnsName(client, parameters)
27
+ return viem_getEnsName(client, rest)
28
28
  }
@@ -22,7 +22,7 @@ export function getEnsResolver<config extends Config>(
22
22
  config: config,
23
23
  parameters: GetEnsResolverParameters<config>,
24
24
  ): Promise<GetEnsResolverReturnType> {
25
- const { chainId } = parameters
25
+ const { chainId, ...rest } = parameters
26
26
  const client = config.getClient({ chainId })
27
- return viem_getEnsResolver(client, parameters)
27
+ return viem_getEnsResolver(client, rest)
28
28
  }
@@ -26,7 +26,7 @@ export function getFeeHistory<
26
26
  config: config,
27
27
  parameters: GetFeeHistoryParameters<config, chainId>,
28
28
  ): Promise<GetFeeHistoryReturnType> {
29
- const { chainId } = parameters
29
+ const { chainId, ...rest } = parameters
30
30
  const client = config.getClient({ chainId })
31
- return viem_getFeeHistory(client, parameters)
31
+ return viem_getFeeHistory(client, rest)
32
32
  }
@@ -0,0 +1,28 @@
1
+ import {
2
+ type GetProofErrorType as viem_GetProofErrorType,
3
+ type GetProofParameters as viem_GetProofParameters,
4
+ type GetProofReturnType as viem_GetProofReturnType,
5
+ getProof as viem_getProof,
6
+ } from 'viem/actions'
7
+
8
+ import { type Config } from '../createConfig.js'
9
+ import { type ChainIdParameter } from '../types/properties.js'
10
+ import { type Evaluate } from '../types/utils.js'
11
+
12
+ export type GetProofParameters<config extends Config = Config> = Evaluate<
13
+ viem_GetProofParameters & ChainIdParameter<config>
14
+ >
15
+
16
+ export type GetProofReturnType = viem_GetProofReturnType
17
+
18
+ export type GetProofErrorType = viem_GetProofErrorType
19
+
20
+ /** https://wagmi.sh/core/api/actions/getProof */
21
+ export async function getProof<config extends Config>(
22
+ config: config,
23
+ parameters: GetProofParameters<config>,
24
+ ): Promise<GetProofReturnType> {
25
+ const { chainId, ...rest } = parameters
26
+ const client = config.getClient({ chainId })
27
+ return viem_getProof(client, rest)
28
+ }
@@ -0,0 +1,28 @@
1
+ import {
2
+ type GetStorageAtErrorType as viem_GetStorageAtErrorType,
3
+ type GetStorageAtParameters as viem_GetStorageAtParameters,
4
+ type GetStorageAtReturnType as viem_GetStorageAtReturnType,
5
+ getStorageAt as viem_getStorageAt,
6
+ } from 'viem/actions'
7
+
8
+ import { type Config } from '../createConfig.js'
9
+ import { type ChainIdParameter } from '../types/properties.js'
10
+ import { type Evaluate } from '../types/utils.js'
11
+
12
+ export type GetStorageAtParameters<config extends Config = Config> = Evaluate<
13
+ viem_GetStorageAtParameters & ChainIdParameter<config>
14
+ >
15
+
16
+ export type GetStorageAtReturnType = viem_GetStorageAtReturnType
17
+
18
+ export type GetStorageAtErrorType = viem_GetStorageAtErrorType
19
+
20
+ /** https://wagmi.sh/core/api/actions/getStorageAt */
21
+ export async function getStorageAt<config extends Config>(
22
+ config: config,
23
+ parameters: GetStorageAtParameters<config>,
24
+ ): Promise<GetStorageAtReturnType> {
25
+ const { chainId, ...rest } = parameters
26
+ const client = config.getClient({ chainId })
27
+ return viem_getStorageAt(client, rest)
28
+ }
@@ -39,9 +39,9 @@ export function getTransaction<
39
39
  config: config,
40
40
  parameters: GetTransactionParameters<config, chainId>,
41
41
  ): Promise<GetTransactionReturnType<config, chainId>> {
42
- const { chainId } = parameters
42
+ const { chainId, ...rest } = parameters
43
43
  const client = config.getClient({ chainId })
44
- return viem_getTransaction(client, parameters) as unknown as Promise<
44
+ return viem_getTransaction(client, rest) as unknown as Promise<
45
45
  GetTransactionReturnType<config, chainId>
46
46
  >
47
47
  }
@@ -0,0 +1,47 @@
1
+ import type { Chain } from 'viem'
2
+ import {
3
+ type GetTransactionReceiptErrorType as viem_GetTransactionReceiptErrorType,
4
+ type GetTransactionReceiptParameters as viem_GetTransactionReceiptParameters,
5
+ type GetTransactionReceiptReturnType as viem_GetTransactionReceiptReturnType,
6
+ getTransactionReceipt as viem_getTransactionReceipt,
7
+ } from 'viem/actions'
8
+
9
+ import { type Config } from '../createConfig.js'
10
+ import { type SelectChains } from '../types/chain.js'
11
+ import { type ChainIdParameter } from '../types/properties.js'
12
+ import { type Evaluate, type IsNarrowable } from '../types/utils.js'
13
+
14
+ export type GetTransactionReceiptParameters<
15
+ config extends Config = Config,
16
+ chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
17
+ > = Evaluate<
18
+ viem_GetTransactionReceiptParameters & ChainIdParameter<config, chainId>
19
+ >
20
+
21
+ export type GetTransactionReceiptReturnType<
22
+ config extends Config = Config,
23
+ chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
24
+ ///
25
+ chains extends readonly Chain[] = SelectChains<config, chainId>,
26
+ > = Evaluate<
27
+ {
28
+ [key in keyof chains]: viem_GetTransactionReceiptReturnType<
29
+ IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined
30
+ > & { chainId: chains[key]['id'] }
31
+ }[number]
32
+ >
33
+
34
+ export type GetTransactionReceiptErrorType = viem_GetTransactionReceiptErrorType
35
+
36
+ /** https://wagmi.sh/core/api/actions/getTransactionReceipt */
37
+ export async function getTransactionReceipt<
38
+ config extends Config,
39
+ chainId extends config['chains'][number]['id'],
40
+ >(
41
+ config: config,
42
+ parameters: GetTransactionReceiptParameters<config>,
43
+ ): Promise<GetTransactionReceiptReturnType<config, chainId>> {
44
+ const { chainId, ...rest } = parameters
45
+ const client = config.getClient({ chainId })
46
+ return viem_getTransactionReceipt(client, rest)
47
+ }
@@ -50,7 +50,7 @@ export function readContract<
50
50
  config: config,
51
51
  parameters: ReadContractParameters<abi, functionName, args, config>,
52
52
  ): Promise<ReadContractReturnType<abi, functionName, args>> {
53
- const { chainId } = parameters
53
+ const { chainId, ...rest } = parameters
54
54
  const client = config.getClient({ chainId })
55
- return viem_readContract(client, parameters as any)
55
+ return viem_readContract(client, rest as any)
56
56
  }
@@ -81,6 +81,13 @@ export {
81
81
  getBlockTransactionCount,
82
82
  } from '../actions/getBlockTransactionCount.js'
83
83
 
84
+ export {
85
+ type GetBytecodeErrorType,
86
+ type GetBytecodeParameters,
87
+ type GetBytecodeReturnType,
88
+ getBytecode,
89
+ } from '../actions/getBytecode.js'
90
+
84
91
  export {
85
92
  type GetChainIdReturnType,
86
93
  getChainId,
@@ -159,12 +166,26 @@ export {
159
166
  getGasPrice,
160
167
  } from '../actions/getGasPrice.js'
161
168
 
169
+ export {
170
+ type GetProofErrorType,
171
+ type GetProofParameters,
172
+ type GetProofReturnType,
173
+ getProof,
174
+ } from '../actions/getProof.js'
175
+
162
176
  export {
163
177
  type GetPublicClientParameters,
164
178
  type GetPublicClientReturnType,
165
179
  getPublicClient,
166
180
  } from '../actions/getPublicClient.js'
167
181
 
182
+ export {
183
+ type GetStorageAtErrorType,
184
+ type GetStorageAtParameters,
185
+ type GetStorageAtReturnType,
186
+ getStorageAt,
187
+ } from '../actions/getStorageAt.js'
188
+
168
189
  export {
169
190
  type GetTokenErrorType,
170
191
  type GetTokenParameters,
@@ -190,6 +211,13 @@ export {
190
211
  getTransactionCount,
191
212
  } from '../actions/getTransactionCount.js'
192
213
 
214
+ export {
215
+ type GetTransactionReceiptErrorType,
216
+ type GetTransactionReceiptParameters,
217
+ type GetTransactionReceiptReturnType,
218
+ getTransactionReceipt,
219
+ } from '../actions/getTransactionReceipt.js'
220
+
193
221
  export {
194
222
  type GetWalletClientErrorType,
195
223
  type GetWalletClientParameters,
@@ -81,6 +81,13 @@ export {
81
81
  getBlockTransactionCount,
82
82
  } from '../actions/getBlockTransactionCount.js'
83
83
 
84
+ export {
85
+ type GetBytecodeErrorType,
86
+ type GetBytecodeParameters,
87
+ type GetBytecodeReturnType,
88
+ getBytecode,
89
+ } from '../actions/getBytecode.js'
90
+
84
91
  export {
85
92
  type GetChainIdReturnType,
86
93
  getChainId,
@@ -159,12 +166,26 @@ export {
159
166
  getGasPrice,
160
167
  } from '../actions/getGasPrice.js'
161
168
 
169
+ export {
170
+ type GetProofErrorType,
171
+ type GetProofParameters,
172
+ type GetProofReturnType,
173
+ getProof,
174
+ } from '../actions/getProof.js'
175
+
162
176
  export {
163
177
  type GetPublicClientParameters,
164
178
  type GetPublicClientReturnType,
165
179
  getPublicClient,
166
180
  } from '../actions/getPublicClient.js'
167
181
 
182
+ export {
183
+ type GetStorageAtErrorType,
184
+ type GetStorageAtParameters,
185
+ type GetStorageAtReturnType,
186
+ getStorageAt,
187
+ } from '../actions/getStorageAt.js'
188
+
168
189
  export {
169
190
  type GetTokenErrorType,
170
191
  type GetTokenParameters,
@@ -190,6 +211,13 @@ export {
190
211
  getTransactionCount,
191
212
  } from '../actions/getTransactionCount.js'
192
213
 
214
+ export {
215
+ type GetTransactionReceiptErrorType,
216
+ type GetTransactionReceiptParameters,
217
+ type GetTransactionReceiptReturnType,
218
+ getTransactionReceipt,
219
+ } from '../actions/getTransactionReceipt.js'
220
+
193
221
  export {
194
222
  type GetWalletClientErrorType,
195
223
  type GetWalletClientParameters,
@@ -90,6 +90,15 @@ export {
90
90
  getBlockTransactionCountQueryOptions,
91
91
  } from '../query/getBlockTransactionCount.js'
92
92
 
93
+ export {
94
+ type GetBytecodeData,
95
+ type GetBytecodeOptions,
96
+ type GetBytecodeQueryFnData,
97
+ type GetBytecodeQueryKey,
98
+ getBytecodeQueryKey,
99
+ getBytecodeQueryOptions,
100
+ } from '../query/getBytecode.js'
101
+
93
102
  export {
94
103
  type GetConnectorClientData,
95
104
  type GetConnectorClientOptions,
@@ -153,6 +162,24 @@ export {
153
162
  getGasPriceQueryOptions,
154
163
  } from '../query/getGasPrice.js'
155
164
 
165
+ export {
166
+ type GetProofData,
167
+ type GetProofOptions,
168
+ type GetProofQueryFnData,
169
+ type GetProofQueryKey,
170
+ getProofQueryKey,
171
+ getProofQueryOptions,
172
+ } from '../query/getProof.js'
173
+
174
+ export {
175
+ type GetStorageAtData,
176
+ type GetStorageAtOptions,
177
+ type GetStorageAtQueryFnData,
178
+ type GetStorageAtQueryKey,
179
+ getStorageAtQueryKey,
180
+ getStorageAtQueryOptions,
181
+ } from '../query/getStorageAt.js'
182
+
156
183
  export {
157
184
  type GetTokenData,
158
185
  type GetTokenOptions,
@@ -180,6 +207,15 @@ export {
180
207
  getTransactionCountQueryOptions,
181
208
  } from '../query/getTransactionCount.js'
182
209
 
210
+ export {
211
+ type GetTransactionReceiptData,
212
+ type GetTransactionReceiptOptions,
213
+ type GetTransactionReceiptQueryFnData,
214
+ type GetTransactionReceiptQueryKey,
215
+ getTransactionReceiptQueryKey,
216
+ getTransactionReceiptQueryOptions,
217
+ } from '../query/getTransactionReceipt.js'
218
+
183
219
  export {
184
220
  type GetWalletClientData,
185
221
  type GetWalletClientOptions,
package/src/query/call.ts CHANGED
@@ -32,7 +32,7 @@ export function callQueryOptions<config extends Config>(
32
32
  CallQueryFnData,
33
33
  CallErrorType,
34
34
  CallData,
35
- CallQueryKey
35
+ CallQueryKey<config>
36
36
  >
37
37
  }
38
38
 
@@ -46,4 +46,6 @@ export function callQueryKey<config extends Config>(
46
46
  return ['call', filterQueryOptions(options)] as const
47
47
  }
48
48
 
49
- export type CallQueryKey = ReturnType<typeof callQueryKey>
49
+ export type CallQueryKey<config extends Config> = ReturnType<
50
+ typeof callQueryKey<config>
51
+ >
@@ -0,0 +1,49 @@
1
+ import { type QueryOptions } from '@tanstack/query-core'
2
+
3
+ import {
4
+ type GetBytecodeErrorType,
5
+ type GetBytecodeParameters,
6
+ type GetBytecodeReturnType,
7
+ getBytecode,
8
+ } from '../actions/getBytecode.js'
9
+ import { type Config } from '../createConfig.js'
10
+ import { type ScopeKeyParameter } from '../types/properties.js'
11
+ import { type Evaluate, type ExactPartial } from '../types/utils.js'
12
+ import { filterQueryOptions } from './utils.js'
13
+
14
+ export type GetBytecodeOptions<config extends Config> = Evaluate<
15
+ ExactPartial<GetBytecodeParameters<config>> & ScopeKeyParameter
16
+ >
17
+
18
+ export function getBytecodeQueryOptions<config extends Config>(
19
+ config: config,
20
+ options: GetBytecodeOptions<config> = {},
21
+ ) {
22
+ return {
23
+ async queryFn({ queryKey }) {
24
+ const { address, scopeKey: _, ...parameters } = queryKey[1]
25
+ if (!address) throw new Error('address is required')
26
+ const bytecode = await getBytecode(config, { ...parameters, address })
27
+ return (bytecode ?? null) as any
28
+ },
29
+ queryKey: getBytecodeQueryKey(options),
30
+ } as const satisfies QueryOptions<
31
+ GetBytecodeQueryFnData,
32
+ GetBytecodeErrorType,
33
+ GetBytecodeData,
34
+ GetBytecodeQueryKey<config>
35
+ >
36
+ }
37
+ export type GetBytecodeQueryFnData = GetBytecodeReturnType
38
+
39
+ export type GetBytecodeData = GetBytecodeQueryFnData
40
+
41
+ export function getBytecodeQueryKey<config extends Config>(
42
+ options: GetBytecodeOptions<config>,
43
+ ) {
44
+ return ['getBytecode', filterQueryOptions(options)] as const
45
+ }
46
+
47
+ export type GetBytecodeQueryKey<config extends Config> = ReturnType<
48
+ typeof getBytecodeQueryKey<config>
49
+ >
@@ -0,0 +1,50 @@
1
+ import { type QueryOptions } from '@tanstack/query-core'
2
+
3
+ import {
4
+ type GetProofErrorType,
5
+ type GetProofParameters,
6
+ type GetProofReturnType,
7
+ getProof,
8
+ } from '../actions/getProof.js'
9
+ import { type Config } from '../createConfig.js'
10
+ import { type ScopeKeyParameter } from '../types/properties.js'
11
+ import { type Evaluate, type ExactPartial } from '../types/utils.js'
12
+ import { filterQueryOptions } from './utils.js'
13
+
14
+ export type GetProofOptions<config extends Config> = Evaluate<
15
+ ExactPartial<GetProofParameters<config>> & ScopeKeyParameter
16
+ >
17
+
18
+ export function getProofQueryOptions<config extends Config>(
19
+ config: config,
20
+ options: GetProofOptions<config> = {},
21
+ ) {
22
+ return {
23
+ async queryFn({ queryKey }) {
24
+ const { address, scopeKey: _, storageKeys, ...parameters } = queryKey[1]
25
+ if (!address || !storageKeys)
26
+ throw new Error('address and storageKeys are required')
27
+ return getProof(config, { ...parameters, address, storageKeys })
28
+ },
29
+ queryKey: getProofQueryKey(options),
30
+ } as const satisfies QueryOptions<
31
+ GetProofQueryFnData,
32
+ GetProofErrorType,
33
+ GetProofData,
34
+ GetProofQueryKey<config>
35
+ >
36
+ }
37
+
38
+ export type GetProofQueryFnData = GetProofReturnType
39
+
40
+ export type GetProofData = GetProofQueryFnData
41
+
42
+ export function getProofQueryKey<config extends Config>(
43
+ options: GetProofOptions<config>,
44
+ ) {
45
+ return ['getProof', filterQueryOptions(options)] as const
46
+ }
47
+
48
+ export type GetProofQueryKey<config extends Config> = ReturnType<
49
+ typeof getProofQueryKey<config>
50
+ >
@@ -0,0 +1,49 @@
1
+ import { type QueryOptions } from '@tanstack/query-core'
2
+
3
+ import {
4
+ type GetStorageAtErrorType,
5
+ type GetStorageAtParameters,
6
+ type GetStorageAtReturnType,
7
+ getStorageAt,
8
+ } from '../actions/getStorageAt.js'
9
+ import { type Config } from '../createConfig.js'
10
+ import type { ScopeKeyParameter } from '../types/properties.js'
11
+ import type { Evaluate, ExactPartial } from '../types/utils.js'
12
+ import { filterQueryOptions } from './utils.js'
13
+
14
+ export type GetStorageAtOptions<config extends Config> = Evaluate<
15
+ ExactPartial<GetStorageAtParameters<config>> & ScopeKeyParameter
16
+ >
17
+
18
+ export function getStorageAtQueryOptions<config extends Config>(
19
+ config: config,
20
+ options: GetStorageAtOptions<config> = {},
21
+ ) {
22
+ return {
23
+ queryFn({ queryKey }) {
24
+ const { address, slot, scopeKey: _, ...parameters } = queryKey[1]
25
+ if (!address || !slot) throw new Error('address and slot are required')
26
+ return getStorageAt(config, { ...parameters, address, slot })
27
+ },
28
+ queryKey: getStorageAtQueryKey(options),
29
+ } as const satisfies QueryOptions<
30
+ GetStorageAtQueryFnData,
31
+ GetStorageAtErrorType,
32
+ GetStorageAtData,
33
+ GetStorageAtQueryKey<config>
34
+ >
35
+ }
36
+
37
+ export type GetStorageAtQueryFnData = GetStorageAtReturnType
38
+
39
+ export type GetStorageAtData = GetStorageAtQueryFnData
40
+
41
+ export function getStorageAtQueryKey<config extends Config>(
42
+ options: GetStorageAtOptions<config>,
43
+ ) {
44
+ return ['getStorageAt', filterQueryOptions(options)] as const
45
+ }
46
+
47
+ export type GetStorageAtQueryKey<config extends Config> = ReturnType<
48
+ typeof getStorageAtQueryKey<config>
49
+ >
@@ -0,0 +1,60 @@
1
+ import { type QueryOptions } from '@tanstack/query-core'
2
+
3
+ import {
4
+ type GetTransactionReceiptErrorType,
5
+ type GetTransactionReceiptParameters,
6
+ getTransactionReceipt,
7
+ } from '../actions/getTransactionReceipt.js'
8
+ import { type GetTransactionReceiptReturnType } from '../actions/getTransactionReceipt.js'
9
+ import { type Config } from '../createConfig.js'
10
+ import { type ScopeKeyParameter } from '../types/properties.js'
11
+ import { type Evaluate, type ExactPartial } from '../types/utils.js'
12
+ import { filterQueryOptions } from './utils.js'
13
+
14
+ export type GetTransactionReceiptOptions<
15
+ config extends Config,
16
+ chainId extends config['chains'][number]['id'],
17
+ > = Evaluate<
18
+ ExactPartial<GetTransactionReceiptParameters<config, chainId>> &
19
+ ScopeKeyParameter
20
+ >
21
+
22
+ export function getTransactionReceiptQueryOptions<
23
+ config extends Config,
24
+ chainId extends config['chains'][number]['id'],
25
+ >(config: config, options: GetTransactionReceiptOptions<config, chainId> = {}) {
26
+ return {
27
+ queryFn({ queryKey }) {
28
+ const { hash, scopeKey: _, ...parameters } = queryKey[1]
29
+ if (!hash) throw new Error('hash is required')
30
+ return getTransactionReceipt(config, { ...parameters, hash })
31
+ },
32
+ queryKey: getTransactionReceiptQueryKey(options),
33
+ } as const satisfies QueryOptions<
34
+ GetTransactionReceiptQueryFnData<config, chainId>,
35
+ GetTransactionReceiptErrorType,
36
+ GetTransactionReceiptData<config, chainId>,
37
+ GetTransactionReceiptQueryKey<config, chainId>
38
+ >
39
+ }
40
+ export type GetTransactionReceiptQueryFnData<
41
+ config extends Config,
42
+ chainId extends config['chains'][number]['id'],
43
+ > = GetTransactionReceiptReturnType<config, chainId>
44
+
45
+ export type GetTransactionReceiptData<
46
+ config extends Config,
47
+ chainId extends config['chains'][number]['id'],
48
+ > = GetTransactionReceiptQueryFnData<config, chainId>
49
+
50
+ export function getTransactionReceiptQueryKey<
51
+ config extends Config,
52
+ chainId extends config['chains'][number]['id'],
53
+ >(options: GetTransactionReceiptOptions<config, chainId>) {
54
+ return ['getTransactionReceipt', filterQueryOptions(options)] as const
55
+ }
56
+
57
+ export type GetTransactionReceiptQueryKey<
58
+ config extends Config,
59
+ chainId extends config['chains'][number]['id'],
60
+ > = ReturnType<typeof getTransactionReceiptQueryKey<config, chainId>>
@@ -38,7 +38,7 @@ export function verifyMessageQueryOptions<config extends Config>(
38
38
  VerifyMessageQueryFnData,
39
39
  VerifyMessageErrorType,
40
40
  VerifyMessageData,
41
- VerifyMessageQueryKey
41
+ VerifyMessageQueryKey<config>
42
42
  >
43
43
  }
44
44
  export type VerifyMessageQueryFnData = VerifyMessageReturnType
@@ -51,4 +51,6 @@ export function verifyMessageQueryKey<config extends Config>(
51
51
  return ['verifyMessage', filterQueryOptions(options)] as const
52
52
  }
53
53
 
54
- export type VerifyMessageQueryKey = ReturnType<typeof verifyMessageQueryKey>
54
+ export type VerifyMessageQueryKey<config extends Config> = ReturnType<
55
+ typeof verifyMessageQueryKey<config>
56
+ >
@@ -45,12 +45,12 @@ export function verifyTypedDataQueryOptions<
45
45
  if (!types) throw new Error('types is required')
46
46
 
47
47
  const verified = await verifyTypedData(config, {
48
+ ...parameters,
48
49
  address,
49
50
  message,
50
51
  primaryType,
51
52
  signature,
52
53
  types,
53
- ...parameters,
54
54
  })
55
55
  return verified ?? null
56
56
  },
@@ -62,6 +62,7 @@ export function verifyTypedDataQueryOptions<
62
62
  VerifyTypedDataQueryKey<typedData, primaryType, config>
63
63
  >
64
64
  }
65
+
65
66
  export type VerifyTypedDataQueryFnData = VerifyTypedDataReturnType
66
67
 
67
68
  export type VerifyTypedDataData = VerifyTypedDataQueryFnData
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.1.2'
1
+ export const version = '2.2.1'