Skip to main content
OffchainSubnameForm lets users claim or update a gasless offchain subname under your parent name. The form checks availability, collects records, and, if the subname already exists, switches to update mode with its records prefilled. The form only reads from Namespace. It never creates or updates a subname itself. The subname exists once your onSubnameCreated or onSubnameUpdated callback saves it through your server. Without those callbacks, the form shows success and nothing is created.

Before you start

  • The parent name, a .eth name or a DNS name imported into ENS, must use the Namespace resolver. See Configure the resolver.
  • Get an API key for the parent. See Generate an API key.
  • Install the Offchain Manager SDK: npm install @thenamespace/offchain-manager.
Keep the API key on your server. It grants write access to every subname under the parent, so it must not ship in client code.

Render the form

In the browser, a client without an API key is enough for the form’s reads. Each callback sends the subname to your server, and the form shows an error if the callback throws.

Save the subname on your server

Check that the request is allowed, such as who may claim or edit which label, then write with a client that holds the API key:
app/api/subnames/route.ts
For the full SDK, see Offchain Manager.

Props

Callback data

ChainName comes from @thenamespace/offchain-manager, so the data matches what createSubname and updateSubname expect.