Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Skip to Content
ensforgeSDK

registration.getPrice

Quotes the price of registering a .eth name, in an ERC-20 payment token. Options, result, errors and examples for registration.getPrice.

ReadBatchablestable
Since v1.0.0View source

Quotes the price of registering a .eth name, in an ERC-20 payment token.

When to use

Use to show the cost before registering, or to see how a recently expired name's premium falls over time.

Details

  • base is the yearly rent for the label length times the duration; premium is charged for names that recently became available and decays to zero.
  • Amounts are in the token's smallest unit (USDC has 6 decimals); token gives its symbol and decimals.
  • at prices the name at a future timestamp, e.g. to show when the premium ends.

Gotchas

  • The ENSv2 registrar is paid in ERC-20 only; there is no ETH price.

Signature

function getPrice(client: Like, options: getPrice.Options): Promise<getPrice.ReturnType>

Call it as ens.registration.getPrice(options) on a client, or Actions.registration.getPrice(client, options).

registration.getPrice.request(options) builds a deferred read for Actions.batch. See Look up many at once.

In React, use useRegistrationPrice.

Parameters

OptionTypeDefaultDescription
name (required)string.eth second-level name. Normalized automatically.
duration (required)bigintRegistration length in seconds, e.g. Duration.years(1).
paymentTokenPaymentToken"usdc"Token to pay with.
atbigintthe current block's timestampUnix timestamp to price at, for the premium of a recently expired name.

Also takes the read options.

Returns

Resolves to getPrice.ReturnType. Rent, premium and their total, in token units.

FieldTypeDescription
basebigint
premiumbigint
totalbigint
tokenTokenInfo

Errors

It can also fail with the errors every read can (Errors.CommonError: ConfigError, ContractRevertError, InternalError, NetworkError).

See How errors work.

Examples

Quoting one year
import { Duration } from "@ensforge/sdk"

const { total, token } = await ens.registration.getPrice({ name: "alice.eth", duration: Duration.years(1) })

Example response

Recorded from Ethereum mainnet on 2026-11-18 at block 26443964. Values change as the chain does.

await ens.registration.getPrice({ name: "ensforge-example.eth", duration: 31_536_000n })
{
  "base": "8000021n",
  "premium": "0n",
  "total": "8000021n",
  "token": {
    "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "symbol": "USDC",
    "decimals": 6
  }
}

See also

Was this page helpful?