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

permission.setRecordAccess

Lets another account edit a name's records, or takes that access back. Options, result, errors and examples for permission.setRecordAccess.

Writestable
Since v1.0.0View source

Lets another account edit a name's records, or takes that access back. Resolves once the transaction is submitted.

When to use

Use to let a teammate, bot or app manage some or all of a profile. Use setRecordAccessSync to wait for the receipt.

Details

  • PermissionedResolver: exact setter roles per record (one text key, coin, data key, ABI content type or interface), or every setter role with records: "all".
  • Public resolvers: a per-name delegate, which can edit every record of the name.
  • revoke takes the same access back.

Gotchas

  • PermissionedResolver roles cover every name on that resolver. Names share a resolver with resolver: "parent"; give names their own resolver to keep access per name.
  • Delegates and "all" need allowScopeWidening: true.

Signature

function setRecordAccess(
  client: Like,
  options: setRecordAccess.Options & Write.Options,
): Promise<setRecordAccess.ReturnType>

Call it as ens.permission.setRecordAccess(options) on a client, or Actions.permission.setRecordAccess(client, options).

Parameters

OptionTypeDefaultDescription
name (required)stringENS name. Normalized automatically.
grantee (required)stringAccount that gets (or loses) access.
recordsSelection | "all""all"Records in the record.get selection shape, or "all".
allowScopeWideningbooleanConfirm grants wider than the listed records (delegates, "all").
revokebooleanTake the access back.

Also takes the write options.

Returns

Resolves to Write.Result. Submitted transaction hashes and the plan that produced them.

FieldTypeDescription
hashHexHash of the last transaction.
hashesreadonly Hex[]Every submitted transaction, in order.
idstringEIP-5792 bundle id when the calls were sent as one batch.
planPlanThe plan the write executed: its steps, in order, as they were submitted.

Errors

ErrorCodesWhen
InvalidInputErrorINVALID_NAME, INVALID_ADDRESS, INVALID_RECORD_VALUEinvalid input or an unconfirmed widening.
NotFoundErrorRESOLVER_NOT_FOUNDthe name has no resolver.
UnsupportedErrorRESOLVER_PROFILE_UNSUPPORTEDpublic keys on a PermissionedResolver.
UnauthorizedErrorCANNOT_GRANT_ROLES, NOT_OWNERthe account may not grant access.
UserRejectedErrorUSER_REJECTEDthe user rejects the request.
WalletErrorCHAIN_MISMATCH, ACCOUNT_NOT_FOUNDthe wallet is on another chain or has no account to sign with.
UnsupportedErrorWALLET_BATCH_UNSUPPORTEDwith 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

Letting an app edit a text record
const { hash } = await ens.permission.setRecordAccess({ name: "alice.eth", grantee: "0xB0b0000000000000000000000000000000000000", records: { texts: ["url"] } })

Plan methods

Each method takes the same options as permission.setRecordAccess and sends nothing. See Preview before sending.

MethodDescription
permission.setRecordAccess.prepare(options)Builds the plan without sending anything.
permission.setRecordAccess.simulate(options)Simulates the plan with eth_call, reporting each step.
permission.setRecordAccess.estimateGas(options)Estimates the gas and ETH the plan needs.

Wait for the receipt with setRecordAccessSync

Lets another account edit a name's records, or takes that access back. Resolves once the receipt is in.

Use when the next step depends on the change being on-chain.

permission.setRecordAccessSync takes the same options plus confirmations and timeout.

Resolves to Write.SyncResult. Receipts plus the submitted hashes and plan.

Letting an app edit a text record and waiting
const { receipt } = await ens.permission.setRecordAccessSync({ name: "alice.eth", grantee: "0xB0b0000000000000000000000000000000000000", records: { texts: ["url"] } })

See also

Was this page helpful?