import type { InteroperableAddress, InteroperableAddressBinary, InteroperableAddressText } from "../types/interopAddress.js"; import type { ParsedInteropNameComponents } from "./parseInteropNameString.js"; import { Checksum, InteroperableName } from "../internal.js"; export interface ParsedInteroperableNameResult { name: ParsedInteropNameComponents; interoperableAddress: T; meta: { checksum?: Checksum; isENS: boolean; isChainLabel: boolean; checksumMismatch?: { provided: Checksum; calculated: Checksum; }; }; } /** * Parses an interoperable name (string or raw components) into an address * representation with checksum/ENS metadata. * * This function resolves ENS names and chain labels, preserving original values in the result. * The returned address uses the specified representation (defaults to "text"). * * @param input - Either an interoperable name string (e.g., "vitalik.eth@eip155:1") or parsed components from parseInteropNameString * @param opts - Parsing options * @param opts.representation - Representation to return: "binary" or "text" (defaults to "text") * @returns The parsed result with address in the specified representation and metadata * @throws An error if the parameters are invalid * @example * ```ts * // Get text representation (default) * const result = await parseName("vitalik.eth@eip155:1"); * * // Get binary representation * const result2 = await parseName("vitalik.eth@eip155:1", { representation: "binary" }); * ``` */ export interface ParseNameOptions { representation?: "binary" | "text"; /** Onchain ENS-based chain registry domain. Default: "on.eth". true = use "on.eth", false = skip onchain, string = custom domain. */ onchainRegistry?: string | boolean; /** Whether to fall back to offchain chainid.network registry. Default: true. */ offchainRegistryFallback?: boolean; /** Custom mainnet RPC URL for onchain registry lookups. */ rpcUrl?: string; /** * @deprecated Use `onchainRegistry` instead. Maps to `onchainRegistry` when set. */ useExperimentalChainRegistry?: string; } export declare function parseName(input: string | ParsedInteropNameComponents, opts: ParseNameOptions & { representation: "binary"; }): Promise>; export declare function parseName(input: string | ParsedInteropNameComponents, opts?: ParseNameOptions & { representation?: "text"; }): Promise>; /** * Formats an interoperable address into an interoperable name string. * * Accepts either binary or text representation and converts internally if needed. * Calculates the checksum automatically from the address. * * @param addr - Interoperable address (binary or text representation) * @param opts - Formatting options * @param opts.includeChecksum - Whether to include the checksum in the formatted name (defaults to true) * @returns The interoperable name string in the format: `${address}@${chainType}:${chainReference}#${checksum}` * @example * ```ts * // Format text representation (checksum included by default) * const textAddr = { version: 1, chainType: "eip155", chainReference: "1", address: "0x..." }; * const name = formatName(textAddr); * * // Format binary representation * const binaryAddr = decodeAddress("0x00010000010114d8da6bf26964af9d7eed9e03e53415D37aa96045", { representation: "binary" }); * const name2 = formatName(binaryAddr); * * // Format without checksum * const name3 = formatName(textAddr, { includeChecksum: false }); * ``` */ export declare const formatName: (addr: InteroperableAddress, opts?: { includeChecksum?: boolean; }) => InteroperableName; export { isValidChain, isValidChainType, isViemChainId } from "./isValidChain.js"; export { resolveAddress } from "./resolveENS.js"; export { resolveChain } from "./resolveChain.js"; export { resolveChainFromRegistry } from "./resolveChainFromRegistry.js"; export { getRegisteredChains } from "./getRegisteredChains.js"; export type { RegisteredChain, GetRegisteredChainsOptions } from "./getRegisteredChains.js"; export { shortnameToChainId } from "./shortnameToChainId.js"; //# sourceMappingURL=index.d.ts.map