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 Ethereum variation is included in Check availability.

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 availability

For a listing on an L2 chain, pass the target chain ID:
availability.ts
For a listing on Ethereum, use isL1SubnameAvailable instead:
5

5. Check eligibility and price

getMintDetails reports whether the wallet can mint and returns the estimated price and fee:
quote.ts
6

6. Generate transaction parameters

Add optional text and address records while preparing the transaction:
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.
7

7. 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 canMint is false, display or log validationErrors.
  • If simulation fails, confirm the wallet and public clients use the listing’s chain.
  • If the mint price changed, generate fresh transaction parameters before retrying.
  • If the subname is unavailable, choose another label; do not submit the transaction.
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.