@wagmi/core 2.0.0-beta.1 → 2.0.0-beta.10
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/codegen/createReadContract.js +31 -0
- package/dist/esm/actions/codegen/createReadContract.js.map +1 -0
- package/dist/esm/actions/codegen/createSimulateContract.js +33 -0
- package/dist/esm/actions/codegen/createSimulateContract.js.map +1 -0
- package/dist/esm/actions/codegen/createWatchContractEvent.js +31 -0
- package/dist/esm/actions/codegen/createWatchContractEvent.js.map +1 -0
- package/dist/esm/actions/codegen/createWriteContract.js +43 -0
- package/dist/esm/actions/codegen/createWriteContract.js.map +1 -0
- package/dist/esm/actions/disconnect.js +7 -11
- package/dist/esm/actions/disconnect.js.map +1 -1
- package/dist/esm/actions/estimateMaxPriorityFeePerGas.js +12 -0
- package/dist/esm/actions/estimateMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/actions/getBlock.js.map +1 -1
- package/dist/esm/actions/getBlockTransactionCount.js +11 -0
- package/dist/esm/actions/getBlockTransactionCount.js.map +1 -0
- package/dist/esm/actions/getFeeHistory.js +11 -0
- package/dist/esm/actions/getFeeHistory.js.map +1 -0
- package/dist/esm/actions/getGasPrice.js +11 -0
- package/dist/esm/actions/getGasPrice.js.map +1 -0
- package/dist/esm/actions/getTransaction.js.map +1 -1
- package/dist/esm/actions/getTransactionCount.js +11 -0
- package/dist/esm/actions/getTransactionCount.js.map +1 -0
- package/dist/esm/actions/simulateContract.js +3 -0
- package/dist/esm/actions/simulateContract.js.map +1 -1
- package/dist/esm/actions/verifyMessage.js +11 -0
- package/dist/esm/actions/verifyMessage.js.map +1 -0
- package/dist/esm/actions/verifyTypedData.js +12 -0
- package/dist/esm/actions/verifyTypedData.js.map +1 -0
- package/dist/esm/actions/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/watchContractEvent.js +3 -0
- package/dist/esm/actions/watchContractEvent.js.map +1 -1
- package/dist/esm/actions/writeContract.js +3 -0
- package/dist/esm/actions/writeContract.js.map +1 -1
- package/dist/esm/connectors/createConnector.js.map +1 -1
- package/dist/esm/connectors/injected.js +10 -4
- package/dist/esm/connectors/injected.js.map +1 -1
- package/dist/esm/connectors/mock.js +2 -0
- package/dist/esm/connectors/mock.js.map +1 -1
- package/dist/esm/createConfig.js +13 -2
- package/dist/esm/createConfig.js.map +1 -1
- package/dist/esm/exports/actions.js +8 -0
- package/dist/esm/exports/actions.js.map +1 -1
- package/dist/esm/exports/chains.js +1 -0
- package/dist/esm/exports/chains.js.map +1 -1
- package/dist/esm/exports/codegen.js +5 -0
- package/dist/esm/exports/codegen.js.map +1 -0
- package/dist/esm/exports/index.js +26 -6
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.js +5 -4
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/exports/query.js +8 -1
- package/dist/esm/exports/query.js.map +1 -1
- package/dist/esm/query/estimateMaxPriorityFeePerGas.js +19 -0
- package/dist/esm/query/estimateMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/query/getBlock.js +1 -1
- package/dist/esm/query/getBlock.js.map +1 -1
- package/dist/esm/query/getBlockTransactionCount.js +20 -0
- package/dist/esm/query/getBlockTransactionCount.js.map +1 -0
- package/dist/esm/query/getFeeHistory.js +27 -0
- package/dist/esm/query/getFeeHistory.js.map +1 -0
- package/dist/esm/query/getGasPrice.js +20 -0
- package/dist/esm/query/getGasPrice.js.map +1 -0
- package/dist/esm/query/getTransactionCount.js +23 -0
- package/dist/esm/query/getTransactionCount.js.map +1 -0
- package/dist/esm/query/infiniteReadContracts.js +2 -0
- package/dist/esm/query/infiniteReadContracts.js.map +1 -1
- package/dist/esm/query/readContract.js +4 -0
- package/dist/esm/query/readContract.js.map +1 -1
- package/dist/esm/query/verifyMessage.js +21 -0
- package/dist/esm/query/verifyMessage.js.map +1 -0
- package/dist/esm/query/verifyTypedData.js +38 -0
- package/dist/esm/query/verifyTypedData.js.map +1 -0
- package/dist/esm/query/waitForTransactionReceipt.js +1 -1
- package/dist/esm/query/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/transports/connector.js +37 -0
- package/dist/esm/transports/connector.js.map +1 -0
- package/dist/esm/transports/fallback.js +6 -0
- package/dist/esm/transports/fallback.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/actions/codegen/createReadContract.d.ts +16 -0
- package/dist/types/actions/codegen/createReadContract.d.ts.map +1 -0
- package/dist/types/actions/codegen/createSimulateContract.d.ts +20 -0
- package/dist/types/actions/codegen/createSimulateContract.d.ts.map +1 -0
- package/dist/types/actions/codegen/createWatchContractEvent.d.ts +14 -0
- package/dist/types/actions/codegen/createWatchContractEvent.d.ts.map +1 -0
- package/dist/types/actions/codegen/createWriteContract.d.ts +22 -0
- package/dist/types/actions/codegen/createWriteContract.d.ts.map +1 -0
- package/dist/types/actions/disconnect.d.ts +2 -2
- package/dist/types/actions/disconnect.d.ts.map +1 -1
- package/dist/types/actions/estimateGas.d.ts +2 -2
- package/dist/types/actions/estimateGas.d.ts.map +1 -1
- package/dist/types/actions/estimateMaxPriorityFeePerGas.d.ts +11 -0
- package/dist/types/actions/estimateMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/types/actions/getBlock.d.ts +2 -2
- package/dist/types/actions/getBlock.d.ts.map +1 -1
- package/dist/types/actions/getBlockTransactionCount.d.ts +10 -0
- package/dist/types/actions/getBlockTransactionCount.d.ts.map +1 -0
- package/dist/types/actions/getFeeHistory.d.ts +10 -0
- package/dist/types/actions/getFeeHistory.d.ts.map +1 -0
- package/dist/types/actions/getGasPrice.d.ts +10 -0
- package/dist/types/actions/getGasPrice.d.ts.map +1 -0
- package/dist/types/actions/getTransaction.d.ts +2 -2
- package/dist/types/actions/getTransaction.d.ts.map +1 -1
- package/dist/types/actions/getTransactionCount.d.ts +10 -0
- package/dist/types/actions/getTransactionCount.d.ts.map +1 -0
- package/dist/types/actions/simulateContract.d.ts +3 -3
- package/dist/types/actions/simulateContract.d.ts.map +1 -1
- package/dist/types/actions/verifyMessage.d.ts +10 -0
- package/dist/types/actions/verifyMessage.d.ts.map +1 -0
- package/dist/types/actions/verifyTypedData.d.ts +11 -0
- package/dist/types/actions/verifyTypedData.d.ts.map +1 -0
- package/dist/types/actions/waitForTransactionReceipt.d.ts +2 -2
- package/dist/types/actions/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/actions/watchBlocks.d.ts +2 -2
- package/dist/types/actions/watchBlocks.d.ts.map +1 -1
- package/dist/types/actions/watchContractEvent.d.ts +3 -3
- package/dist/types/actions/watchContractEvent.d.ts.map +1 -1
- package/dist/types/actions/writeContract.d.ts +3 -3
- package/dist/types/actions/writeContract.d.ts.map +1 -1
- package/dist/types/connectors/createConnector.d.ts +1 -0
- package/dist/types/connectors/createConnector.d.ts.map +1 -1
- package/dist/types/connectors/injected.d.ts +7 -0
- package/dist/types/connectors/injected.d.ts.map +1 -1
- package/dist/types/connectors/mock.d.ts +3 -0
- package/dist/types/connectors/mock.d.ts.map +1 -1
- package/dist/types/createConfig.d.ts +4 -1
- package/dist/types/createConfig.d.ts.map +1 -1
- package/dist/types/exports/actions.d.ts +7 -0
- package/dist/types/exports/actions.d.ts.map +1 -1
- package/dist/types/exports/chains.d.ts.map +1 -1
- package/dist/types/exports/codegen.d.ts +5 -0
- package/dist/types/exports/codegen.d.ts.map +1 -0
- package/dist/types/exports/index.d.ts +12 -1
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +2 -2
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/exports/query.d.ts +7 -1
- package/dist/types/exports/query.d.ts.map +1 -1
- package/dist/types/query/estimateFeesPerGas.d.ts +1 -1
- package/dist/types/query/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/query/estimateGas.d.ts +1 -1
- package/dist/types/query/estimateGas.d.ts.map +1 -1
- package/dist/types/query/estimateMaxPriorityFeePerGas.d.ts +27 -0
- package/dist/types/query/estimateMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/types/query/getBalance.d.ts +1 -1
- package/dist/types/query/getBalance.d.ts.map +1 -1
- package/dist/types/query/getBlock.d.ts +2 -2
- package/dist/types/query/getBlock.d.ts.map +1 -1
- package/dist/types/query/getBlockNumber.d.ts +1 -4
- package/dist/types/query/getBlockNumber.d.ts.map +1 -1
- package/dist/types/query/getBlockTransactionCount.d.ts +18 -0
- package/dist/types/query/getBlockTransactionCount.d.ts.map +1 -0
- package/dist/types/query/getConnectorClient.d.ts +5 -1
- package/dist/types/query/getConnectorClient.d.ts.map +1 -1
- package/dist/types/query/getEnsAddress.d.ts +1 -1
- package/dist/types/query/getEnsAddress.d.ts.map +1 -1
- package/dist/types/query/getEnsAvatar.d.ts +1 -1
- package/dist/types/query/getEnsAvatar.d.ts.map +1 -1
- package/dist/types/query/getEnsName.d.ts +1 -1
- package/dist/types/query/getEnsName.d.ts.map +1 -1
- package/dist/types/query/getEnsResolver.d.ts +1 -1
- package/dist/types/query/getEnsResolver.d.ts.map +1 -1
- package/dist/types/query/getFeeHistory.d.ts +39 -0
- package/dist/types/query/getFeeHistory.d.ts.map +1 -0
- package/dist/types/query/getGasPrice.d.ts +27 -0
- package/dist/types/query/getGasPrice.d.ts.map +1 -0
- package/dist/types/query/getToken.d.ts +1 -1
- package/dist/types/query/getToken.d.ts.map +1 -1
- package/dist/types/query/getTransaction.d.ts +2 -2
- package/dist/types/query/getTransaction.d.ts.map +1 -1
- package/dist/types/query/getTransactionCount.d.ts +36 -0
- package/dist/types/query/getTransactionCount.d.ts.map +1 -0
- package/dist/types/query/getWalletClient.d.ts +13 -13
- package/dist/types/query/getWalletClient.d.ts.map +1 -1
- package/dist/types/query/infiniteReadContracts.d.ts +2 -3
- package/dist/types/query/infiniteReadContracts.d.ts.map +1 -1
- package/dist/types/query/readContract.d.ts +2 -2
- package/dist/types/query/readContract.d.ts.map +1 -1
- package/dist/types/query/readContracts.d.ts +1 -1
- package/dist/types/query/readContracts.d.ts.map +1 -1
- package/dist/types/query/signTypedData.d.ts +8 -8
- package/dist/types/query/simulateContract.d.ts +1 -1
- package/dist/types/query/simulateContract.d.ts.map +1 -1
- package/dist/types/query/types.d.ts +0 -3
- package/dist/types/query/types.d.ts.map +1 -1
- package/dist/types/query/verifyMessage.d.ts +42 -0
- package/dist/types/query/verifyMessage.d.ts.map +1 -0
- package/dist/types/query/verifyTypedData.d.ts +19 -0
- package/dist/types/query/verifyTypedData.d.ts.map +1 -0
- package/dist/types/query/waitForTransactionReceipt.d.ts +2 -2
- package/dist/types/query/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/transports/connector.d.ts +15 -0
- package/dist/types/transports/connector.d.ts.map +1 -0
- package/dist/types/transports/fallback.d.ts +4 -0
- package/dist/types/transports/fallback.d.ts.map +1 -0
- package/dist/types/types/properties.d.ts +3 -0
- package/dist/types/types/properties.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +17 -20
- package/src/actions/codegen/createReadContract.ts +100 -0
- package/src/actions/codegen/createSimulateContract.ts +122 -0
- package/src/actions/codegen/createWatchContractEvent.ts +87 -0
- package/src/actions/codegen/createWriteContract.ts +142 -0
- package/src/actions/disconnect.ts +11 -17
- package/src/actions/estimateGas.ts +1 -1
- package/src/actions/estimateMaxPriorityFeePerGas.ts +41 -0
- package/src/actions/getBlock.ts +2 -2
- package/src/actions/getBlockTransactionCount.ts +36 -0
- package/src/actions/getFeeHistory.ts +32 -0
- package/src/actions/getGasPrice.ts +31 -0
- package/src/actions/getTransaction.ts +4 -2
- package/src/actions/getTransactionCount.ts +31 -0
- package/src/actions/simulateContract.ts +5 -5
- package/src/actions/verifyMessage.ts +28 -0
- package/src/actions/verifyTypedData.ts +41 -0
- package/src/actions/waitForTransactionReceipt.ts +4 -2
- package/src/actions/watchBlocks.ts +2 -2
- package/src/actions/watchContractEvent.ts +6 -5
- package/src/actions/writeContract.ts +6 -7
- package/src/connectors/createConnector.ts +1 -0
- package/src/connectors/injected.ts +13 -3
- package/src/connectors/mock.ts +2 -0
- package/src/createConfig.ts +23 -4
- package/src/exports/actions.ts +48 -0
- package/src/exports/chains.ts +1 -0
- package/src/exports/codegen.ts +7 -0
- package/src/exports/index.ts +80 -13
- package/src/exports/internal.ts +11 -13
- package/src/exports/query.ts +64 -1
- package/src/query/estimateFeesPerGas.ts +1 -1
- package/src/query/estimateGas.ts +1 -1
- package/src/query/estimateMaxPriorityFeePerGas.ts +51 -0
- package/src/query/getBalance.ts +1 -1
- package/src/query/getBlock.ts +2 -2
- package/src/query/getBlockNumber.ts +1 -1
- package/src/query/getBlockTransactionCount.ts +62 -0
- package/src/query/getConnectorClient.ts +1 -1
- package/src/query/getEnsAddress.ts +1 -1
- package/src/query/getEnsAvatar.ts +1 -1
- package/src/query/getEnsName.ts +1 -1
- package/src/query/getEnsResolver.ts +1 -1
- package/src/query/getFeeHistory.ts +69 -0
- package/src/query/getGasPrice.ts +54 -0
- package/src/query/getToken.ts +1 -1
- package/src/query/getTransaction.ts +1 -1
- package/src/query/getTransactionCount.ts +55 -0
- package/src/query/getWalletClient.ts +1 -1
- package/src/query/infiniteReadContracts.ts +6 -3
- package/src/query/readContract.ts +4 -2
- package/src/query/readContracts.ts +1 -1
- package/src/query/simulateContract.ts +1 -1
- package/src/query/types.ts +0 -2
- package/src/query/verifyMessage.ts +54 -0
- package/src/query/verifyTypedData.ts +81 -0
- package/src/query/waitForTransactionReceipt.ts +1 -1
- package/src/transports/connector.ts +87 -0
- package/src/transports/fallback.ts +10 -0
- package/src/types/properties.ts +2 -0
- package/src/version.ts +1 -1
package/src/exports/index.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Viem
|
|
3
|
-
|
|
4
|
-
// extremely commonly used viem exports
|
|
5
|
-
export {
|
|
6
|
-
custom,
|
|
7
|
-
fallback,
|
|
8
|
-
http,
|
|
9
|
-
webSocket,
|
|
10
|
-
} from 'viem'
|
|
11
|
-
|
|
12
1
|
////////////////////////////////////////////////////////////////////////////////
|
|
13
2
|
// Actions
|
|
3
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
14
4
|
|
|
15
5
|
export {
|
|
16
6
|
type ConnectErrorType,
|
|
@@ -40,6 +30,13 @@ export {
|
|
|
40
30
|
estimateFeesPerGas,
|
|
41
31
|
} from '../actions/estimateFeesPerGas.js'
|
|
42
32
|
|
|
33
|
+
export {
|
|
34
|
+
type EstimateMaxPriorityFeePerGasErrorType,
|
|
35
|
+
type EstimateMaxPriorityFeePerGasParameters,
|
|
36
|
+
type EstimateMaxPriorityFeePerGasReturnType,
|
|
37
|
+
estimateMaxPriorityFeePerGas,
|
|
38
|
+
} from '../actions/estimateMaxPriorityFeePerGas.js'
|
|
39
|
+
|
|
43
40
|
export {
|
|
44
41
|
type GetAccountReturnType,
|
|
45
42
|
getAccount,
|
|
@@ -70,6 +67,13 @@ export {
|
|
|
70
67
|
getBlockNumber as fetchBlockNumber,
|
|
71
68
|
} from '../actions/getBlockNumber.js'
|
|
72
69
|
|
|
70
|
+
export {
|
|
71
|
+
type GetBlockTransactionCountErrorType,
|
|
72
|
+
type GetBlockTransactionCountParameters,
|
|
73
|
+
type GetBlockTransactionCountReturnType,
|
|
74
|
+
getBlockTransactionCount,
|
|
75
|
+
} from '../actions/getBlockTransactionCount.js'
|
|
76
|
+
|
|
73
77
|
export {
|
|
74
78
|
type GetChainIdReturnType,
|
|
75
79
|
getChainId,
|
|
@@ -134,6 +138,20 @@ export {
|
|
|
134
138
|
getEnsResolver as fetchEnsResolver,
|
|
135
139
|
} from '../actions/getEnsResolver.js'
|
|
136
140
|
|
|
141
|
+
export {
|
|
142
|
+
type GetFeeHistoryErrorType,
|
|
143
|
+
type GetFeeHistoryParameters,
|
|
144
|
+
type GetFeeHistoryReturnType,
|
|
145
|
+
getFeeHistory,
|
|
146
|
+
} from '../actions/getFeeHistory.js'
|
|
147
|
+
|
|
148
|
+
export {
|
|
149
|
+
type GetGasPriceErrorType,
|
|
150
|
+
type GetGasPriceParameters,
|
|
151
|
+
type GetGasPriceReturnType,
|
|
152
|
+
getGasPrice,
|
|
153
|
+
} from '../actions/getGasPrice.js'
|
|
154
|
+
|
|
137
155
|
export {
|
|
138
156
|
type GetPublicClientParameters,
|
|
139
157
|
type GetPublicClientReturnType,
|
|
@@ -158,6 +176,13 @@ export {
|
|
|
158
176
|
getTransaction as fetchTransaction,
|
|
159
177
|
} from '../actions/getTransaction.js'
|
|
160
178
|
|
|
179
|
+
export {
|
|
180
|
+
type GetTransactionCountErrorType,
|
|
181
|
+
type GetTransactionCountParameters,
|
|
182
|
+
type GetTransactionCountReturnType,
|
|
183
|
+
getTransactionCount,
|
|
184
|
+
} from '../actions/getTransactionCount.js'
|
|
185
|
+
|
|
161
186
|
export {
|
|
162
187
|
type GetWalletClientErrorType,
|
|
163
188
|
type GetWalletClientParameters,
|
|
@@ -236,6 +261,20 @@ export {
|
|
|
236
261
|
switchChain as switchNetwork,
|
|
237
262
|
} from '../actions/switchChain.js'
|
|
238
263
|
|
|
264
|
+
export {
|
|
265
|
+
type VerifyMessageErrorType,
|
|
266
|
+
type VerifyMessageParameters,
|
|
267
|
+
type VerifyMessageReturnType,
|
|
268
|
+
verifyMessage,
|
|
269
|
+
} from '../actions/verifyMessage.js'
|
|
270
|
+
|
|
271
|
+
export {
|
|
272
|
+
type VerifyTypedDataErrorType,
|
|
273
|
+
type VerifyTypedDataParameters,
|
|
274
|
+
type VerifyTypedDataReturnType,
|
|
275
|
+
verifyTypedData,
|
|
276
|
+
} from '../actions/verifyTypedData.js'
|
|
277
|
+
|
|
239
278
|
export {
|
|
240
279
|
type WatchAccountParameters,
|
|
241
280
|
type WatchAccountReturnType,
|
|
@@ -313,7 +352,8 @@ export {
|
|
|
313
352
|
} from '../actions/writeContract.js'
|
|
314
353
|
|
|
315
354
|
////////////////////////////////////////////////////////////////////////////////
|
|
316
|
-
//
|
|
355
|
+
// Connectors
|
|
356
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
317
357
|
|
|
318
358
|
export {
|
|
319
359
|
type ConnectorEventMap,
|
|
@@ -321,8 +361,19 @@ export {
|
|
|
321
361
|
createConnector,
|
|
322
362
|
} from '../connectors/createConnector.js'
|
|
323
363
|
|
|
364
|
+
export {
|
|
365
|
+
type InjectedParameters,
|
|
366
|
+
injected,
|
|
367
|
+
} from '../connectors/injected.js'
|
|
368
|
+
|
|
369
|
+
export {
|
|
370
|
+
type MockParameters,
|
|
371
|
+
mock,
|
|
372
|
+
} from '../connectors/mock.js'
|
|
373
|
+
|
|
324
374
|
////////////////////////////////////////////////////////////////////////////////
|
|
325
375
|
// createConfig
|
|
376
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
326
377
|
|
|
327
378
|
export {
|
|
328
379
|
type Connection,
|
|
@@ -335,6 +386,7 @@ export {
|
|
|
335
386
|
|
|
336
387
|
////////////////////////////////////////////////////////////////////////////////
|
|
337
388
|
// createStorage
|
|
389
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
338
390
|
|
|
339
391
|
export {
|
|
340
392
|
type CreateStorageParameters,
|
|
@@ -345,12 +397,14 @@ export {
|
|
|
345
397
|
} from '../createStorage.js'
|
|
346
398
|
|
|
347
399
|
////////////////////////////////////////////////////////////////////////////////
|
|
348
|
-
//
|
|
400
|
+
// Hydrate
|
|
401
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
349
402
|
|
|
350
403
|
export { hydrate } from '../hydrate.js'
|
|
351
404
|
|
|
352
405
|
////////////////////////////////////////////////////////////////////////////////
|
|
353
406
|
// Errors
|
|
407
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
354
408
|
|
|
355
409
|
export { BaseError } from '../errors/base.js'
|
|
356
410
|
|
|
@@ -374,13 +428,25 @@ export {
|
|
|
374
428
|
SwitchChainNotSupportedError,
|
|
375
429
|
} from '../errors/connector.js'
|
|
376
430
|
|
|
431
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
432
|
+
// Transports
|
|
433
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
434
|
+
|
|
435
|
+
export { custom, http, webSocket } from 'viem'
|
|
436
|
+
|
|
437
|
+
export { unstable_connector } from '../transports/connector.js'
|
|
438
|
+
|
|
439
|
+
export { fallback } from '../transports/fallback.js'
|
|
440
|
+
|
|
377
441
|
////////////////////////////////////////////////////////////////////////////////
|
|
378
442
|
// Types
|
|
443
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
379
444
|
|
|
380
445
|
export { type Register, type ResolvedRegister } from '../types/register.js'
|
|
381
446
|
|
|
382
447
|
////////////////////////////////////////////////////////////////////////////////
|
|
383
448
|
// Utilities
|
|
449
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
384
450
|
|
|
385
451
|
export {
|
|
386
452
|
cookieStorage,
|
|
@@ -398,5 +464,6 @@ export { serialize } from '../utils/serialize.js'
|
|
|
398
464
|
|
|
399
465
|
////////////////////////////////////////////////////////////////////////////////
|
|
400
466
|
// Version
|
|
467
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
401
468
|
|
|
402
469
|
export { version } from '../version.js'
|
package/src/exports/internal.ts
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Connectors
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
type InjectedParameters,
|
|
6
|
-
injected,
|
|
7
|
-
} from '../connectors/injected.js'
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
type MockParameters,
|
|
11
|
-
mock,
|
|
12
|
-
} from '../connectors/mock.js'
|
|
13
|
-
|
|
14
1
|
////////////////////////////////////////////////////////////////////////////////
|
|
15
2
|
// Emitter
|
|
3
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
16
4
|
|
|
17
5
|
export {
|
|
18
6
|
type EventData,
|
|
@@ -22,6 +10,15 @@ export {
|
|
|
22
10
|
|
|
23
11
|
////////////////////////////////////////////////////////////////////////////////
|
|
24
12
|
// Types
|
|
13
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
14
|
+
|
|
15
|
+
export { type SelectChains } from '../types/chain.js'
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
type ChainIdParameter,
|
|
19
|
+
type ConnectorParameter,
|
|
20
|
+
type ScopeKeyParameter,
|
|
21
|
+
} from '../types/properties.js'
|
|
25
22
|
|
|
26
23
|
export {
|
|
27
24
|
type Evaluate,
|
|
@@ -36,6 +33,7 @@ export {
|
|
|
36
33
|
|
|
37
34
|
////////////////////////////////////////////////////////////////////////////////
|
|
38
35
|
// Utilities
|
|
36
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
39
37
|
|
|
40
38
|
export { deepEqual } from '../utils/deepEqual.js'
|
|
41
39
|
|
package/src/exports/query.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
////////////////////////////////////////////////////////////////////////////////
|
|
2
2
|
// Tanstack Query
|
|
3
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
3
4
|
|
|
4
5
|
export {
|
|
5
6
|
type ConnectData,
|
|
@@ -35,6 +36,15 @@ export {
|
|
|
35
36
|
estimateGasQueryOptions,
|
|
36
37
|
} from '../query/estimateGas.js'
|
|
37
38
|
|
|
39
|
+
export {
|
|
40
|
+
type EstimateMaxPriorityFeePerGasData,
|
|
41
|
+
type EstimateMaxPriorityFeePerGasOptions,
|
|
42
|
+
type EstimateMaxPriorityFeePerGasQueryFnData,
|
|
43
|
+
type EstimateMaxPriorityFeePerGasQueryKey,
|
|
44
|
+
estimateMaxPriorityFeePerGasQueryKey,
|
|
45
|
+
estimateMaxPriorityFeePerGasQueryOptions,
|
|
46
|
+
} from '../query/estimateMaxPriorityFeePerGas.js'
|
|
47
|
+
|
|
38
48
|
export {
|
|
39
49
|
type GetBalanceData,
|
|
40
50
|
type GetBalanceOptions,
|
|
@@ -62,6 +72,15 @@ export {
|
|
|
62
72
|
getBlockNumberQueryOptions,
|
|
63
73
|
} from '../query/getBlockNumber.js'
|
|
64
74
|
|
|
75
|
+
export {
|
|
76
|
+
type GetBlockTransactionCountData,
|
|
77
|
+
type GetBlockTransactionCountOptions,
|
|
78
|
+
type GetBlockTransactionCountQueryFnData,
|
|
79
|
+
type GetBlockTransactionCountQueryKey,
|
|
80
|
+
getBlockTransactionCountQueryKey,
|
|
81
|
+
getBlockTransactionCountQueryOptions,
|
|
82
|
+
} from '../query/getBlockTransactionCount.js'
|
|
83
|
+
|
|
65
84
|
export {
|
|
66
85
|
type GetConnectorClientData,
|
|
67
86
|
type GetConnectorClientOptions,
|
|
@@ -107,6 +126,24 @@ export {
|
|
|
107
126
|
getEnsResolverQueryOptions,
|
|
108
127
|
} from '../query/getEnsResolver.js'
|
|
109
128
|
|
|
129
|
+
export {
|
|
130
|
+
type GetFeeHistoryData,
|
|
131
|
+
type GetFeeHistoryOptions,
|
|
132
|
+
type GetFeeHistoryQueryFnData,
|
|
133
|
+
type GetFeeHistoryQueryKey,
|
|
134
|
+
getFeeHistoryQueryKey,
|
|
135
|
+
getFeeHistoryQueryOptions,
|
|
136
|
+
} from '../query/getFeeHistory.js'
|
|
137
|
+
|
|
138
|
+
export {
|
|
139
|
+
type GetGasPriceData,
|
|
140
|
+
type GetGasPriceOptions,
|
|
141
|
+
type GetGasPriceQueryFnData,
|
|
142
|
+
type GetGasPriceQueryKey,
|
|
143
|
+
getGasPriceQueryKey,
|
|
144
|
+
getGasPriceQueryOptions,
|
|
145
|
+
} from '../query/getGasPrice.js'
|
|
146
|
+
|
|
110
147
|
export {
|
|
111
148
|
type GetTokenData,
|
|
112
149
|
type GetTokenOptions,
|
|
@@ -125,6 +162,15 @@ export {
|
|
|
125
162
|
getTransactionQueryOptions,
|
|
126
163
|
} from '../query/getTransaction.js'
|
|
127
164
|
|
|
165
|
+
export {
|
|
166
|
+
type GetTransactionCountData,
|
|
167
|
+
type GetTransactionCountOptions,
|
|
168
|
+
type GetTransactionCountQueryFnData,
|
|
169
|
+
type GetTransactionCountQueryKey,
|
|
170
|
+
getTransactionCountQueryKey,
|
|
171
|
+
getTransactionCountQueryOptions,
|
|
172
|
+
} from '../query/getTransactionCount.js'
|
|
173
|
+
|
|
128
174
|
export {
|
|
129
175
|
type GetWalletClientData,
|
|
130
176
|
type GetWalletClientOptions,
|
|
@@ -218,6 +264,24 @@ export {
|
|
|
218
264
|
switchChainMutationOptions,
|
|
219
265
|
} from '../query/switchChain.js'
|
|
220
266
|
|
|
267
|
+
export {
|
|
268
|
+
type VerifyMessageData,
|
|
269
|
+
type VerifyMessageOptions,
|
|
270
|
+
type VerifyMessageQueryFnData,
|
|
271
|
+
type VerifyMessageQueryKey,
|
|
272
|
+
verifyMessageQueryKey,
|
|
273
|
+
verifyMessageQueryOptions,
|
|
274
|
+
} from '../query/verifyMessage.js'
|
|
275
|
+
|
|
276
|
+
export {
|
|
277
|
+
type VerifyTypedDataData,
|
|
278
|
+
type VerifyTypedDataOptions,
|
|
279
|
+
type VerifyTypedDataQueryFnData,
|
|
280
|
+
type VerifyTypedDataQueryKey,
|
|
281
|
+
verifyTypedDataQueryKey,
|
|
282
|
+
verifyTypedDataQueryOptions,
|
|
283
|
+
} from '../query/verifyTypedData.js'
|
|
284
|
+
|
|
221
285
|
export {
|
|
222
286
|
type WaitForTransactionReceiptData,
|
|
223
287
|
type WaitForTransactionReceiptOptions,
|
|
@@ -235,5 +299,4 @@ export {
|
|
|
235
299
|
writeContractMutationOptions,
|
|
236
300
|
} from '../query/writeContract.js'
|
|
237
301
|
|
|
238
|
-
export { type ScopeKeyParameter } from '../query/types.js'
|
|
239
302
|
export { hashFn } from '../query/utils.js'
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
estimateFeesPerGas,
|
|
9
9
|
} from '../actions/estimateFeesPerGas.js'
|
|
10
10
|
import { type Config } from '../createConfig.js'
|
|
11
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
11
12
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
12
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
13
13
|
import { filterQueryOptions } from './utils.js'
|
|
14
14
|
|
|
15
15
|
export type EstimateFeesPerGasOptions<
|
package/src/query/estimateGas.ts
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
estimateGas,
|
|
8
8
|
} from '../actions/estimateGas.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
10
11
|
import type { UnionPartial } from '../types/utils.js'
|
|
11
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
13
13
|
|
|
14
14
|
export type EstimateGasOptions<
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type QueryOptions } from '@tanstack/query-core'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type EstimateMaxPriorityFeePerGasErrorType,
|
|
5
|
+
type EstimateMaxPriorityFeePerGasParameters,
|
|
6
|
+
type EstimateMaxPriorityFeePerGasReturnType,
|
|
7
|
+
estimateMaxPriorityFeePerGas,
|
|
8
|
+
} from '../actions/estimateMaxPriorityFeePerGas.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 EstimateMaxPriorityFeePerGasOptions<config extends Config,> =
|
|
15
|
+
Evaluate<
|
|
16
|
+
ExactPartial<EstimateMaxPriorityFeePerGasParameters<config>> &
|
|
17
|
+
ScopeKeyParameter
|
|
18
|
+
>
|
|
19
|
+
|
|
20
|
+
export function estimateMaxPriorityFeePerGasQueryOptions<config extends Config>(
|
|
21
|
+
config: config,
|
|
22
|
+
options: EstimateMaxPriorityFeePerGasOptions<config> = {},
|
|
23
|
+
) {
|
|
24
|
+
return {
|
|
25
|
+
async queryFn({ queryKey }) {
|
|
26
|
+
const { scopeKey: _, ...parameters } = queryKey[1]
|
|
27
|
+
return estimateMaxPriorityFeePerGas(config, parameters)
|
|
28
|
+
},
|
|
29
|
+
queryKey: estimateMaxPriorityFeePerGasQueryKey(options),
|
|
30
|
+
} as const satisfies QueryOptions<
|
|
31
|
+
EstimateMaxPriorityFeePerGasQueryFnData,
|
|
32
|
+
EstimateMaxPriorityFeePerGasErrorType,
|
|
33
|
+
EstimateMaxPriorityFeePerGasData,
|
|
34
|
+
EstimateMaxPriorityFeePerGasQueryKey<config>
|
|
35
|
+
>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type EstimateMaxPriorityFeePerGasQueryFnData =
|
|
39
|
+
EstimateMaxPriorityFeePerGasReturnType
|
|
40
|
+
|
|
41
|
+
export type EstimateMaxPriorityFeePerGasData =
|
|
42
|
+
EstimateMaxPriorityFeePerGasQueryFnData
|
|
43
|
+
|
|
44
|
+
export function estimateMaxPriorityFeePerGasQueryKey<config extends Config,>(
|
|
45
|
+
options: EstimateMaxPriorityFeePerGasOptions<config> = {},
|
|
46
|
+
) {
|
|
47
|
+
return ['estimateMaxPriorityFeePerGas', filterQueryOptions(options)] as const
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type EstimateMaxPriorityFeePerGasQueryKey<config extends Config,> =
|
|
51
|
+
ReturnType<typeof estimateMaxPriorityFeePerGasQueryKey<config>>
|
package/src/query/getBalance.ts
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
getBalance,
|
|
8
8
|
} from '../actions/getBalance.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
10
11
|
import type { Evaluate, PartialBy } from '../types/utils.js'
|
|
11
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
13
13
|
|
|
14
14
|
export type GetBalanceOptions<config extends Config> = Evaluate<
|
package/src/query/getBlock.ts
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
getBlock,
|
|
9
9
|
} from '../actions/getBlock.js'
|
|
10
10
|
import { type Config } from '../createConfig.js'
|
|
11
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
11
12
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
12
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
13
13
|
import { filterQueryOptions } from './utils.js'
|
|
14
14
|
|
|
15
15
|
export type GetBlockOptions<
|
|
@@ -38,7 +38,7 @@ export function getBlockQueryOptions<
|
|
|
38
38
|
async queryFn({ queryKey }) {
|
|
39
39
|
const { scopeKey: _, ...parameters } = queryKey[1]
|
|
40
40
|
const block = await getBlock(config, parameters)
|
|
41
|
-
return block ?? null
|
|
41
|
+
return (block ?? null) as any
|
|
42
42
|
},
|
|
43
43
|
queryKey: getBlockQueryKey(options),
|
|
44
44
|
} as const satisfies QueryOptions<
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
getBlockNumber,
|
|
8
8
|
} from '../actions/getBlockNumber.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
10
11
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
13
13
|
|
|
14
14
|
export type GetBlockNumberOptions<
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type QueryOptions } from '@tanstack/query-core'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type GetBlockTransactionCountErrorType,
|
|
5
|
+
type GetBlockTransactionCountParameters,
|
|
6
|
+
type GetBlockTransactionCountReturnType,
|
|
7
|
+
getBlockTransactionCount,
|
|
8
|
+
} from '../actions/getBlockTransactionCount.js'
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
|
+
import { type ScopeKeyParameter } from '../types/properties.js'
|
|
11
|
+
import { type ExactPartial, type UnionEvaluate } from '../types/utils.js'
|
|
12
|
+
import { filterQueryOptions } from './utils.js'
|
|
13
|
+
|
|
14
|
+
export type GetBlockTransactionCountOptions<
|
|
15
|
+
config extends Config,
|
|
16
|
+
chainId extends config['chains'][number]['id'],
|
|
17
|
+
> = UnionEvaluate<
|
|
18
|
+
ExactPartial<GetBlockTransactionCountParameters<config, chainId>> &
|
|
19
|
+
ScopeKeyParameter
|
|
20
|
+
>
|
|
21
|
+
|
|
22
|
+
export function getBlockTransactionCountQueryOptions<
|
|
23
|
+
config extends Config,
|
|
24
|
+
chainId extends config['chains'][number]['id'],
|
|
25
|
+
>(
|
|
26
|
+
config: config,
|
|
27
|
+
options: GetBlockTransactionCountOptions<config, chainId> = {},
|
|
28
|
+
) {
|
|
29
|
+
return {
|
|
30
|
+
async queryFn({ queryKey }) {
|
|
31
|
+
const { scopeKey: _, ...parameters } = queryKey[1]
|
|
32
|
+
const blockTransactionCount = await getBlockTransactionCount(
|
|
33
|
+
config,
|
|
34
|
+
parameters,
|
|
35
|
+
)
|
|
36
|
+
return blockTransactionCount ?? null
|
|
37
|
+
},
|
|
38
|
+
queryKey: getBlockTransactionCountQueryKey(options),
|
|
39
|
+
} as const satisfies QueryOptions<
|
|
40
|
+
GetBlockTransactionCountQueryFnData,
|
|
41
|
+
GetBlockTransactionCountErrorType,
|
|
42
|
+
GetBlockTransactionCountData,
|
|
43
|
+
GetBlockTransactionCountQueryKey<config, chainId>
|
|
44
|
+
>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type GetBlockTransactionCountQueryFnData =
|
|
48
|
+
GetBlockTransactionCountReturnType
|
|
49
|
+
|
|
50
|
+
export type GetBlockTransactionCountData = GetBlockTransactionCountQueryFnData
|
|
51
|
+
|
|
52
|
+
export function getBlockTransactionCountQueryKey<
|
|
53
|
+
config extends Config,
|
|
54
|
+
chainId extends config['chains'][number]['id'],
|
|
55
|
+
>(options: GetBlockTransactionCountOptions<config, chainId> = {}) {
|
|
56
|
+
return ['blockTransactionCount', filterQueryOptions(options)] as const
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type GetBlockTransactionCountQueryKey<
|
|
60
|
+
config extends Config,
|
|
61
|
+
chainId extends config['chains'][number]['id'],
|
|
62
|
+
> = ReturnType<typeof getBlockTransactionCountQueryKey<config, chainId>>
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
getConnectorClient,
|
|
8
8
|
} from '../actions/getConnectorClient.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
10
11
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
13
13
|
|
|
14
14
|
export type GetConnectorClientOptions<
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
getEnsAddress,
|
|
8
8
|
} from '../actions/getEnsAddress.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
10
11
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
13
13
|
|
|
14
14
|
export type GetEnsAddressOptions<config extends Config> = Evaluate<
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
getEnsAvatar,
|
|
8
8
|
} from '../actions/getEnsAvatar.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
10
11
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
13
13
|
|
|
14
14
|
export type GetEnsAvatarOptions<config extends Config> = Evaluate<
|
package/src/query/getEnsName.ts
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
getEnsName,
|
|
8
8
|
} from '../actions/getEnsName.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
10
11
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
13
13
|
|
|
14
14
|
export type GetEnsNameOptions<config extends Config> = Evaluate<
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
getEnsResolver,
|
|
8
8
|
} from '../actions/getEnsResolver.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
10
11
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
|
-
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
13
13
|
|
|
14
14
|
export type GetEnsResolverOptions<config extends Config> = Evaluate<
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type QueryOptions } from '@tanstack/query-core'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type GetFeeHistoryErrorType,
|
|
5
|
+
type GetFeeHistoryParameters,
|
|
6
|
+
type GetFeeHistoryReturnType,
|
|
7
|
+
getFeeHistory,
|
|
8
|
+
} from '../actions/getFeeHistory.js'
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
|
+
import { type ScopeKeyParameter } from '../types/properties.js'
|
|
11
|
+
import type { Evaluate, PartialBy } from '../types/utils.js'
|
|
12
|
+
import { filterQueryOptions } from './utils.js'
|
|
13
|
+
|
|
14
|
+
export type GetFeeHistoryOptions<
|
|
15
|
+
config extends Config,
|
|
16
|
+
chainId extends config['chains'][number]['id'],
|
|
17
|
+
> = Evaluate<
|
|
18
|
+
PartialBy<
|
|
19
|
+
GetFeeHistoryParameters<config, chainId>,
|
|
20
|
+
'blockCount' | 'rewardPercentiles'
|
|
21
|
+
> &
|
|
22
|
+
ScopeKeyParameter
|
|
23
|
+
>
|
|
24
|
+
|
|
25
|
+
export function getFeeHistoryQueryOptions<
|
|
26
|
+
config extends Config,
|
|
27
|
+
chainId extends config['chains'][number]['id'],
|
|
28
|
+
>(config: config, options: GetFeeHistoryOptions<config, chainId> = {}) {
|
|
29
|
+
return {
|
|
30
|
+
async queryFn({ queryKey }) {
|
|
31
|
+
const {
|
|
32
|
+
blockCount,
|
|
33
|
+
rewardPercentiles,
|
|
34
|
+
scopeKey: _,
|
|
35
|
+
...parameters
|
|
36
|
+
} = queryKey[1]
|
|
37
|
+
if (!blockCount) throw new Error('blockCount is required')
|
|
38
|
+
if (!rewardPercentiles) throw new Error('rewardPercentiles is required')
|
|
39
|
+
const feeHistory = await getFeeHistory(config, {
|
|
40
|
+
...(parameters as GetFeeHistoryParameters),
|
|
41
|
+
blockCount,
|
|
42
|
+
rewardPercentiles,
|
|
43
|
+
})
|
|
44
|
+
return feeHistory ?? null
|
|
45
|
+
},
|
|
46
|
+
queryKey: getFeeHistoryQueryKey(options),
|
|
47
|
+
} as const satisfies QueryOptions<
|
|
48
|
+
GetFeeHistoryQueryFnData,
|
|
49
|
+
GetFeeHistoryErrorType,
|
|
50
|
+
GetFeeHistoryData,
|
|
51
|
+
GetFeeHistoryQueryKey<config, chainId>
|
|
52
|
+
>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type GetFeeHistoryQueryFnData = GetFeeHistoryReturnType
|
|
56
|
+
|
|
57
|
+
export type GetFeeHistoryData = GetFeeHistoryQueryFnData
|
|
58
|
+
|
|
59
|
+
export function getFeeHistoryQueryKey<
|
|
60
|
+
config extends Config,
|
|
61
|
+
chainId extends config['chains'][number]['id'],
|
|
62
|
+
>(options: GetFeeHistoryOptions<config, chainId> = {}) {
|
|
63
|
+
return ['feeHistory', filterQueryOptions(options)] as const
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type GetFeeHistoryQueryKey<
|
|
67
|
+
config extends Config,
|
|
68
|
+
chainId extends config['chains'][number]['id'],
|
|
69
|
+
> = ReturnType<typeof getFeeHistoryQueryKey<config, chainId>>
|