# registration.getPrice

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

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

Source: https://ensforge.com/docs/reference/sdk/registration/get-price

<ApiMeta kind="Read" stability="stable" since="1.0.0" source="packages/sdk/src/actions/registration/getPrice/index.ts#L61" batchable />

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

## When to use [#when-to-use]

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

## Details [#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.

<Callout type="warn" title="Gotchas">
- The ENSv2 registrar is paid in ERC-20 only; there is no ETH price.
</Callout>

## Signature [#signature]

```ts
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](/docs/sdk/look-up-many-at-once).

In React, use [`useRegistrationPrice`](/docs/reference/react/use-registration-price).

## Parameters [#parameters]

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `name` (required) | `string` |  | `.eth` second-level name. Normalized automatically. |
| `duration` (required) | `bigint` |  | Registration length in seconds, e.g. `Duration.years(1)`. |
| `paymentToken` | `PaymentToken` | `"usdc"` | Token to pay with. |
| `at` | `bigint` | the current block's timestamp | Unix timestamp to price at, for the premium of a recently expired name. |

Also takes the [read options](/docs/reference/sdk/client#read-options).

## Returns [#returns]

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

| Field | Type | Description |
| --- | --- | --- |
| `base` | `bigint` |  |
| `premium` | `bigint` |  |
| `total` | `bigint` |  |
| `token` | `TokenInfo` |  |

## Errors [#errors]

| Error | Codes | When |
| --- | --- | --- |
| [`InvalidInputError`](/docs/reference/errors/invalid-input-error) | [`INVALID_NAME`](/docs/reference/errors/INVALID_NAME), [`INVALID_ADDRESS`](/docs/reference/errors/INVALID_ADDRESS), [`DURATION_TOO_SHORT`](/docs/reference/errors/DURATION_TOO_SHORT) | invalid input. |
| [`UnsupportedError`](/docs/reference/errors/unsupported-error) | [`PAYMENT_TOKEN_UNSUPPORTED`](/docs/reference/errors/PAYMENT_TOKEN_UNSUPPORTED), [`UNSUPPORTED_ON_DEPLOYMENT`](/docs/reference/errors/UNSUPPORTED_ON_DEPLOYMENT) | an unaccepted token or without ENSv2. |
| [`NetworkError`](/docs/reference/errors/network-error) | [`RPC_REQUEST_FAILED`](/docs/reference/errors/RPC_REQUEST_FAILED), [`RPC_TIMEOUT`](/docs/reference/errors/RPC_TIMEOUT), [`RATE_LIMITED`](/docs/reference/errors/RATE_LIMITED) | the RPC request fails. |

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

See [How errors work](/docs/sdk/errors-explained).

## Examples [#examples]

<Tabs groupId="api" items={["Client","Standalone","Effect"]} persist>
<Tab>
```ts title="Quoting one year"
import { Duration } from "@ensforge/sdk"

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

<Tab>
```ts title="Quoting in DAI with a standalone call"
import { Actions, Duration } from "@ensforge/sdk"

const price = await Actions.registration.getPrice(ens, { name: "alice.eth", duration: Duration.years(1), paymentToken: "dai" })
```
</Tab>

<Tab>
```ts title="Quoting in an Effect program"
import { Actions } from "@ensforge/sdk/effect"

const price = yield* Actions.registration.getPrice(ens, { name: "alice.eth", duration: 31536000n })
```
</Tab>
</Tabs>

## Example response [#example-response]

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

```ts
await ens.registration.getPrice({ name: "ensforge-example.eth", duration: 31_536_000n })
```

```json
{
  "base": "8000021n",
  "premium": "0n",
  "total": "8000021n",
  "token": {
    "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "symbol": "USDC",
    "decimals": 6
  }
}
```

## See also [#see-also]

- [`registration.register`](/docs/reference/sdk/registration/register) to register it