registry.deploy
Deploys an ENSv2 UserRegistry, optionally attaching it as a name's subregistry. Options, result, errors and examples for registry.deploy.
Deploys an ENSv2 UserRegistry, optionally attaching it as a name's subregistry. Resolves once the transaction is submitted.
When to use
Use to set up the registry for a name's children ahead of time, or with custom roles. Use deploySync to wait for the receipt.
Details
- A verifiable proxy of the deployment's UserRegistry, at an address known before sending
(
plan.deploys, returned asregistry). owner(the signer by default) gets every root role;emancipatedwithholds the roles that would let owners take children back.attachTomakes it that name's subregistry in the same plan.
Signature
function deploy(
client: Like,
options: deploy.Options & Write.Options,
): Promise<deploy.ReturnType>Call it as ens.registry.deploy(options) on a client, or Actions.registry.deploy(client, options).
Parameters
| Option | Type | Default | Description |
|---|---|---|---|
owner | string | the signing account | Account that gets the root roles. |
grants | readonly { account: string; roles: readonly Role.Name[] | bigint }[] | Extra root role grants, by role name or bitmap. | |
emancipated | boolean | Withhold the roles that would let the owners take children back. | |
attachTo | string | ENSv2 name to attach it to as subregistry. Normalized automatically. | |
salt | bigint | a random salt | CREATE2 salt; together with the account it decides the address. |
Also takes the write options.
Returns
Resolves to Write.Result & { readonly registry: Address }. Submitted hashes, the plan and the new registry's address.
Errors
| Error | Codes | When |
|---|---|---|
InvalidInputError | INVALID_NAME, INVALID_ADDRESS, INVALID_ROLES | invalid input. |
UnsupportedError | UNSUPPORTED_ON_DEPLOYMENT, UNSUPPORTED_PROTOCOL | without ENSv2, or for an ENSv1 attachTo. |
UnauthorizedError | MISSING_ROLES | the account may not set the name's subregistry. |
ConfigError | WALLET_NOT_CONFIGURED | no signing account is known. |
UserRejectedError | USER_REJECTED | the user rejects the request. |
WalletError | CHAIN_MISMATCH, ACCOUNT_NOT_FOUND | the wallet is on another chain or has no account to sign with. |
UnsupportedError | WALLET_BATCH_UNSUPPORTED | with mode: "batch" or a paymaster when the wallet cannot send calls as one batch. |
It can also fail with the errors every write can (Errors.WriteError: the common errors plus InsufficientFundsError, TransactionError, UnsupportedError, UserRejectedError, WalletError).
See How errors work.
Examples
const { registry } = await ens.registry.deploy({ attachTo: "alice.eth" })Plan methods
Each method takes the same options as registry.deploy and sends nothing. See Preview before sending.
| Method | Description |
|---|---|
registry.deploy.prepare(options) | Builds the plan without sending anything. |
registry.deploy.simulate(options) | Simulates the plan with eth_call, reporting each step. |
registry.deploy.estimateGas(options) | Estimates the gas and ETH the plan needs. |
Wait for the receipt with deploySync
Deploys an ENSv2 UserRegistry, optionally attaching it as a name's subregistry. Resolves once the receipt is in.
Use when the next step depends on the change being on-chain.
registry.deploySync takes the same options plus confirmations and timeout.
Resolves to Write.SyncResult & { readonly registry: Address }. Receipts, hashes, the plan and the new registry's address.
const { receipt } = await ens.registry.deploySync({ attachTo: "alice.eth" })See also
registry.getto inspect it
Was this page helpful?