Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

useAvailable

Check if a name is available for registration. Makes a live RPC call to RegistrarController.available().

Usage

import { useAvailable } from "@oniym/react";
 
function AvailabilityBadge({ name, tld }: { name: string; tld: string }) {
  const { data: available, isLoading } = useAvailable(name, tld);
 
  if (isLoading) return <span>Checking...</span>;
  return <span>{available ? "Available" : "Taken"}</span>;
}

Parameters

ParameterTypeDescription
namestring | undefinedLabel only (e.g. "alice"). Query disabled when undefined.
tldstring | undefinedTLD label (e.g. "web3"). Query disabled when undefined.

Returns

UseQueryResult<boolean>

Query key

["oniym", "available", name, tld]

Stale time is 10 seconds (shorter than other queries since availability can change quickly).