'use client' import { useMutation } from '@tanstack/react-query' import type { Config, ResolvedRegister, SendCallsErrorType } from '@wagmi/core' import type { Compute, ConfigParameter } from '@wagmi/core/internal' import { type SendCallsData, type SendCallsMutate, type SendCallsMutateAsync, type SendCallsOptions, type SendCallsVariables, sendCallsMutationOptions, } from '@wagmi/core/query' import type { UseMutationReturnType } from '../utils/query.js' import { useConfig } from './useConfig.js' export type UseSendCallsParameters< config extends Config = Config, context = unknown, > = Compute & SendCallsOptions> export type UseSendCallsReturnType< config extends Config = Config, context = unknown, > = Compute< UseMutationReturnType< SendCallsData, SendCallsErrorType, SendCallsVariables, context, SendCallsMutate, SendCallsMutateAsync > & { /** @deprecated use `mutate` instead */ sendCalls: SendCallsMutate /** @deprecated use `mutateAsync` instead */ sendCallsAsync: SendCallsMutateAsync } > /** https://wagmi.sh/react/api/hooks/useSendCalls */ export function useSendCalls< config extends Config = ResolvedRegister['config'], context = unknown, >( parameters: UseSendCallsParameters = {}, ): UseSendCallsReturnType { const config = useConfig(parameters) const options = sendCallsMutationOptions(config, parameters) const mutation = useMutation(options) type Return = UseSendCallsReturnType return { ...(mutation as Return), sendCalls: mutation.mutate as Return['mutate'], sendCallsAsync: mutation.mutateAsync as Return['mutateAsync'], } }