Skip to main content
checkName reports whether this address can mint this name. If it cannot, the result says why. Pass the whole subname. The SDK normalizes it, splits it, resolves the listing, and picks the chain.

Usage

The result is a discriminated union on status. Narrow on it before reading anything else; the price fields exist only on the available branch, so TypeScript stops you reading a quote that was never returned.
Every result also carries name (the normalized form), label, parentName, listingType, and chainId. The chain comes from the listing, so you never supply it.

NameCheck

Why a mint is refused

The entries in reasons are not interchangeable. Your app should check two things. Is the obstacle the name or the minter? Would a different label help? Mixing those up sends someone back to the name field when the problem is their wallet. Validation stops at the first failure, so reasons is a partial list. Clearing one reason can reveal another. Re-run checkName after the user acts rather than assuming the rest are unchanged.
A reserved name is held back, not minted, so the registry reports it as free. That is why checkName consults the registry before it decides between taken and blocked.

When the registry is consulted

getMintDetails stops validating at the first failure. On a gated listing it never evaluates the name at all, so a free name and a taken name come back identical:
checkName reconciles the API with the registry, and reads the registry exactly when that ambiguity appears. Override with the rpc option:

Mint from the result

prepareMint takes the check result and returns the contract call. The listing is already cached, so nothing is fetched twice.
Passing a result whose status is not available throws NAME_NOT_AVAILABLE, and the error message carries the advice that matches the reason. You can also pass a bare name when you already know it is mintable:
See Transaction parameters for the response shape, maxValue, and setting records at mint time.
A failed registry lookup throws RPC_ERROR. That is not an answer about the name: the status is unknown, not unavailable. Surface it as a temporary failure with a retry. See Error handling.