@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
|
@@ -6,4 +6,5 @@ export type QueryParameter<queryFnData = unknown, error = Query.DefaultError, da
|
|
|
6
6
|
export type QueryOptions<queryFnData = unknown, error = Query.DefaultError, data = queryFnData, queryKey extends Query.QueryKey = Query.QueryKey> = RequiredBy<Query.QueryOptions<queryFnData, error, data, queryKey>, 'queryKey' | 'queryFn'> & {
|
|
7
7
|
enabled: boolean;
|
|
8
8
|
};
|
|
9
|
+
export declare function filterQueryOptions<type extends Record<string, unknown>>(options: type): type;
|
|
9
10
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/tempo/actions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEtE,MAAM,MAAM,cAAc,CACxB,WAAW,GAAG,OAAO,EACrB,KAAK,GAAG,KAAK,CAAC,YAAY,EAC1B,IAAI,GAAG,WAAW,EAClB,QAAQ,SAAS,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAC9C;IACF,KAAK,CAAC,EACF,cAAc,CACZ,YAAY,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAChD,UAAU,GAAG,SAAS,CACvB,GACD,SAAS,CAAA;CACd,CAAA;AAED,MAAM,MAAM,YAAY,CACtB,WAAW,GAAG,OAAO,EACrB,KAAK,GAAG,KAAK,CAAC,YAAY,EAC1B,IAAI,GAAG,WAAW,EAClB,QAAQ,SAAS,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAC9C,UAAU,CACZ,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EACtD,UAAU,GAAG,SAAS,CACvB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/tempo/actions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEtE,MAAM,MAAM,cAAc,CACxB,WAAW,GAAG,OAAO,EACrB,KAAK,GAAG,KAAK,CAAC,YAAY,EAC1B,IAAI,GAAG,WAAW,EAClB,QAAQ,SAAS,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAC9C;IACF,KAAK,CAAC,EACF,cAAc,CACZ,YAAY,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAChD,UAAU,GAAG,SAAS,CACvB,GACD,SAAS,CAAA;CACd,CAAA;AAED,MAAM,MAAM,YAAY,CACtB,WAAW,GAAG,OAAO,EACrB,KAAK,GAAG,KAAK,CAAC,YAAY,EAC1B,IAAI,GAAG,WAAW,EAClB,QAAQ,SAAS,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAC9C,UAAU,CACZ,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EACtD,UAAU,GAAG,SAAS,CACvB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA;AAExB,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrE,OAAO,EAAE,IAAI,GACZ,IAAI,CAsBN"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as Query from '@tanstack/query-core';
|
|
2
|
+
import type { RequiredBy, UnionLooseOmit } from './utils.js';
|
|
3
|
+
export type QueryParameter<queryFnData = unknown, error = Query.DefaultError, data = queryFnData, queryKey extends Query.QueryKey = Query.QueryKey> = {
|
|
4
|
+
query?: UnionLooseOmit<QueryOptions<queryFnData, error, data, queryKey>, 'queryKey' | 'queryFn'> | undefined;
|
|
5
|
+
};
|
|
6
|
+
export type QueryOptions<queryFnData = unknown, error = Query.DefaultError, data = queryFnData, queryKey extends Query.QueryKey = Query.QueryKey> = Omit<RequiredBy<Query.QueryObserverOptions<queryFnData, error, data, queryFnData, queryKey>, 'queryKey'>, 'queryFn' | 'queryHash' | 'queryKeyHashFn' | 'throwOnError'> & {
|
|
7
|
+
queryFn: Exclude<Query.QueryObserverOptions<queryFnData, error, data, queryFnData, queryKey>['queryFn'], typeof Query.skipToken | undefined>;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/types/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE5D,MAAM,MAAM,cAAc,CACxB,WAAW,GAAG,OAAO,EACrB,KAAK,GAAG,KAAK,CAAC,YAAY,EAC1B,IAAI,GAAG,WAAW,EAClB,QAAQ,SAAS,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAC9C;IACF,KAAK,CAAC,EACF,cAAc,CACZ,YAAY,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAChD,UAAU,GAAG,SAAS,CACvB,GACD,SAAS,CAAA;CACd,CAAA;AAED,MAAM,MAAM,YAAY,CACtB,WAAW,GAAG,OAAO,EACrB,KAAK,GAAG,KAAK,CAAC,YAAY,EAC1B,IAAI,GAAG,WAAW,EAClB,QAAQ,SAAS,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAC9C,IAAI,CACN,UAAU,CACR,KAAK,CAAC,oBAAoB,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,EAC3E,UAAU,CACX,EACD,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,cAAc,CAC5D,GAAG;IACF,OAAO,EAAE,OAAO,CACd,KAAK,CAAC,oBAAoB,CACxB,WAAW,EACX,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,CACT,CAAC,SAAS,CAAC,EACZ,OAAO,KAAK,CAAC,SAAS,GAAG,SAAS,CACnC,CAAA;CACF,CAAA"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "3.2.
|
|
1
|
+
export declare const version = "3.2.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -13,7 +13,6 @@ import type { Config } from '../createConfig.js'
|
|
|
13
13
|
import type { SelectChains } from '../types/chain.js'
|
|
14
14
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
15
15
|
import type {
|
|
16
|
-
Compute,
|
|
17
16
|
IsNarrowable,
|
|
18
17
|
UnionCompute,
|
|
19
18
|
UnionStrictOmit,
|
|
@@ -73,19 +72,17 @@ export type PrepareTransactionRequestReturnType<
|
|
|
73
72
|
///
|
|
74
73
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
75
74
|
> = {
|
|
76
|
-
[key in keyof chains]:
|
|
77
|
-
|
|
75
|
+
[key in keyof chains]: viem_PrepareTransactionRequestReturnType<
|
|
76
|
+
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined,
|
|
77
|
+
Account,
|
|
78
|
+
chains[key],
|
|
79
|
+
Account,
|
|
80
|
+
request extends viem_PrepareTransactionRequestRequest<
|
|
78
81
|
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined,
|
|
79
|
-
|
|
80
|
-
chains[key],
|
|
81
|
-
Account,
|
|
82
|
-
request extends viem_PrepareTransactionRequestRequest<
|
|
83
|
-
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined,
|
|
84
|
-
chains[key]
|
|
85
|
-
>
|
|
86
|
-
? request
|
|
87
|
-
: never
|
|
82
|
+
chains[key]
|
|
88
83
|
>
|
|
84
|
+
? request
|
|
85
|
+
: never
|
|
89
86
|
> & {
|
|
90
87
|
chainId: chains[key]['id']
|
|
91
88
|
}
|
|
@@ -20,12 +20,7 @@ import type {
|
|
|
20
20
|
ChainIdParameter,
|
|
21
21
|
ConnectorParameter,
|
|
22
22
|
} from '../types/properties.js'
|
|
23
|
-
import type {
|
|
24
|
-
Compute,
|
|
25
|
-
PartialBy,
|
|
26
|
-
UnionCompute,
|
|
27
|
-
UnionStrictOmit,
|
|
28
|
-
} from '../types/utils.js'
|
|
23
|
+
import type { Compute, PartialBy, UnionCompute } from '../types/utils.js'
|
|
29
24
|
import { getAction } from '../utils/getAction.js'
|
|
30
25
|
import {
|
|
31
26
|
type GetConnectorClientErrorType,
|
|
@@ -51,19 +46,16 @@ export type SimulateContractParameters<
|
|
|
51
46
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
52
47
|
> = {
|
|
53
48
|
[key in keyof chains]: UnionCompute<
|
|
54
|
-
UnionStrictOmit
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
>,
|
|
63
|
-
'chain'
|
|
49
|
+
// TODO: Should use `UnionStrictOmit<..., 'chain'>` on `viem_SimulateContractParameters` result instead, but it knocks out inference for overloads
|
|
50
|
+
viem_SimulateContractParameters<
|
|
51
|
+
abi,
|
|
52
|
+
functionName,
|
|
53
|
+
args,
|
|
54
|
+
chains[key],
|
|
55
|
+
chains[key],
|
|
56
|
+
Account | Address
|
|
64
57
|
>
|
|
65
|
-
> &
|
|
66
|
-
ChainIdParameter<config, chainId> &
|
|
58
|
+
> & { chain?: never } & ChainIdParameter<config, chainId> &
|
|
67
59
|
ConnectorParameter
|
|
68
60
|
}[number]
|
|
69
61
|
|
|
@@ -117,7 +109,7 @@ export async function simulateContract<
|
|
|
117
109
|
config extends Config,
|
|
118
110
|
const abi extends Abi | readonly unknown[],
|
|
119
111
|
functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
120
|
-
args extends ContractFunctionArgs<
|
|
112
|
+
const args extends ContractFunctionArgs<
|
|
121
113
|
abi,
|
|
122
114
|
'nonpayable' | 'payable',
|
|
123
115
|
functionName
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import type { Config } from '../createConfig.js'
|
|
10
10
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
11
|
-
import type {
|
|
11
|
+
import type { UnionCompute } from '../types/utils.js'
|
|
12
12
|
import { getAction } from '../utils/getAction.js'
|
|
13
13
|
|
|
14
14
|
export type VerifyTypedDataParameters<
|
|
15
15
|
typedData extends TypedData | Record<string, unknown> = TypedData,
|
|
16
16
|
primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData,
|
|
17
17
|
config extends Config = Config,
|
|
18
|
-
> =
|
|
18
|
+
> = UnionCompute<
|
|
19
19
|
viem_VerifyTypedDataParameters<typedData, primaryType> &
|
|
20
20
|
ChainIdParameter<config>
|
|
21
21
|
>
|
package/src/exports/internal.ts
CHANGED
package/src/exports/query.ts
CHANGED
|
@@ -8,6 +8,7 @@ export {
|
|
|
8
8
|
type CallOptions,
|
|
9
9
|
type CallQueryFnData,
|
|
10
10
|
type CallQueryKey,
|
|
11
|
+
type CallQueryOptions,
|
|
11
12
|
callQueryKey,
|
|
12
13
|
callQueryOptions,
|
|
13
14
|
} from '../query/call.js'
|
|
@@ -41,6 +42,7 @@ export {
|
|
|
41
42
|
type EstimateFeesPerGasOptions,
|
|
42
43
|
type EstimateFeesPerGasQueryFnData,
|
|
43
44
|
type EstimateFeesPerGasQueryKey,
|
|
45
|
+
type EstimateFeesPerGasQueryOptions,
|
|
44
46
|
estimateFeesPerGasQueryKey,
|
|
45
47
|
estimateFeesPerGasQueryOptions,
|
|
46
48
|
} from '../query/estimateFeesPerGas.js'
|
|
@@ -50,6 +52,7 @@ export {
|
|
|
50
52
|
type EstimateGasOptions,
|
|
51
53
|
type EstimateGasQueryFnData,
|
|
52
54
|
type EstimateGasQueryKey,
|
|
55
|
+
type EstimateGasQueryOptions,
|
|
53
56
|
estimateGasQueryKey,
|
|
54
57
|
estimateGasQueryOptions,
|
|
55
58
|
} from '../query/estimateGas.js'
|
|
@@ -59,6 +62,7 @@ export {
|
|
|
59
62
|
type EstimateMaxPriorityFeePerGasOptions,
|
|
60
63
|
type EstimateMaxPriorityFeePerGasQueryFnData,
|
|
61
64
|
type EstimateMaxPriorityFeePerGasQueryKey,
|
|
65
|
+
type EstimateMaxPriorityFeePerGasQueryOptions,
|
|
62
66
|
estimateMaxPriorityFeePerGasQueryKey,
|
|
63
67
|
estimateMaxPriorityFeePerGasQueryOptions,
|
|
64
68
|
} from '../query/estimateMaxPriorityFeePerGas.js'
|
|
@@ -68,6 +72,7 @@ export {
|
|
|
68
72
|
type GetBalanceOptions,
|
|
69
73
|
type GetBalanceQueryFnData,
|
|
70
74
|
type GetBalanceQueryKey,
|
|
75
|
+
type GetBalanceQueryOptions,
|
|
71
76
|
getBalanceQueryKey,
|
|
72
77
|
getBalanceQueryOptions,
|
|
73
78
|
} from '../query/getBalance.js'
|
|
@@ -77,6 +82,7 @@ export {
|
|
|
77
82
|
type GetBlockOptions,
|
|
78
83
|
type GetBlockQueryFnData,
|
|
79
84
|
type GetBlockQueryKey,
|
|
85
|
+
type GetBlockQueryOptions,
|
|
80
86
|
getBlockQueryKey,
|
|
81
87
|
getBlockQueryOptions,
|
|
82
88
|
} from '../query/getBlock.js'
|
|
@@ -86,6 +92,7 @@ export {
|
|
|
86
92
|
type GetBlockNumberOptions,
|
|
87
93
|
type GetBlockNumberQueryFnData,
|
|
88
94
|
type GetBlockNumberQueryKey,
|
|
95
|
+
type GetBlockNumberQueryOptions,
|
|
89
96
|
getBlockNumberQueryKey,
|
|
90
97
|
getBlockNumberQueryOptions,
|
|
91
98
|
} from '../query/getBlockNumber.js'
|
|
@@ -95,6 +102,7 @@ export {
|
|
|
95
102
|
type GetBlockTransactionCountOptions,
|
|
96
103
|
type GetBlockTransactionCountQueryFnData,
|
|
97
104
|
type GetBlockTransactionCountQueryKey,
|
|
105
|
+
type GetBlockTransactionCountQueryOptions,
|
|
98
106
|
getBlockTransactionCountQueryKey,
|
|
99
107
|
getBlockTransactionCountQueryOptions,
|
|
100
108
|
} from '../query/getBlockTransactionCount.js'
|
|
@@ -104,6 +112,7 @@ export {
|
|
|
104
112
|
type GetBytecodeOptions,
|
|
105
113
|
type GetBytecodeQueryFnData,
|
|
106
114
|
type GetBytecodeQueryKey,
|
|
115
|
+
type GetBytecodeQueryOptions,
|
|
107
116
|
getBytecodeQueryKey,
|
|
108
117
|
getBytecodeQueryOptions,
|
|
109
118
|
} from '../query/getBytecode.js'
|
|
@@ -113,6 +122,7 @@ export {
|
|
|
113
122
|
type GetCallsStatusOptions,
|
|
114
123
|
type GetCallsStatusQueryFnData,
|
|
115
124
|
type GetCallsStatusQueryKey,
|
|
125
|
+
type GetCallsStatusQueryOptions,
|
|
116
126
|
getCallsStatusQueryKey,
|
|
117
127
|
getCallsStatusQueryOptions,
|
|
118
128
|
} from '../query/getCallsStatus.js'
|
|
@@ -122,6 +132,7 @@ export {
|
|
|
122
132
|
type GetCapabilitiesOptions,
|
|
123
133
|
type GetCapabilitiesQueryFnData,
|
|
124
134
|
type GetCapabilitiesQueryKey,
|
|
135
|
+
type GetCapabilitiesQueryOptions,
|
|
125
136
|
getCapabilitiesQueryKey,
|
|
126
137
|
getCapabilitiesQueryOptions,
|
|
127
138
|
} from '../query/getCapabilities.js'
|
|
@@ -131,6 +142,7 @@ export {
|
|
|
131
142
|
type GetConnectorClientOptions,
|
|
132
143
|
type GetConnectorClientQueryFnData,
|
|
133
144
|
type GetConnectorClientQueryKey,
|
|
145
|
+
type GetConnectorClientQueryOptions,
|
|
134
146
|
getConnectorClientQueryKey,
|
|
135
147
|
getConnectorClientQueryOptions,
|
|
136
148
|
} from '../query/getConnectorClient.js'
|
|
@@ -140,6 +152,7 @@ export {
|
|
|
140
152
|
type GetEnsAddressOptions,
|
|
141
153
|
type GetEnsAddressQueryFnData,
|
|
142
154
|
type GetEnsAddressQueryKey,
|
|
155
|
+
type GetEnsAddressQueryOptions,
|
|
143
156
|
getEnsAddressQueryKey,
|
|
144
157
|
getEnsAddressQueryOptions,
|
|
145
158
|
} from '../query/getEnsAddress.js'
|
|
@@ -149,6 +162,7 @@ export {
|
|
|
149
162
|
type GetEnsAvatarOptions,
|
|
150
163
|
type GetEnsAvatarQueryFnData,
|
|
151
164
|
type GetEnsAvatarQueryKey,
|
|
165
|
+
type GetEnsAvatarQueryOptions,
|
|
152
166
|
getEnsAvatarQueryKey,
|
|
153
167
|
getEnsAvatarQueryOptions,
|
|
154
168
|
} from '../query/getEnsAvatar.js'
|
|
@@ -158,6 +172,7 @@ export {
|
|
|
158
172
|
type GetEnsNameOptions,
|
|
159
173
|
type GetEnsNameQueryFnData,
|
|
160
174
|
type GetEnsNameQueryKey,
|
|
175
|
+
type GetEnsNameQueryOptions,
|
|
161
176
|
getEnsNameQueryKey,
|
|
162
177
|
getEnsNameQueryOptions,
|
|
163
178
|
} from '../query/getEnsName.js'
|
|
@@ -167,6 +182,7 @@ export {
|
|
|
167
182
|
type GetEnsResolverOptions,
|
|
168
183
|
type GetEnsResolverQueryFnData,
|
|
169
184
|
type GetEnsResolverQueryKey,
|
|
185
|
+
type GetEnsResolverQueryOptions,
|
|
170
186
|
getEnsResolverQueryKey,
|
|
171
187
|
getEnsResolverQueryOptions,
|
|
172
188
|
} from '../query/getEnsResolver.js'
|
|
@@ -176,6 +192,7 @@ export {
|
|
|
176
192
|
type GetEnsTextOptions,
|
|
177
193
|
type GetEnsTextQueryFnData,
|
|
178
194
|
type GetEnsTextQueryKey,
|
|
195
|
+
type GetEnsTextQueryOptions,
|
|
179
196
|
getEnsTextQueryKey,
|
|
180
197
|
getEnsTextQueryOptions,
|
|
181
198
|
} from '../query/getEnsText.js'
|
|
@@ -185,6 +202,7 @@ export {
|
|
|
185
202
|
type GetFeeHistoryOptions,
|
|
186
203
|
type GetFeeHistoryQueryFnData,
|
|
187
204
|
type GetFeeHistoryQueryKey,
|
|
205
|
+
type GetFeeHistoryQueryOptions,
|
|
188
206
|
getFeeHistoryQueryKey,
|
|
189
207
|
getFeeHistoryQueryOptions,
|
|
190
208
|
} from '../query/getFeeHistory.js'
|
|
@@ -194,6 +212,7 @@ export {
|
|
|
194
212
|
type GetGasPriceOptions,
|
|
195
213
|
type GetGasPriceQueryFnData,
|
|
196
214
|
type GetGasPriceQueryKey,
|
|
215
|
+
type GetGasPriceQueryOptions,
|
|
197
216
|
getGasPriceQueryKey,
|
|
198
217
|
getGasPriceQueryOptions,
|
|
199
218
|
} from '../query/getGasPrice.js'
|
|
@@ -203,6 +222,7 @@ export {
|
|
|
203
222
|
type GetProofOptions,
|
|
204
223
|
type GetProofQueryFnData,
|
|
205
224
|
type GetProofQueryKey,
|
|
225
|
+
type GetProofQueryOptions,
|
|
206
226
|
getProofQueryKey,
|
|
207
227
|
getProofQueryOptions,
|
|
208
228
|
} from '../query/getProof.js'
|
|
@@ -212,6 +232,7 @@ export {
|
|
|
212
232
|
type GetStorageAtOptions,
|
|
213
233
|
type GetStorageAtQueryFnData,
|
|
214
234
|
type GetStorageAtQueryKey,
|
|
235
|
+
type GetStorageAtQueryOptions,
|
|
215
236
|
getStorageAtQueryKey,
|
|
216
237
|
getStorageAtQueryOptions,
|
|
217
238
|
} from '../query/getStorageAt.js'
|
|
@@ -221,6 +242,7 @@ export {
|
|
|
221
242
|
type GetTransactionOptions,
|
|
222
243
|
type GetTransactionQueryFnData,
|
|
223
244
|
type GetTransactionQueryKey,
|
|
245
|
+
type GetTransactionQueryOptions,
|
|
224
246
|
getTransactionQueryKey,
|
|
225
247
|
getTransactionQueryOptions,
|
|
226
248
|
} from '../query/getTransaction.js'
|
|
@@ -230,6 +252,7 @@ export {
|
|
|
230
252
|
type GetTransactionConfirmationsOptions,
|
|
231
253
|
type GetTransactionConfirmationsQueryFnData,
|
|
232
254
|
type GetTransactionConfirmationsQueryKey,
|
|
255
|
+
type GetTransactionConfirmationsQueryOptions,
|
|
233
256
|
getTransactionConfirmationsQueryKey,
|
|
234
257
|
getTransactionConfirmationsQueryOptions,
|
|
235
258
|
} from '../query/getTransactionConfirmations.js'
|
|
@@ -239,6 +262,7 @@ export {
|
|
|
239
262
|
type GetTransactionCountOptions,
|
|
240
263
|
type GetTransactionCountQueryFnData,
|
|
241
264
|
type GetTransactionCountQueryKey,
|
|
265
|
+
type GetTransactionCountQueryOptions,
|
|
242
266
|
getTransactionCountQueryKey,
|
|
243
267
|
getTransactionCountQueryOptions,
|
|
244
268
|
} from '../query/getTransactionCount.js'
|
|
@@ -248,6 +272,7 @@ export {
|
|
|
248
272
|
type GetTransactionReceiptOptions,
|
|
249
273
|
type GetTransactionReceiptQueryFnData,
|
|
250
274
|
type GetTransactionReceiptQueryKey,
|
|
275
|
+
type GetTransactionReceiptQueryOptions,
|
|
251
276
|
getTransactionReceiptQueryKey,
|
|
252
277
|
getTransactionReceiptQueryOptions,
|
|
253
278
|
} from '../query/getTransactionReceipt.js'
|
|
@@ -257,6 +282,7 @@ export {
|
|
|
257
282
|
type GetWalletClientOptions,
|
|
258
283
|
type GetWalletClientQueryFnData,
|
|
259
284
|
type GetWalletClientQueryKey,
|
|
285
|
+
type GetWalletClientQueryOptions,
|
|
260
286
|
getWalletClientQueryKey,
|
|
261
287
|
getWalletClientQueryOptions,
|
|
262
288
|
} from '../query/getWalletClient.js'
|
|
@@ -275,6 +301,7 @@ export {
|
|
|
275
301
|
type PrepareTransactionRequestOptions,
|
|
276
302
|
type PrepareTransactionRequestQueryFnData,
|
|
277
303
|
type PrepareTransactionRequestQueryKey,
|
|
304
|
+
type PrepareTransactionRequestQueryOptions,
|
|
278
305
|
prepareTransactionRequestQueryKey,
|
|
279
306
|
prepareTransactionRequestQueryOptions,
|
|
280
307
|
} from '../query/prepareTransactionRequest.js'
|
|
@@ -284,6 +311,7 @@ export {
|
|
|
284
311
|
type ReadContractOptions,
|
|
285
312
|
type ReadContractQueryFnData,
|
|
286
313
|
type ReadContractQueryKey,
|
|
314
|
+
type ReadContractQueryOptions,
|
|
287
315
|
readContractQueryKey,
|
|
288
316
|
readContractQueryOptions,
|
|
289
317
|
} from '../query/readContract.js'
|
|
@@ -293,6 +321,7 @@ export {
|
|
|
293
321
|
type ReadContractsOptions,
|
|
294
322
|
type ReadContractsQueryFnData,
|
|
295
323
|
type ReadContractsQueryKey,
|
|
324
|
+
type ReadContractsQueryOptions,
|
|
296
325
|
readContractsQueryKey,
|
|
297
326
|
readContractsQueryOptions,
|
|
298
327
|
} from '../query/readContracts.js'
|
|
@@ -366,6 +395,7 @@ export {
|
|
|
366
395
|
type SimulateContractOptions,
|
|
367
396
|
type SimulateContractQueryFnData,
|
|
368
397
|
type SimulateContractQueryKey,
|
|
398
|
+
type SimulateContractQueryOptions,
|
|
369
399
|
simulateContractQueryKey,
|
|
370
400
|
simulateContractQueryOptions,
|
|
371
401
|
} from '../query/simulateContract.js'
|
|
@@ -406,6 +436,7 @@ export {
|
|
|
406
436
|
type VerifyMessageOptions,
|
|
407
437
|
type VerifyMessageQueryFnData,
|
|
408
438
|
type VerifyMessageQueryKey,
|
|
439
|
+
type VerifyMessageQueryOptions,
|
|
409
440
|
verifyMessageQueryKey,
|
|
410
441
|
verifyMessageQueryOptions,
|
|
411
442
|
} from '../query/verifyMessage.js'
|
|
@@ -415,6 +446,7 @@ export {
|
|
|
415
446
|
type VerifyTypedDataOptions,
|
|
416
447
|
type VerifyTypedDataQueryFnData,
|
|
417
448
|
type VerifyTypedDataQueryKey,
|
|
449
|
+
type VerifyTypedDataQueryOptions,
|
|
418
450
|
verifyTypedDataQueryKey,
|
|
419
451
|
verifyTypedDataQueryOptions,
|
|
420
452
|
} from '../query/verifyTypedData.js'
|
|
@@ -424,6 +456,7 @@ export {
|
|
|
424
456
|
type WaitForCallsStatusOptions,
|
|
425
457
|
type WaitForCallsStatusQueryFnData,
|
|
426
458
|
type WaitForCallsStatusQueryKey,
|
|
459
|
+
type WaitForCallsStatusQueryOptions,
|
|
427
460
|
waitForCallsStatusQueryKey,
|
|
428
461
|
waitForCallsStatusQueryOptions,
|
|
429
462
|
} from '../query/waitForCallsStatus.js'
|
|
@@ -433,6 +466,7 @@ export {
|
|
|
433
466
|
type WaitForTransactionReceiptOptions,
|
|
434
467
|
type WaitForTransactionReceiptQueryFnData,
|
|
435
468
|
type WaitForTransactionReceiptQueryKey,
|
|
469
|
+
type WaitForTransactionReceiptQueryOptions,
|
|
436
470
|
waitForTransactionReceiptQueryKey,
|
|
437
471
|
waitForTransactionReceiptQueryOptions,
|
|
438
472
|
} from '../query/waitForTransactionReceipt.js'
|
package/src/query/call.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { QueryOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
type CallErrorType,
|
|
5
3
|
type CallParameters,
|
|
@@ -8,32 +6,35 @@ import {
|
|
|
8
6
|
} from '../actions/call.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 CallOptions<config extends Config> = Compute<
|
|
13
|
+
export type CallOptions<config extends Config, selectData = CallData> = Compute<
|
|
15
14
|
ExactPartial<CallParameters<config>> & ScopeKeyParameter
|
|
16
|
-
>
|
|
15
|
+
> &
|
|
16
|
+
QueryParameter<
|
|
17
|
+
CallQueryFnData,
|
|
18
|
+
CallErrorType,
|
|
19
|
+
selectData,
|
|
20
|
+
CallQueryKey<config>
|
|
21
|
+
>
|
|
17
22
|
|
|
18
|
-
export function callQueryOptions<config extends Config>(
|
|
23
|
+
export function callQueryOptions<config extends Config, selectData = CallData>(
|
|
19
24
|
config: config,
|
|
20
|
-
options: CallOptions<config> = {},
|
|
21
|
-
) {
|
|
25
|
+
options: CallOptions<config, selectData> = {},
|
|
26
|
+
): CallQueryOptions<config, selectData> {
|
|
22
27
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
...options.query,
|
|
29
|
+
queryFn: async (context) => {
|
|
30
|
+
const [, { scopeKey: _, ...parameters }] = context.queryKey
|
|
25
31
|
const data = await call(config, {
|
|
26
32
|
...parameters,
|
|
27
33
|
} as CallParameters)
|
|
28
34
|
return data ?? null
|
|
29
35
|
},
|
|
30
36
|
queryKey: callQueryKey(options),
|
|
31
|
-
}
|
|
32
|
-
CallQueryFnData,
|
|
33
|
-
CallErrorType,
|
|
34
|
-
CallData,
|
|
35
|
-
CallQueryKey<config>
|
|
36
|
-
>
|
|
37
|
+
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export type CallQueryFnData = CallReturnType
|
|
@@ -41,7 +42,9 @@ export type CallQueryFnData = CallReturnType
|
|
|
41
42
|
export type CallData = CallQueryFnData
|
|
42
43
|
|
|
43
44
|
export function callQueryKey<config extends Config>(
|
|
44
|
-
options:
|
|
45
|
+
options: Compute<
|
|
46
|
+
ExactPartial<CallParameters<config>> & ScopeKeyParameter
|
|
47
|
+
> = {},
|
|
45
48
|
) {
|
|
46
49
|
return ['call', filterQueryOptions(options)] as const
|
|
47
50
|
}
|
|
@@ -49,3 +52,13 @@ export function callQueryKey<config extends Config>(
|
|
|
49
52
|
export type CallQueryKey<config extends Config> = ReturnType<
|
|
50
53
|
typeof callQueryKey<config>
|
|
51
54
|
>
|
|
55
|
+
|
|
56
|
+
export type CallQueryOptions<
|
|
57
|
+
config extends Config,
|
|
58
|
+
selectData = CallData,
|
|
59
|
+
> = QueryOptions<
|
|
60
|
+
CallQueryFnData,
|
|
61
|
+
CallErrorType,
|
|
62
|
+
selectData,
|
|
63
|
+
CallQueryKey<config>
|
|
64
|
+
>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { QueryOptions } from '@tanstack/query-core'
|
|
2
1
|
import type { FeeValuesType } from 'viem'
|
|
3
2
|
|
|
4
3
|
import {
|
|
@@ -9,32 +8,40 @@ import {
|
|
|
9
8
|
} from '../actions/estimateFeesPerGas.js'
|
|
10
9
|
import type { Config } from '../createConfig.js'
|
|
11
10
|
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
11
|
+
import type { QueryOptions, QueryParameter } from '../types/query.js'
|
|
12
12
|
import type { Compute, ExactPartial } from '../types/utils.js'
|
|
13
13
|
import { filterQueryOptions } from './utils.js'
|
|
14
14
|
|
|
15
15
|
export type EstimateFeesPerGasOptions<
|
|
16
16
|
type extends FeeValuesType,
|
|
17
17
|
config extends Config,
|
|
18
|
+
selectData = EstimateFeesPerGasData<type>,
|
|
18
19
|
> = Compute<
|
|
19
20
|
ExactPartial<EstimateFeesPerGasParameters<type, config>> & ScopeKeyParameter
|
|
20
|
-
>
|
|
21
|
+
> &
|
|
22
|
+
QueryParameter<
|
|
23
|
+
EstimateFeesPerGasQueryFnData<type>,
|
|
24
|
+
EstimateFeesPerGasErrorType,
|
|
25
|
+
selectData,
|
|
26
|
+
EstimateFeesPerGasQueryKey<config, type>
|
|
27
|
+
>
|
|
21
28
|
|
|
22
29
|
export function estimateFeesPerGasQueryOptions<
|
|
23
30
|
config extends Config,
|
|
24
31
|
type extends FeeValuesType = 'eip1559',
|
|
25
|
-
|
|
32
|
+
selectData = EstimateFeesPerGasData<type>,
|
|
33
|
+
>(
|
|
34
|
+
config: config,
|
|
35
|
+
options: EstimateFeesPerGasOptions<type, config, selectData> = {},
|
|
36
|
+
): EstimateFeesPerGasQueryOptions<type, config, selectData> {
|
|
26
37
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
38
|
+
...options.query,
|
|
39
|
+
queryFn: async (context) => {
|
|
40
|
+
const [, { scopeKey: _, ...parameters }] = context.queryKey
|
|
29
41
|
return estimateFeesPerGas(config, parameters)
|
|
30
42
|
},
|
|
31
43
|
queryKey: estimateFeesPerGasQueryKey(options),
|
|
32
|
-
}
|
|
33
|
-
EstimateFeesPerGasQueryFnData<type>,
|
|
34
|
-
EstimateFeesPerGasErrorType,
|
|
35
|
-
EstimateFeesPerGasData<type>,
|
|
36
|
-
EstimateFeesPerGasQueryKey<config, type>
|
|
37
|
-
>
|
|
44
|
+
}
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
export type EstimateFeesPerGasQueryFnData<type extends FeeValuesType> =
|
|
@@ -46,7 +53,11 @@ export type EstimateFeesPerGasData<type extends FeeValuesType> =
|
|
|
46
53
|
export function estimateFeesPerGasQueryKey<
|
|
47
54
|
config extends Config,
|
|
48
55
|
type extends FeeValuesType = 'eip1559',
|
|
49
|
-
>(
|
|
56
|
+
>(
|
|
57
|
+
options: Compute<
|
|
58
|
+
ExactPartial<EstimateFeesPerGasParameters<type, config>> & ScopeKeyParameter
|
|
59
|
+
> = {},
|
|
60
|
+
) {
|
|
50
61
|
return ['estimateFeesPerGas', filterQueryOptions(options)] as const
|
|
51
62
|
}
|
|
52
63
|
|
|
@@ -54,3 +65,14 @@ export type EstimateFeesPerGasQueryKey<
|
|
|
54
65
|
config extends Config,
|
|
55
66
|
type extends FeeValuesType,
|
|
56
67
|
> = ReturnType<typeof estimateFeesPerGasQueryKey<config, type>>
|
|
68
|
+
|
|
69
|
+
export type EstimateFeesPerGasQueryOptions<
|
|
70
|
+
type extends FeeValuesType,
|
|
71
|
+
config extends Config,
|
|
72
|
+
selectData = EstimateFeesPerGasData<type>,
|
|
73
|
+
> = QueryOptions<
|
|
74
|
+
EstimateFeesPerGasQueryFnData<type>,
|
|
75
|
+
EstimateFeesPerGasErrorType,
|
|
76
|
+
selectData,
|
|
77
|
+
EstimateFeesPerGasQueryKey<config, type>
|
|
78
|
+
>
|