import type { Account, Chain, GetChainContractAddressErrorType, Hash, WriteContractErrorType } from 'viem'; import type { ChainWithContracts, RequireClientContracts } from '../../../clients/chain.js'; import { UnsupportedNameTypeError } from '../../../errors/general.js'; import type { Prettify, WriteTransactionParameters } from '../../../types/index.js'; import { type ClientWithOverridesErrorType } from '../../../utils/clientWithOverrides.js'; import { type L2RegistrationParameters, type MakeL2CommitmentErrorType } from '../../../utils/registrar/registerHelpers.js'; import { type WrappedLabelLengthCheckErrorType } from '../../../utils/v1/nameWrapper/wrapper.js'; export type CommitNameWriteParametersParameters = L2RegistrationParameters; export type CommitNameWriteParametersReturnType = ReturnType>; export type CommitNameWriteParametersErrorType = UnsupportedNameTypeError | WrappedLabelLengthCheckErrorType | GetChainContractAddressErrorType | MakeL2CommitmentErrorType; export declare const commitNameWriteParameters: (client: RequireClientContracts, args: CommitNameWriteParametersParameters) => { readonly address: `0x${string}`; readonly abi: readonly [{ readonly inputs: readonly [{ readonly name: "commitment"; readonly type: "bytes32"; }, { readonly name: "validFrom"; readonly type: "uint64"; }, { readonly name: "blockTimestamp"; readonly type: "uint64"; }]; readonly name: "CommitmentTooNew"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "commitment"; readonly type: "bytes32"; }, { readonly name: "validTo"; readonly type: "uint64"; }, { readonly name: "blockTimestamp"; readonly type: "uint64"; }]; readonly name: "CommitmentTooOld"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "duration"; readonly type: "uint64"; }, { readonly name: "minDuration"; readonly type: "uint64"; }]; readonly name: "DurationTooShort"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "InvalidOwner"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "MaxCommitmentAgeTooLow"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "label"; readonly type: "string"; }]; readonly name: "NameNotAvailable"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "label"; readonly type: "string"; }]; readonly name: "NameNotRenewable"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "label"; readonly type: "string"; }]; readonly name: "NotValid"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "paymentToken"; readonly type: "address"; }]; readonly name: "PaymentTokenNotSupported"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "token"; readonly type: "address"; }]; readonly name: "SafeERC20FailedOperation"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "commitment"; readonly type: "bytes32"; }]; readonly name: "UnexpiredCommitmentExists"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "commitment"; readonly type: "bytes32"; }]; readonly name: "commit"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }]; readonly functionName: "commit"; readonly args: readonly [`0x${string}`]; readonly chain: Omit & { contracts: { ensEthRegistrar: import("viem").ChainContract; }; } & { blockExplorers?: { [key: string]: { name: string; url: string; apiUrl?: string | undefined; }; default: { name: string; url: string; apiUrl?: string | undefined; }; } | undefined; blockTime?: number | undefined; contracts?: import("viem").Prettify<{ [key: string]: import("viem").ChainContract | { [sourceId: number]: import("viem").ChainContract | undefined; } | undefined; } & { ensRegistry?: import("viem").ChainContract | undefined; ensUniversalResolver?: import("viem").ChainContract | undefined; multicall3?: import("viem").ChainContract | undefined; erc6492Verifier?: import("viem").ChainContract | undefined; }> | undefined; ensTlds?: readonly string[] | undefined; id: number; name: string; nativeCurrency: { name: string; symbol: string; decimals: number; }; experimental_preconfirmationTime?: number | undefined; rpcUrls: { [key: string]: { http: readonly string[]; webSocket?: readonly string[] | undefined; }; default: { http: readonly string[]; webSocket?: readonly string[] | undefined; }; }; sourceId?: number | undefined; supportsTransactionReplacementDetection?: boolean | undefined; testnet?: boolean | undefined; } & import("viem").ChainConfig | undefined>; readonly account: Account; }; export type CommitNameParameters | undefined> = Prettify>; export type CommitNameReturnType = Hash; export type CommitNameErrorType = CommitNameWriteParametersErrorType | ClientWithOverridesErrorType | WriteContractErrorType; /** * Commits a name to be registered * @param client - {@link Client} * @param options - {@link CommitNameOptions} * @returns Transaction hash. {@link CommitNameReturnType} * * @example * import { createWalletClient, custom } from 'viem' * import { sepolia } from 'viem/chains' * import { addEnsContracts } from '@ensdomains/ensjs' * import { commitName } from '@ensdomains/ensjs/wallet' * import { randomSecret } from '@ensdomains/ensjs/utils' * * const [account] = await window.ethereum.request({ method: 'eth_requestAccounts' }) * const wallet = createWalletClient({ * account, * chain: addEnsContracts(sepolia), * transport: custom(window.ethereum), * }) * const secret = randomSecret() * const hash = await commitName(wallet, { * label: 'example', * owner: account, * duration: 31536000, // 1 year * secret, * }) * // 0x... */ export declare function commitName | undefined>(client: RequireClientContracts, { label, owner, duration, secret, resolverAddress, subregistryAddress, referrer, ...txArgs }: CommitNameParameters): Promise; //# sourceMappingURL=commitName.d.ts.map