Skip to main content
This guide shows how to mint an onchain subname under an ENS name activated in the Namespace App. The Mint Manager SDK selects the correct mint contract for Ethereum or the parent listing’s L2 chain; your Viem clients submit the resulting transaction on that chain. The complete example uses Base. The SDK derives the chain from the parent listing, so the same code mints an Ethereum listing without change.

Prerequisites

  • Node.js 22 and npm
  • TypeScript experience
  • An ENS name activated and listed in the Namespace App
  • A wallet with enough native currency for the mint price and gas
  • An RPC endpoint for the chain on which you will mint
Use a dedicated development wallet and a testnet listing while testing. Never expose a wallet private key in browser code or commit it to source control.
1

1. Activate your ENS name

Before you can mint subnames, your parent ENS name must be activated on the Namespace platform. This is a prerequisite for all subname minting operations.

How to activate an ENS name

See the step-by-step guide on how to activate an ENS name.
2

2. Install the dependencies

Install the package versions used by this documentation:
3

3. Configure the clients

Add the RPC endpoint and private key to .env:
.env
Create the Mint Manager SDK client and Viem clients:
clients.ts
To use testnet listings and Namespace staging services, initialize the Mint Manager SDK with createMintClient({ isTestnet: true, mintSource: 'my-app' }) and configure Viem clients for the matching testnet chain.
4

4. Check the name

checkName answers both questions a mint needs in one call: is the name free, and may this wallet mint it. Pass the whole subname; the SDK normalizes it, resolves the listing, and works out the chain itself.
check.ts
The result is a discriminated union on status, so the price fields exist only on the available branch. See Check a name for every status and the full table of refusal reasons.
5

5. Generate transaction parameters

Pass the check result to prepareMint. The listing is already resolved, so nothing is fetched twice. Add optional text and address records to apply them in the same transaction as the mint:
transaction.ts
The SDK uses the parent listing to return the appropriate contract, ABI, arguments, and transaction value for Ethereum or the listing’s L2 chain.
6

6. Simulate and send the transaction

Simulate first so contract errors are surfaced before the wallet sends the transaction:
mint.ts
Wait for a receipt before showing the subname as confirmed in your product.

Troubleshooting

  • If checkName returns blocked, read reasons. A minter gate fails identically for every label, so prompt for a different wallet rather than a different name.
  • If it returns taken, choose another label; do not submit the transaction.
  • If a call throws RPC_ERROR, the name’s status is unknown rather than unavailable. Retry, and set customRpcUrls to your own endpoints.
  • If prepareMint throws PRICE_EXCEEDS_MAX, the price moved past your cap. Re-run checkName and confirm the new price before retrying.
  • If it throws SIGNATURE_EXPIRED, the authorization aged out. Call prepareMint again and submit promptly.
  • If simulation fails, confirm the wallet and public clients use the chain reported in check.chainId.
See Error handling for every code. See Troubleshooting for authentication, resolver, network, and transaction diagnostics.

Next steps

Mint Manager reference

Review every Mint Manager SDK method and response type.

Indexer Manager

Read indexed subname and registry data from L2 chains after minting.