@wagmi/vue 0.0.0-canary-20240515232917
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/LICENSE +21 -0
- package/README.md +14 -0
- package/actions/package.json +5 -0
- package/chains/package.json +5 -0
- package/connectors/package.json +5 -0
- package/dist/esm/composables/useAccount.js +18 -0
- package/dist/esm/composables/useAccount.js.map +1 -0
- package/dist/esm/composables/useAccountEffect.js +37 -0
- package/dist/esm/composables/useAccountEffect.js.map +1 -0
- package/dist/esm/composables/useBalance.js +24 -0
- package/dist/esm/composables/useBalance.js.map +1 -0
- package/dist/esm/composables/useBlockNumber.js +46 -0
- package/dist/esm/composables/useBlockNumber.js.map +1 -0
- package/dist/esm/composables/useChainId.js +17 -0
- package/dist/esm/composables/useChainId.js.map +1 -0
- package/dist/esm/composables/useChains.js +17 -0
- package/dist/esm/composables/useChains.js.map +1 -0
- package/dist/esm/composables/useClient.js +23 -0
- package/dist/esm/composables/useClient.js.map +1 -0
- package/dist/esm/composables/useConfig.js +19 -0
- package/dist/esm/composables/useConfig.js.map +1 -0
- package/dist/esm/composables/useConnect.js +29 -0
- package/dist/esm/composables/useConnect.js.map +1 -0
- package/dist/esm/composables/useConnections.js +16 -0
- package/dist/esm/composables/useConnections.js.map +1 -0
- package/dist/esm/composables/useConnectorClient.js +49 -0
- package/dist/esm/composables/useConnectorClient.js.map +1 -0
- package/dist/esm/composables/useConnectors.js +16 -0
- package/dist/esm/composables/useConnectors.js.map +1 -0
- package/dist/esm/composables/useDisconnect.js +24 -0
- package/dist/esm/composables/useDisconnect.js.map +1 -0
- package/dist/esm/composables/useEnsAddress.js +24 -0
- package/dist/esm/composables/useEnsAddress.js.map +1 -0
- package/dist/esm/composables/useEnsAvatar.js +24 -0
- package/dist/esm/composables/useEnsAvatar.js.map +1 -0
- package/dist/esm/composables/useEnsName.js +24 -0
- package/dist/esm/composables/useEnsName.js.map +1 -0
- package/dist/esm/composables/useEstimateGas.js +29 -0
- package/dist/esm/composables/useEstimateGas.js.map +1 -0
- package/dist/esm/composables/useReadContract.js +28 -0
- package/dist/esm/composables/useReadContract.js.map +1 -0
- package/dist/esm/composables/useReconnect.js +21 -0
- package/dist/esm/composables/useReconnect.js.map +1 -0
- package/dist/esm/composables/useSendTransaction.js +19 -0
- package/dist/esm/composables/useSendTransaction.js.map +1 -0
- package/dist/esm/composables/useSignMessage.js +20 -0
- package/dist/esm/composables/useSignMessage.js.map +1 -0
- package/dist/esm/composables/useSignTypedData.js +19 -0
- package/dist/esm/composables/useSignTypedData.js.map +1 -0
- package/dist/esm/composables/useSimulateContract.js +34 -0
- package/dist/esm/composables/useSimulateContract.js.map +1 -0
- package/dist/esm/composables/useSwitchAccount.js +23 -0
- package/dist/esm/composables/useSwitchAccount.js.map +1 -0
- package/dist/esm/composables/useSwitchChain.js +25 -0
- package/dist/esm/composables/useSwitchChain.js.map +1 -0
- package/dist/esm/composables/useTransaction.js +29 -0
- package/dist/esm/composables/useTransaction.js.map +1 -0
- package/dist/esm/composables/useTransactionReceipt.js +31 -0
- package/dist/esm/composables/useTransactionReceipt.js.map +1 -0
- package/dist/esm/composables/useWaitForTransactionReceipt.js +28 -0
- package/dist/esm/composables/useWaitForTransactionReceipt.js.map +1 -0
- package/dist/esm/composables/useWatchBlockNumber.js +27 -0
- package/dist/esm/composables/useWatchBlockNumber.js.map +1 -0
- package/dist/esm/composables/useWriteContract.js +19 -0
- package/dist/esm/composables/useWriteContract.js.map +1 -0
- package/dist/esm/errors/base.js +20 -0
- package/dist/esm/errors/base.js.map +1 -0
- package/dist/esm/errors/plugin.js +28 -0
- package/dist/esm/errors/plugin.js.map +1 -0
- package/dist/esm/exports/actions.js +5 -0
- package/dist/esm/exports/actions.js.map +1 -0
- package/dist/esm/exports/chains.js +5 -0
- package/dist/esm/exports/chains.js.map +1 -0
- package/dist/esm/exports/connectors.js +5 -0
- package/dist/esm/exports/connectors.js.map +1 -0
- package/dist/esm/exports/index.js +55 -0
- package/dist/esm/exports/index.js.map +1 -0
- package/dist/esm/exports/nuxt.js +4 -0
- package/dist/esm/exports/nuxt.js.map +1 -0
- package/dist/esm/exports/query.js +7 -0
- package/dist/esm/exports/query.js.map +1 -0
- package/dist/esm/nuxt/module.js +53 -0
- package/dist/esm/nuxt/module.js.map +1 -0
- package/dist/esm/nuxt/runtime/composables.js +2 -0
- package/dist/esm/nuxt/runtime/composables.js.map +1 -0
- package/dist/esm/plugin.js +14 -0
- package/dist/esm/plugin.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -0
- package/dist/esm/types/properties.js +2 -0
- package/dist/esm/types/properties.js.map +1 -0
- package/dist/esm/types/ref.js +3 -0
- package/dist/esm/types/ref.js.map +1 -0
- package/dist/esm/utils/cloneDeep.js +36 -0
- package/dist/esm/utils/cloneDeep.js.map +1 -0
- package/dist/esm/utils/getVersion.js +3 -0
- package/dist/esm/utils/getVersion.js.map +1 -0
- package/dist/esm/utils/query.js +73 -0
- package/dist/esm/utils/query.js.map +1 -0
- package/dist/esm/utils/updateState.js +7 -0
- package/dist/esm/utils/updateState.js.map +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/types/composables/useAccount.d.ts +8 -0
- package/dist/types/composables/useAccount.d.ts.map +1 -0
- package/dist/types/composables/useAccountEffect.d.ts +15 -0
- package/dist/types/composables/useAccountEffect.d.ts.map +1 -0
- package/dist/types/composables/useBalance.d.ts +12 -0
- package/dist/types/composables/useBalance.d.ts.map +1 -0
- package/dist/types/composables/useBlockNumber.d.ts +14 -0
- package/dist/types/composables/useBlockNumber.d.ts.map +1 -0
- package/dist/types/composables/useChainId.d.ts +8 -0
- package/dist/types/composables/useChainId.d.ts.map +1 -0
- package/dist/types/composables/useChains.d.ts +9 -0
- package/dist/types/composables/useChains.d.ts.map +1 -0
- package/dist/types/composables/useClient.d.ts +10 -0
- package/dist/types/composables/useClient.d.ts.map +1 -0
- package/dist/types/composables/useConfig.d.ts +8 -0
- package/dist/types/composables/useConfig.d.ts.map +1 -0
- package/dist/types/composables/useConnect.d.ts +16 -0
- package/dist/types/composables/useConnect.d.ts.map +1 -0
- package/dist/types/composables/useConnections.d.ts +8 -0
- package/dist/types/composables/useConnections.d.ts.map +1 -0
- package/dist/types/composables/useConnectorClient.d.ts +13 -0
- package/dist/types/composables/useConnectorClient.d.ts.map +1 -0
- package/dist/types/composables/useConnectors.d.ts +8 -0
- package/dist/types/composables/useConnectors.d.ts.map +1 -0
- package/dist/types/composables/useDisconnect.d.ts +17 -0
- package/dist/types/composables/useDisconnect.d.ts.map +1 -0
- package/dist/types/composables/useEnsAddress.d.ts +11 -0
- package/dist/types/composables/useEnsAddress.d.ts.map +1 -0
- package/dist/types/composables/useEnsAvatar.d.ts +11 -0
- package/dist/types/composables/useEnsAvatar.d.ts.map +1 -0
- package/dist/types/composables/useEnsName.d.ts +11 -0
- package/dist/types/composables/useEnsName.d.ts.map +1 -0
- package/dist/types/composables/useEstimateGas.d.ts +10 -0
- package/dist/types/composables/useEstimateGas.d.ts.map +1 -0
- package/dist/types/composables/useReadContract.d.ts +12 -0
- package/dist/types/composables/useReadContract.d.ts.map +1 -0
- package/dist/types/composables/useReconnect.d.ts +16 -0
- package/dist/types/composables/useReconnect.d.ts.map +1 -0
- package/dist/types/composables/useSendTransaction.d.ts +15 -0
- package/dist/types/composables/useSendTransaction.d.ts.map +1 -0
- package/dist/types/composables/useSignMessage.d.ts +15 -0
- package/dist/types/composables/useSignMessage.d.ts.map +1 -0
- package/dist/types/composables/useSignTypedData.d.ts +15 -0
- package/dist/types/composables/useSignTypedData.d.ts.map +1 -0
- package/dist/types/composables/useSimulateContract.d.ts +12 -0
- package/dist/types/composables/useSimulateContract.d.ts.map +1 -0
- package/dist/types/composables/useSwitchAccount.d.ts +17 -0
- package/dist/types/composables/useSwitchAccount.d.ts.map +1 -0
- package/dist/types/composables/useSwitchChain.d.ts +17 -0
- package/dist/types/composables/useSwitchChain.d.ts.map +1 -0
- package/dist/types/composables/useTransaction.d.ts +11 -0
- package/dist/types/composables/useTransaction.d.ts.map +1 -0
- package/dist/types/composables/useTransactionReceipt.d.ts +12 -0
- package/dist/types/composables/useTransactionReceipt.d.ts.map +1 -0
- package/dist/types/composables/useWaitForTransactionReceipt.d.ts +11 -0
- package/dist/types/composables/useWaitForTransactionReceipt.d.ts.map +1 -0
- package/dist/types/composables/useWatchBlockNumber.d.ts +9 -0
- package/dist/types/composables/useWatchBlockNumber.d.ts.map +1 -0
- package/dist/types/composables/useWriteContract.d.ts +15 -0
- package/dist/types/composables/useWriteContract.d.ts.map +1 -0
- package/dist/types/errors/base.d.ts +10 -0
- package/dist/types/errors/base.d.ts.map +1 -0
- package/dist/types/errors/plugin.d.ts +16 -0
- package/dist/types/errors/plugin.d.ts.map +1 -0
- package/dist/types/exports/actions.d.ts +2 -0
- package/dist/types/exports/actions.d.ts.map +1 -0
- package/dist/types/exports/chains.d.ts +2 -0
- package/dist/types/exports/chains.d.ts.map +1 -0
- package/dist/types/exports/connectors.d.ts +2 -0
- package/dist/types/exports/connectors.d.ts.map +1 -0
- package/dist/types/exports/index.d.ts +36 -0
- package/dist/types/exports/index.d.ts.map +1 -0
- package/dist/types/exports/nuxt.d.ts +4 -0
- package/dist/types/exports/nuxt.d.ts.map +1 -0
- package/dist/types/exports/query.d.ts +4 -0
- package/dist/types/exports/query.d.ts.map +1 -0
- package/dist/types/nuxt/module.d.ts +4 -0
- package/dist/types/nuxt/module.d.ts.map +1 -0
- package/dist/types/nuxt/runtime/composables.d.ts +2 -0
- package/dist/types/nuxt/runtime/composables.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +11 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/types/properties.d.ts +15 -0
- package/dist/types/types/properties.d.ts.map +1 -0
- package/dist/types/types/ref.d.ts +12 -0
- package/dist/types/types/ref.d.ts.map +1 -0
- package/dist/types/utils/cloneDeep.d.ts +3 -0
- package/dist/types/utils/cloneDeep.d.ts.map +1 -0
- package/dist/types/utils/getVersion.d.ts +2 -0
- package/dist/types/utils/getVersion.d.ts.map +1 -0
- package/dist/types/utils/query.d.ts +17 -0
- package/dist/types/utils/query.d.ts.map +1 -0
- package/dist/types/utils/updateState.d.ts +2 -0
- package/dist/types/utils/updateState.d.ts.map +1 -0
- package/dist/types/version.d.ts +2 -0
- package/dist/types/version.d.ts.map +1 -0
- package/nuxt/package.json +5 -0
- package/package.json +108 -0
- package/query/package.json +5 -0
- package/src/composables/useAccount.ts +37 -0
- package/src/composables/useAccountEffect.ts +66 -0
- package/src/composables/useBalance.ts +69 -0
- package/src/composables/useBlockNumber.ts +118 -0
- package/src/composables/useChainId.ts +35 -0
- package/src/composables/useChains.ts +38 -0
- package/src/composables/useClient.ts +66 -0
- package/src/composables/useConfig.ts +34 -0
- package/src/composables/useConnect.ts +91 -0
- package/src/composables/useConnections.ts +30 -0
- package/src/composables/useConnectorClient.ts +127 -0
- package/src/composables/useConnectors.ts +30 -0
- package/src/composables/useDisconnect.ts +70 -0
- package/src/composables/useEnsAddress.ts +65 -0
- package/src/composables/useEnsAvatar.ts +65 -0
- package/src/composables/useEnsName.ts +65 -0
- package/src/composables/useEstimateGas.ts +83 -0
- package/src/composables/useReadContract.ts +121 -0
- package/src/composables/useReconnect.ts +65 -0
- package/src/composables/useSendTransaction.ts +76 -0
- package/src/composables/useSignMessage.ts +63 -0
- package/src/composables/useSignTypedData.ts +64 -0
- package/src/composables/useSimulateContract.ts +148 -0
- package/src/composables/useSwitchAccount.ts +84 -0
- package/src/composables/useSwitchChain.ts +80 -0
- package/src/composables/useTransaction.ts +88 -0
- package/src/composables/useTransactionReceipt.ts +85 -0
- package/src/composables/useWaitForTransactionReceipt.ts +81 -0
- package/src/composables/useWatchBlockNumber.ts +61 -0
- package/src/composables/useWriteContract.ts +85 -0
- package/src/errors/base.ts +14 -0
- package/src/errors/plugin.ts +31 -0
- package/src/exports/actions.ts +5 -0
- package/src/exports/chains.ts +5 -0
- package/src/exports/connectors.ts +5 -0
- package/src/exports/index.ts +260 -0
- package/src/exports/nuxt.ts +4 -0
- package/src/exports/query.ts +17 -0
- package/src/nuxt/module.ts +59 -0
- package/src/nuxt/runtime/composables.ts +1 -0
- package/src/plugin.ts +22 -0
- package/src/types/properties.ts +27 -0
- package/src/types/ref.ts +36 -0
- package/src/utils/cloneDeep.ts +43 -0
- package/src/utils/getVersion.ts +3 -0
- package/src/utils/query.ts +161 -0
- package/src/utils/updateState.ts +10 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/vue-query'
|
|
2
|
+
import type {
|
|
3
|
+
Config,
|
|
4
|
+
ResolvedRegister,
|
|
5
|
+
SendTransactionErrorType,
|
|
6
|
+
} from '@wagmi/core'
|
|
7
|
+
import type { Evaluate } from '@wagmi/core/internal'
|
|
8
|
+
import {
|
|
9
|
+
type SendTransactionData,
|
|
10
|
+
type SendTransactionMutate,
|
|
11
|
+
type SendTransactionMutateAsync,
|
|
12
|
+
type SendTransactionVariables,
|
|
13
|
+
sendTransactionMutationOptions,
|
|
14
|
+
} from '@wagmi/core/query'
|
|
15
|
+
|
|
16
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
17
|
+
import type {
|
|
18
|
+
UseMutationParameters,
|
|
19
|
+
UseMutationReturnType,
|
|
20
|
+
} from '../utils/query.js'
|
|
21
|
+
import { useConfig } from './useConfig.js'
|
|
22
|
+
|
|
23
|
+
export type UseSendTransactionParameters<
|
|
24
|
+
config extends Config = Config,
|
|
25
|
+
context = unknown,
|
|
26
|
+
> = Evaluate<
|
|
27
|
+
ConfigParameter<config> & {
|
|
28
|
+
mutation?:
|
|
29
|
+
| UseMutationParameters<
|
|
30
|
+
SendTransactionData,
|
|
31
|
+
SendTransactionErrorType,
|
|
32
|
+
SendTransactionVariables<config, config['chains'][number]['id']>,
|
|
33
|
+
context
|
|
34
|
+
>
|
|
35
|
+
| undefined
|
|
36
|
+
}
|
|
37
|
+
>
|
|
38
|
+
|
|
39
|
+
export type UseSendTransactionReturnType<
|
|
40
|
+
config extends Config = Config,
|
|
41
|
+
context = unknown,
|
|
42
|
+
> = Evaluate<
|
|
43
|
+
UseMutationReturnType<
|
|
44
|
+
SendTransactionData,
|
|
45
|
+
SendTransactionErrorType,
|
|
46
|
+
SendTransactionVariables<config, config['chains'][number]['id']>,
|
|
47
|
+
context
|
|
48
|
+
> & {
|
|
49
|
+
sendTransaction: SendTransactionMutate<config, context>
|
|
50
|
+
sendTransactionAsync: SendTransactionMutateAsync<config, context>
|
|
51
|
+
}
|
|
52
|
+
>
|
|
53
|
+
|
|
54
|
+
/** https://wagmi.sh/vue/api/composables/useSendTransaction */
|
|
55
|
+
export function useSendTransaction<
|
|
56
|
+
config extends Config = ResolvedRegister['config'],
|
|
57
|
+
context = unknown,
|
|
58
|
+
>(
|
|
59
|
+
parameters: UseSendTransactionParameters<config, context> = {},
|
|
60
|
+
): UseSendTransactionReturnType<config, context> {
|
|
61
|
+
const { mutation } = parameters
|
|
62
|
+
|
|
63
|
+
const config = useConfig(parameters)
|
|
64
|
+
|
|
65
|
+
const mutationOptions = sendTransactionMutationOptions(config)
|
|
66
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
67
|
+
...mutation,
|
|
68
|
+
...mutationOptions,
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
...result,
|
|
73
|
+
sendTransaction: mutate,
|
|
74
|
+
sendTransactionAsync: mutateAsync,
|
|
75
|
+
} as UseSendTransactionReturnType<config, context>
|
|
76
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type SignMessageErrorType } from '@wagmi/core'
|
|
2
|
+
import type { Evaluate } from '@wagmi/core/internal'
|
|
3
|
+
import {
|
|
4
|
+
type SignMessageData,
|
|
5
|
+
type SignMessageMutate,
|
|
6
|
+
type SignMessageMutateAsync,
|
|
7
|
+
type SignMessageVariables,
|
|
8
|
+
signMessageMutationOptions,
|
|
9
|
+
} from '@wagmi/core/query'
|
|
10
|
+
|
|
11
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
12
|
+
import {
|
|
13
|
+
type UseMutationParameters,
|
|
14
|
+
type UseMutationReturnType,
|
|
15
|
+
useMutation,
|
|
16
|
+
} from '../utils/query.js'
|
|
17
|
+
import { useConfig } from './useConfig.js'
|
|
18
|
+
|
|
19
|
+
export type UseSignMessageParameters<context = unknown> = Evaluate<
|
|
20
|
+
ConfigParameter & {
|
|
21
|
+
mutation?:
|
|
22
|
+
| UseMutationParameters<
|
|
23
|
+
SignMessageData,
|
|
24
|
+
SignMessageErrorType,
|
|
25
|
+
SignMessageVariables,
|
|
26
|
+
context
|
|
27
|
+
>
|
|
28
|
+
| undefined
|
|
29
|
+
}
|
|
30
|
+
>
|
|
31
|
+
|
|
32
|
+
export type UseSignMessageReturnType<context = unknown> = Evaluate<
|
|
33
|
+
UseMutationReturnType<
|
|
34
|
+
SignMessageData,
|
|
35
|
+
SignMessageErrorType,
|
|
36
|
+
SignMessageVariables,
|
|
37
|
+
context
|
|
38
|
+
> & {
|
|
39
|
+
signMessage: SignMessageMutate<context>
|
|
40
|
+
signMessageAsync: SignMessageMutateAsync<context>
|
|
41
|
+
}
|
|
42
|
+
>
|
|
43
|
+
|
|
44
|
+
/** https://wagmi.sh/vue/api/composables/useSignMessage */
|
|
45
|
+
export function useSignMessage<context = unknown>(
|
|
46
|
+
parameters: UseSignMessageParameters<context> = {},
|
|
47
|
+
): UseSignMessageReturnType<context> {
|
|
48
|
+
const { mutation } = parameters
|
|
49
|
+
|
|
50
|
+
const config = useConfig(parameters)
|
|
51
|
+
|
|
52
|
+
const mutationOptions = signMessageMutationOptions(config)
|
|
53
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
54
|
+
...mutation,
|
|
55
|
+
...mutationOptions,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
...result,
|
|
60
|
+
signMessage: mutate,
|
|
61
|
+
signMessageAsync: mutateAsync,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { SignTypedDataErrorType } from '@wagmi/core'
|
|
2
|
+
import type { Evaluate } from '@wagmi/core/internal'
|
|
3
|
+
import {
|
|
4
|
+
type SignTypedDataData,
|
|
5
|
+
type SignTypedDataMutate,
|
|
6
|
+
type SignTypedDataMutateAsync,
|
|
7
|
+
type SignTypedDataVariables,
|
|
8
|
+
signTypedDataMutationOptions,
|
|
9
|
+
} from '@wagmi/core/query'
|
|
10
|
+
|
|
11
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
12
|
+
import {
|
|
13
|
+
type UseMutationParameters,
|
|
14
|
+
type UseMutationReturnType,
|
|
15
|
+
useMutation,
|
|
16
|
+
} from '../utils/query.js'
|
|
17
|
+
import { useConfig } from './useConfig.js'
|
|
18
|
+
|
|
19
|
+
export type UseSignTypedDataParameters<context = unknown> = Evaluate<
|
|
20
|
+
ConfigParameter & {
|
|
21
|
+
mutation?:
|
|
22
|
+
| UseMutationParameters<
|
|
23
|
+
SignTypedDataData,
|
|
24
|
+
SignTypedDataErrorType,
|
|
25
|
+
SignTypedDataVariables,
|
|
26
|
+
context
|
|
27
|
+
>
|
|
28
|
+
| undefined
|
|
29
|
+
}
|
|
30
|
+
>
|
|
31
|
+
|
|
32
|
+
export type UseSignTypedDataReturnType<context = unknown> = Evaluate<
|
|
33
|
+
UseMutationReturnType<
|
|
34
|
+
SignTypedDataData,
|
|
35
|
+
SignTypedDataErrorType,
|
|
36
|
+
SignTypedDataVariables,
|
|
37
|
+
context
|
|
38
|
+
> & {
|
|
39
|
+
signTypedData: SignTypedDataMutate<context>
|
|
40
|
+
signTypedDataAsync: SignTypedDataMutateAsync<context>
|
|
41
|
+
}
|
|
42
|
+
>
|
|
43
|
+
|
|
44
|
+
/** https://wagmi.sh/vue/api/composables/useSignTypedData */
|
|
45
|
+
export function useSignTypedData<context = unknown>(
|
|
46
|
+
parameters: UseSignTypedDataParameters<context> = {},
|
|
47
|
+
): UseSignTypedDataReturnType<context> {
|
|
48
|
+
const { mutation } = parameters
|
|
49
|
+
|
|
50
|
+
const config = useConfig(parameters)
|
|
51
|
+
|
|
52
|
+
const mutationOptions = signTypedDataMutationOptions(config)
|
|
53
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
54
|
+
...mutation,
|
|
55
|
+
...mutationOptions,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
type Return = UseSignTypedDataReturnType<context>
|
|
59
|
+
return {
|
|
60
|
+
...result,
|
|
61
|
+
signTypedData: mutate as Return['signTypedData'],
|
|
62
|
+
signTypedDataAsync: mutateAsync as Return['signTypedDataAsync'],
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Config,
|
|
3
|
+
ResolvedRegister,
|
|
4
|
+
SimulateContractErrorType,
|
|
5
|
+
} from '@wagmi/core'
|
|
6
|
+
import {
|
|
7
|
+
type SimulateContractData,
|
|
8
|
+
type SimulateContractOptions,
|
|
9
|
+
type SimulateContractQueryFnData,
|
|
10
|
+
type SimulateContractQueryKey,
|
|
11
|
+
simulateContractQueryOptions,
|
|
12
|
+
} from '@wagmi/core/query'
|
|
13
|
+
import type { Abi, ContractFunctionArgs, ContractFunctionName } from 'viem'
|
|
14
|
+
import { type MaybeRef, computed } from 'vue'
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
type ConfigParameter,
|
|
18
|
+
type QueryParameter,
|
|
19
|
+
} from '../types/properties.js'
|
|
20
|
+
import type { DeepMaybeRef } from '../types/ref.js'
|
|
21
|
+
import { deepUnref } from '../utils/cloneDeep.js'
|
|
22
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
23
|
+
import { useChainId } from './useChainId.js'
|
|
24
|
+
import { useConfig } from './useConfig.js'
|
|
25
|
+
import { useConnectorClient } from './useConnectorClient.js'
|
|
26
|
+
|
|
27
|
+
export type UseSimulateContractParameters<
|
|
28
|
+
abi extends Abi | readonly unknown[] = Abi,
|
|
29
|
+
functionName extends ContractFunctionName<
|
|
30
|
+
abi,
|
|
31
|
+
'nonpayable' | 'payable'
|
|
32
|
+
> = ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
33
|
+
args extends ContractFunctionArgs<
|
|
34
|
+
abi,
|
|
35
|
+
'nonpayable' | 'payable',
|
|
36
|
+
functionName
|
|
37
|
+
> = ContractFunctionArgs<abi, 'nonpayable' | 'payable', functionName>,
|
|
38
|
+
config extends Config = Config,
|
|
39
|
+
chainId extends config['chains'][number]['id'] | undefined = undefined,
|
|
40
|
+
selectData = SimulateContractData<abi, functionName, args, config, chainId>,
|
|
41
|
+
> = MaybeRef<
|
|
42
|
+
DeepMaybeRef<
|
|
43
|
+
SimulateContractOptions<abi, functionName, args, config, chainId>
|
|
44
|
+
> &
|
|
45
|
+
ConfigParameter<config> &
|
|
46
|
+
QueryParameter<
|
|
47
|
+
SimulateContractQueryFnData<abi, functionName, args, config, chainId>,
|
|
48
|
+
SimulateContractErrorType,
|
|
49
|
+
selectData,
|
|
50
|
+
SimulateContractQueryKey<abi, functionName, args, config, chainId>
|
|
51
|
+
>
|
|
52
|
+
>
|
|
53
|
+
|
|
54
|
+
export type UseSimulateContractReturnType<
|
|
55
|
+
abi extends Abi | readonly unknown[] = Abi,
|
|
56
|
+
functionName extends ContractFunctionName<
|
|
57
|
+
abi,
|
|
58
|
+
'nonpayable' | 'payable'
|
|
59
|
+
> = ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
60
|
+
args extends ContractFunctionArgs<
|
|
61
|
+
abi,
|
|
62
|
+
'nonpayable' | 'payable',
|
|
63
|
+
functionName
|
|
64
|
+
> = ContractFunctionArgs<abi, 'nonpayable' | 'payable', functionName>,
|
|
65
|
+
config extends Config = Config,
|
|
66
|
+
chainId extends config['chains'][number]['id'] | undefined = undefined,
|
|
67
|
+
selectData = SimulateContractData<abi, functionName, args, config, chainId>,
|
|
68
|
+
> = UseQueryReturnType<selectData, SimulateContractErrorType>
|
|
69
|
+
|
|
70
|
+
/** https://wagmi.sh/vue/api/composables/useSimulateContract */
|
|
71
|
+
export function useSimulateContract<
|
|
72
|
+
const abi extends Abi | readonly unknown[],
|
|
73
|
+
functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
74
|
+
args extends ContractFunctionArgs<
|
|
75
|
+
abi,
|
|
76
|
+
'nonpayable' | 'payable',
|
|
77
|
+
functionName
|
|
78
|
+
>,
|
|
79
|
+
config extends Config = ResolvedRegister['config'],
|
|
80
|
+
chainId extends config['chains'][number]['id'] | undefined = undefined,
|
|
81
|
+
selectData = SimulateContractData<abi, functionName, args, config, chainId>,
|
|
82
|
+
>(
|
|
83
|
+
parameters_: UseSimulateContractParameters<
|
|
84
|
+
abi,
|
|
85
|
+
functionName,
|
|
86
|
+
args,
|
|
87
|
+
config,
|
|
88
|
+
chainId,
|
|
89
|
+
selectData
|
|
90
|
+
> = {} as any,
|
|
91
|
+
): UseSimulateContractReturnType<
|
|
92
|
+
abi,
|
|
93
|
+
functionName,
|
|
94
|
+
args,
|
|
95
|
+
config,
|
|
96
|
+
chainId,
|
|
97
|
+
selectData
|
|
98
|
+
> {
|
|
99
|
+
const parameters = computed(() => deepUnref(parameters_)) as any
|
|
100
|
+
|
|
101
|
+
const config = useConfig(parameters)
|
|
102
|
+
const { data: connectorClient } = useConnectorClient(
|
|
103
|
+
computed(() => ({
|
|
104
|
+
connector: parameters.value.connector,
|
|
105
|
+
query: { enabled: parameters.value.account === undefined },
|
|
106
|
+
})),
|
|
107
|
+
)
|
|
108
|
+
const configChainId = useChainId({ config })
|
|
109
|
+
|
|
110
|
+
const queryOptions = computed(() => {
|
|
111
|
+
const {
|
|
112
|
+
abi,
|
|
113
|
+
account = connectorClient?.value?.account,
|
|
114
|
+
address,
|
|
115
|
+
chainId = configChainId.value,
|
|
116
|
+
functionName,
|
|
117
|
+
query = {},
|
|
118
|
+
} = parameters.value
|
|
119
|
+
const options = simulateContractQueryOptions<
|
|
120
|
+
config,
|
|
121
|
+
abi,
|
|
122
|
+
functionName,
|
|
123
|
+
args,
|
|
124
|
+
chainId
|
|
125
|
+
>(config as any, {
|
|
126
|
+
...parameters.value,
|
|
127
|
+
account,
|
|
128
|
+
chainId,
|
|
129
|
+
})
|
|
130
|
+
const enabled = Boolean(
|
|
131
|
+
abi && address && functionName && (query.enabled ?? true),
|
|
132
|
+
)
|
|
133
|
+
return {
|
|
134
|
+
...query,
|
|
135
|
+
...options,
|
|
136
|
+
enabled,
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
return useQuery(queryOptions as any) as UseSimulateContractReturnType<
|
|
141
|
+
abi,
|
|
142
|
+
functionName,
|
|
143
|
+
args,
|
|
144
|
+
config,
|
|
145
|
+
chainId,
|
|
146
|
+
selectData
|
|
147
|
+
>
|
|
148
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/vue-query'
|
|
2
|
+
import type {
|
|
3
|
+
Config,
|
|
4
|
+
Connector,
|
|
5
|
+
ResolvedRegister,
|
|
6
|
+
SwitchAccountErrorType,
|
|
7
|
+
} from '@wagmi/core'
|
|
8
|
+
import type { Evaluate } from '@wagmi/core/internal'
|
|
9
|
+
import {
|
|
10
|
+
type SwitchAccountData,
|
|
11
|
+
type SwitchAccountMutate,
|
|
12
|
+
type SwitchAccountMutateAsync,
|
|
13
|
+
type SwitchAccountVariables,
|
|
14
|
+
switchAccountMutationOptions,
|
|
15
|
+
} from '@wagmi/core/query'
|
|
16
|
+
import { type Ref, computed } from 'vue'
|
|
17
|
+
|
|
18
|
+
import type { ConfigParameter } from '../types/properties.js'
|
|
19
|
+
import type {
|
|
20
|
+
UseMutationParameters,
|
|
21
|
+
UseMutationReturnType,
|
|
22
|
+
} from '../utils/query.js'
|
|
23
|
+
import { useConfig } from './useConfig.js'
|
|
24
|
+
import { useConnections } from './useConnections.js'
|
|
25
|
+
|
|
26
|
+
export type UseSwitchAccountParameters<
|
|
27
|
+
config extends Config = Config,
|
|
28
|
+
context = unknown,
|
|
29
|
+
> = Evaluate<
|
|
30
|
+
ConfigParameter<config> & {
|
|
31
|
+
mutation?:
|
|
32
|
+
| UseMutationParameters<
|
|
33
|
+
SwitchAccountData<config>,
|
|
34
|
+
SwitchAccountErrorType,
|
|
35
|
+
SwitchAccountVariables,
|
|
36
|
+
context
|
|
37
|
+
>
|
|
38
|
+
| undefined
|
|
39
|
+
}
|
|
40
|
+
>
|
|
41
|
+
|
|
42
|
+
export type UseSwitchAccountReturnType<
|
|
43
|
+
config extends Config = Config,
|
|
44
|
+
context = unknown,
|
|
45
|
+
> = Evaluate<
|
|
46
|
+
UseMutationReturnType<
|
|
47
|
+
SwitchAccountData<config>,
|
|
48
|
+
SwitchAccountErrorType,
|
|
49
|
+
SwitchAccountVariables,
|
|
50
|
+
context
|
|
51
|
+
> & {
|
|
52
|
+
connectors: Ref<readonly Connector[]>
|
|
53
|
+
switchAccount: SwitchAccountMutate<config, context>
|
|
54
|
+
switchAccountAsync: SwitchAccountMutateAsync<config, context>
|
|
55
|
+
}
|
|
56
|
+
>
|
|
57
|
+
|
|
58
|
+
/** https://wagmi.sh/vue/api/composables/useSwitchAccount */
|
|
59
|
+
export function useSwitchAccount<
|
|
60
|
+
config extends Config = ResolvedRegister['config'],
|
|
61
|
+
context = unknown,
|
|
62
|
+
>(
|
|
63
|
+
parameters: UseSwitchAccountParameters<config, context> = {},
|
|
64
|
+
): UseSwitchAccountReturnType<config, context> {
|
|
65
|
+
const { mutation } = parameters
|
|
66
|
+
|
|
67
|
+
const config = useConfig(parameters)
|
|
68
|
+
const connections = useConnections({ config })
|
|
69
|
+
|
|
70
|
+
const mutationOptions = switchAccountMutationOptions(config)
|
|
71
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
72
|
+
...mutation,
|
|
73
|
+
...mutationOptions,
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
...result,
|
|
78
|
+
connectors: computed(() =>
|
|
79
|
+
connections.value.map((connection) => connection.connector),
|
|
80
|
+
),
|
|
81
|
+
switchAccount: mutate,
|
|
82
|
+
switchAccountAsync: mutateAsync,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/vue-query'
|
|
2
|
+
import {
|
|
3
|
+
type Config,
|
|
4
|
+
type ResolvedRegister,
|
|
5
|
+
type SwitchChainErrorType,
|
|
6
|
+
} from '@wagmi/core'
|
|
7
|
+
import { type Evaluate } from '@wagmi/core/internal'
|
|
8
|
+
import {
|
|
9
|
+
type SwitchChainData,
|
|
10
|
+
type SwitchChainMutate,
|
|
11
|
+
type SwitchChainMutateAsync,
|
|
12
|
+
type SwitchChainVariables,
|
|
13
|
+
switchChainMutationOptions,
|
|
14
|
+
} from '@wagmi/core/query'
|
|
15
|
+
|
|
16
|
+
import { type ConfigParameter } from '../types/properties.js'
|
|
17
|
+
import {
|
|
18
|
+
type UseMutationParameters,
|
|
19
|
+
type UseMutationReturnType,
|
|
20
|
+
} from '../utils/query.js'
|
|
21
|
+
import { type UseChainsReturnType, useChains } from './useChains.js'
|
|
22
|
+
import { useConfig } from './useConfig.js'
|
|
23
|
+
|
|
24
|
+
export type UseSwitchChainParameters<
|
|
25
|
+
config extends Config = Config,
|
|
26
|
+
context = unknown,
|
|
27
|
+
> = Evaluate<
|
|
28
|
+
ConfigParameter<config> & {
|
|
29
|
+
mutation?:
|
|
30
|
+
| UseMutationParameters<
|
|
31
|
+
SwitchChainData<config, config['chains'][number]['id']>,
|
|
32
|
+
SwitchChainErrorType,
|
|
33
|
+
SwitchChainVariables<config, config['chains'][number]['id']>,
|
|
34
|
+
context
|
|
35
|
+
>
|
|
36
|
+
| undefined
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
|
|
40
|
+
export type UseSwitchChainReturnType<
|
|
41
|
+
config extends Config = Config,
|
|
42
|
+
context = unknown,
|
|
43
|
+
> = Evaluate<
|
|
44
|
+
UseMutationReturnType<
|
|
45
|
+
SwitchChainData<config, config['chains'][number]['id']>,
|
|
46
|
+
SwitchChainErrorType,
|
|
47
|
+
SwitchChainVariables<config, config['chains'][number]['id']>,
|
|
48
|
+
context
|
|
49
|
+
> & {
|
|
50
|
+
chains: Evaluate<UseChainsReturnType<config>>
|
|
51
|
+
switchChain: SwitchChainMutate<config, context>
|
|
52
|
+
switchChainAsync: SwitchChainMutateAsync<config, context>
|
|
53
|
+
}
|
|
54
|
+
>
|
|
55
|
+
|
|
56
|
+
/** https://wagmi.sh/vue/api/composables/useSwitchChain */
|
|
57
|
+
export function useSwitchChain<
|
|
58
|
+
config extends Config = ResolvedRegister['config'],
|
|
59
|
+
context = unknown,
|
|
60
|
+
>(
|
|
61
|
+
parameters: UseSwitchChainParameters<config, context> = {},
|
|
62
|
+
): UseSwitchChainReturnType<config, context> {
|
|
63
|
+
const { mutation } = parameters
|
|
64
|
+
|
|
65
|
+
const config = useConfig(parameters)
|
|
66
|
+
|
|
67
|
+
const mutationOptions = switchChainMutationOptions(config)
|
|
68
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
69
|
+
...mutation,
|
|
70
|
+
...mutationOptions,
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
type Return = UseSwitchChainReturnType<config, context>
|
|
74
|
+
return {
|
|
75
|
+
...result,
|
|
76
|
+
chains: useChains({ config }),
|
|
77
|
+
switchChain: mutate as Return['switchChain'],
|
|
78
|
+
switchChainAsync: mutateAsync as Return['switchChainAsync'],
|
|
79
|
+
} as Return
|
|
80
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Config,
|
|
3
|
+
GetTransactionErrorType,
|
|
4
|
+
ResolvedRegister,
|
|
5
|
+
} from '@wagmi/core'
|
|
6
|
+
import { type Evaluate } from '@wagmi/core/internal'
|
|
7
|
+
import {
|
|
8
|
+
type GetTransactionData,
|
|
9
|
+
type GetTransactionOptions,
|
|
10
|
+
type GetTransactionQueryFnData,
|
|
11
|
+
type GetTransactionQueryKey,
|
|
12
|
+
getTransactionQueryOptions,
|
|
13
|
+
} from '@wagmi/core/query'
|
|
14
|
+
|
|
15
|
+
import { computed } from 'vue'
|
|
16
|
+
import type { ConfigParameter, QueryParameter } from '../types/properties.js'
|
|
17
|
+
import type { DeepMaybeRef } from '../types/ref.js'
|
|
18
|
+
import { deepUnref } from '../utils/cloneDeep.js'
|
|
19
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
20
|
+
import { useChainId } from './useChainId.js'
|
|
21
|
+
import { useConfig } from './useConfig.js'
|
|
22
|
+
|
|
23
|
+
export type UseTransactionParameters<
|
|
24
|
+
config extends Config = Config,
|
|
25
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
26
|
+
selectData = GetTransactionData<config, chainId>,
|
|
27
|
+
> = Evaluate<
|
|
28
|
+
DeepMaybeRef<
|
|
29
|
+
GetTransactionOptions<config, chainId> &
|
|
30
|
+
ConfigParameter<config> &
|
|
31
|
+
QueryParameter<
|
|
32
|
+
GetTransactionQueryFnData<config, chainId>,
|
|
33
|
+
GetTransactionErrorType,
|
|
34
|
+
selectData,
|
|
35
|
+
GetTransactionQueryKey<config, chainId>
|
|
36
|
+
>
|
|
37
|
+
>
|
|
38
|
+
>
|
|
39
|
+
|
|
40
|
+
export type UseTransactionReturnType<
|
|
41
|
+
config extends Config = Config,
|
|
42
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
43
|
+
selectData = GetTransactionData<config, chainId>,
|
|
44
|
+
> = UseQueryReturnType<selectData, GetTransactionErrorType>
|
|
45
|
+
|
|
46
|
+
/** https://wagmi.sh/vue/api/composables/useTransaction */
|
|
47
|
+
export function useTransaction<
|
|
48
|
+
config extends Config = ResolvedRegister['config'],
|
|
49
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
50
|
+
selectData = GetTransactionData<config, chainId>,
|
|
51
|
+
>(
|
|
52
|
+
parameters_: UseTransactionParameters<config, chainId, selectData> = {},
|
|
53
|
+
): UseTransactionReturnType<config, chainId, selectData> {
|
|
54
|
+
const parameters = computed(() => deepUnref(parameters_))
|
|
55
|
+
|
|
56
|
+
const config = useConfig(parameters)
|
|
57
|
+
const configChainId = useChainId({ config })
|
|
58
|
+
|
|
59
|
+
const queryOptions = computed(() => {
|
|
60
|
+
const {
|
|
61
|
+
blockHash,
|
|
62
|
+
blockNumber,
|
|
63
|
+
blockTag,
|
|
64
|
+
chainId = configChainId.value,
|
|
65
|
+
hash,
|
|
66
|
+
query = {},
|
|
67
|
+
} = parameters.value
|
|
68
|
+
const options = getTransactionQueryOptions(config, {
|
|
69
|
+
...parameters.value,
|
|
70
|
+
chainId,
|
|
71
|
+
})
|
|
72
|
+
const enabled = Boolean(
|
|
73
|
+
!(blockHash && blockNumber && blockTag && hash) &&
|
|
74
|
+
(query.enabled ?? true),
|
|
75
|
+
)
|
|
76
|
+
return {
|
|
77
|
+
...query,
|
|
78
|
+
...options,
|
|
79
|
+
enabled,
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
return useQuery(queryOptions as any) as UseTransactionReturnType<
|
|
84
|
+
config,
|
|
85
|
+
chainId,
|
|
86
|
+
selectData
|
|
87
|
+
>
|
|
88
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Config,
|
|
3
|
+
type GetTransactionReceiptErrorType,
|
|
4
|
+
type ResolvedRegister,
|
|
5
|
+
} from '@wagmi/core'
|
|
6
|
+
import { type Evaluate } from '@wagmi/core/internal'
|
|
7
|
+
import {
|
|
8
|
+
type GetTransactionReceiptData,
|
|
9
|
+
type GetTransactionReceiptOptions,
|
|
10
|
+
type GetTransactionReceiptQueryKey,
|
|
11
|
+
getTransactionReceiptQueryOptions,
|
|
12
|
+
} from '@wagmi/core/query'
|
|
13
|
+
import { type GetTransactionReceiptQueryFnData } from '@wagmi/core/query'
|
|
14
|
+
|
|
15
|
+
import { computed } from 'vue'
|
|
16
|
+
import {
|
|
17
|
+
type ConfigParameter,
|
|
18
|
+
type QueryParameter,
|
|
19
|
+
} from '../types/properties.js'
|
|
20
|
+
import type { DeepMaybeRef } from '../types/ref.js'
|
|
21
|
+
import { deepUnref } from '../utils/cloneDeep.js'
|
|
22
|
+
import { type UseQueryReturnType, useQuery } from '../utils/query.js'
|
|
23
|
+
import { useChainId } from './useChainId.js'
|
|
24
|
+
import { useConfig } from './useConfig.js'
|
|
25
|
+
|
|
26
|
+
export type UseTransactionReceiptParameters<
|
|
27
|
+
config extends Config = Config,
|
|
28
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
29
|
+
selectData = GetTransactionReceiptData<config, chainId>,
|
|
30
|
+
> = Evaluate<
|
|
31
|
+
DeepMaybeRef<
|
|
32
|
+
GetTransactionReceiptOptions<config, chainId> &
|
|
33
|
+
ConfigParameter<config> &
|
|
34
|
+
QueryParameter<
|
|
35
|
+
GetTransactionReceiptQueryFnData<config, chainId>,
|
|
36
|
+
GetTransactionReceiptErrorType,
|
|
37
|
+
selectData,
|
|
38
|
+
GetTransactionReceiptQueryKey<config, chainId>
|
|
39
|
+
>
|
|
40
|
+
>
|
|
41
|
+
>
|
|
42
|
+
|
|
43
|
+
export type UseTransactionReceiptReturnType<
|
|
44
|
+
config extends Config = Config,
|
|
45
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
46
|
+
selectData = GetTransactionReceiptData<config, chainId>,
|
|
47
|
+
> = UseQueryReturnType<selectData, GetTransactionReceiptErrorType>
|
|
48
|
+
|
|
49
|
+
/** https://wagmi.sh/vue/api/composables/useTransactionReceipt */
|
|
50
|
+
export function useTransactionReceipt<
|
|
51
|
+
config extends Config = ResolvedRegister['config'],
|
|
52
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
53
|
+
selectData = GetTransactionReceiptData<config, chainId>,
|
|
54
|
+
>(
|
|
55
|
+
parameters_: UseTransactionReceiptParameters<
|
|
56
|
+
config,
|
|
57
|
+
chainId,
|
|
58
|
+
selectData
|
|
59
|
+
> = {},
|
|
60
|
+
): UseTransactionReceiptReturnType<config, chainId, selectData> {
|
|
61
|
+
const parameters = computed(() => deepUnref(parameters_))
|
|
62
|
+
|
|
63
|
+
const config = useConfig(parameters)
|
|
64
|
+
const configChainId = useChainId({ config })
|
|
65
|
+
|
|
66
|
+
const queryOptions = computed(() => {
|
|
67
|
+
const { chainId = configChainId.value, hash, query = {} } = parameters.value
|
|
68
|
+
const options = getTransactionReceiptQueryOptions(config, {
|
|
69
|
+
...parameters.value,
|
|
70
|
+
chainId,
|
|
71
|
+
})
|
|
72
|
+
const enabled = Boolean(hash && (query.enabled ?? true))
|
|
73
|
+
return {
|
|
74
|
+
...(query as any),
|
|
75
|
+
...options,
|
|
76
|
+
enabled,
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
return useQuery(queryOptions) as UseTransactionReceiptReturnType<
|
|
81
|
+
config,
|
|
82
|
+
chainId,
|
|
83
|
+
selectData
|
|
84
|
+
>
|
|
85
|
+
}
|