import { Abi, Address, ExtractAbiFunction } from 'abitype'; import { PopulatedTransaction } from 'ethers'; import { Signer } from '../../types'; import { DefaultOptions, GetConfig, GetOverridesForAbiStateMutability, Options as Options_ } from '../../types/contracts'; import { SendTransactionResult } from '../transactions'; declare type Options = Options_ & { isRequestOptional?: boolean; }; declare type Request = PopulatedTransaction & { to: Address; gasLimit: NonNullable; }; export declare type WriteContractPreparedArgs = { /** * `recklesslyUnprepared`: Allow to pass through unprepared config. Note: This has * [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks), * it is highly recommended to not use this and instead prepare the request upfront * using the {@link prepareWriteContract} function. * * `prepared`: The request has been prepared with parameters required for sending a transaction * via the {@link prepareWriteContract} function * */ mode: 'prepared'; args?: never; overrides?: never; } & (TOptions['isRequestOptional'] extends true ? { /** The prepared request. */ request?: Request; } : { /** The prepared request. */ request: Request; }); export declare type WriteContractUnpreparedArgs = { mode: 'recklesslyUnprepared'; request?: never; } & GetConfig<{ abi: TAbi; functionName: TFunctionName; /** Call overrides */ overrides?: GetOverridesForAbiStateMutability<[ TAbi, TFunctionName ] extends [ infer TAbi_ extends Abi, infer TFunctionName_ extends string ] ? ExtractAbiFunction['stateMutability'] : 'nonpayable' | 'payable'>; }, 'nonpayable' | 'payable', TOptions>; export declare type WriteContractArgs = Omit, 'args'> & (WriteContractUnpreparedArgs | WriteContractPreparedArgs); export declare type WriteContractResult = SendTransactionResult; /** * @description Function to call a contract write method. * * It is recommended to pair this with the {@link prepareWriteContract} function * to avoid [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks). * * @example * import { prepareWriteContract, writeContract } from '@wagmi/core' * * const config = await prepareWriteContract({ * address: '0x...', * abi: wagmiAbi, * functionName: 'mint', * }) * const result = await writeContract(config) */ export declare function writeContract({ address, args, chainId, abi, functionName, mode, overrides, request: request_, }: WriteContractArgs): Promise; export {};