import type { Chain, GetChainContractAddressErrorType, ReadContractErrorType } from 'viem'; import type { RequireClientContracts } from '../../../clients/chain.js'; import { UnsupportedNameTypeError } from '../../../errors/general.js'; import type { ErrorType } from '../../../errors/utils.js'; export type GetAvailableParameters = { /** * Name to check availability for. Only `.eth` names are supported: * - `eth-2ld` names (e.g. `name.eth`) * - `eth-subname` names of any depth (e.g. `sub.name.eth`) * * DNS names are not supported (they have both on-chain and off-chain * import paths, so a single availability answer would be ambiguous). */ name: string; }; export type GetAvailableReturnType = boolean; export type GetAvailableErrorType = UnsupportedNameTypeError | ReadContractErrorType | GetChainContractAddressErrorType | ErrorType; /** * Gets the availability of a `.eth` name to register. * * For `eth-2ld` names, availability is read from the `.eth` registrar via * `isAvailable`, which accounts for grace periods and premium decay. * * For `eth-subname` names, the UniversalHelper's `findParentRegistry` * is used to traverse the registry tree and locate the parent registry, then * the leaf label's status is checked against it. * * @param client - {@link Client} * @param parameters - {@link GetAvailableParameters} * @returns Availability as boolean. {@link GetAvailableReturnType} * * @example * import { createPublicClient, http } from 'viem' * import { sepolia } from 'viem/chains' * import { addEnsContracts } from '@ensdomains/ensjs' * import { getAvailable } from '@ensdomains/ensjs/public' * * const client = createPublicClient({ * chain: addEnsContracts(sepolia), * transport: http(), * }) * * // eth-2ld via the .eth registrar * const a = await getAvailable(client, { name: 'ens.eth' }) * // false * * // eth-subname with auto-traversal via the UniversalHelper * const b = await getAvailable(client, { name: 'sub.ens.eth' }) */ export declare function getAvailable(client: RequireClientContracts, { name }: GetAvailableParameters): Promise; //# sourceMappingURL=getAvailable.d.ts.map