Skip to main content
prepareMint returns the contract address, ABI, arguments, and value required to mint a subname. Submit the result with viem, ethers, or wagmi; the SDK never holds a key and never sends a transaction.

Usage

Pass a checkName result. The listing is already resolved, so nothing is fetched twice:
mint.ts
You can also pass a bare name when you already know it is mintable. That path resolves the listing again:

PrepareMintOptions

MintTransactionResponse

value is already wei as a bigint. Pass it through untouched.

Submit the transaction

Simulate before you write. The simulation runs the call against current chain state and returns a revert reason without spending gas.
submit.ts
Signed mint parameters are short lived, so submit promptly rather than caching the result. A stale one throws SIGNATURE_EXPIRED.

Cap the price with maxValue

The mint API returns a signed price that the contract will honor. The SDK checks that the signature covers the name, parent, and owner you requested, and rejects the response otherwise. maxValue is the cap on what you will pay. Prices are quoted per request and can move between your quote and your signature. With maxValue set, a higher price throws PRICE_EXCEEDS_MAX and nothing is submitted. Without it, the contract charges the new price. The wallet confirmation is the first time the user sees that number.

Set records at mint time

Records are encoded into resolver calldata and written in the same transaction as the mint. The name is registered with those records already set.
texts, addresses, and contenthash are each optional. An unknown chain name or a malformed address throws rather than being skipped, so you cannot pay for a mint and silently receive a name with no records on it. ContenthashType supports Ipfs, Ipns, Onion, Swarm, Arweave, and Skynet. Reference the enum members rather than their string values; the members are the stable API.

Lower-level alternative

getMintTransactionParameters does the same work from a pre-split label and parentName, and prepareMint calls it internally. Use it when you already have the parts separately: