// packages/dapp-kit/src/hooks/shared/useEstimateGas.ts import type { EstimateGasParams, GetEstimateGasReturnType, SpokeChainKey } from '@sodax/sdk'; import { useSodaxContext } from './useSodaxContext.js'; import type { MutationHookParams } from './types.js'; import { useSafeMutation, type SafeUseMutationResult } from './useSafeMutation.js'; import { unwrapResult } from './unwrapResult.js'; export function useEstimateGas({ mutationOptions, }: MutationHookParams, EstimateGasParams> = {}): SafeUseMutationResult< GetEstimateGasReturnType, Error, EstimateGasParams > { const { sodax } = useSodaxContext(); return useSafeMutation, Error, EstimateGasParams>({ mutationKey: ['shared', 'estimateGas'], ...mutationOptions, mutationFn: async params => unwrapResult(await sodax.spoke.estimateGas(params)), }); }