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

dns.getOffchainResolver

Reads the gasless DNS resolver a DNS name sets in an ENS1 TXT record. Options, result, errors and examples for dns.getOffchainResolver.

ReadBatchablestable
Since v1.0.0View source

Reads the gasless DNS resolver a DNS name sets in an ENS1 TXT record.

When to use

Use to check a gasless DNS setup, which resolves without importing the name.

Details

  • Reads the TXT records of the name itself through the DNSSEC gateway, without verifying them on-chain.
  • Picks the record the DNS TLD resolver uses: the first ENS1 <resolver> [context] record whose resolver is an address, or an ENS name with an address record. A record split into several strings (DNS splits values over 255 bytes) is read whole.
  • null when the name has no such record.

Signature

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

Call it as ens.dns.getOffchainResolver(options) on a client, or Actions.dns.getOffchainResolver(client, options).

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

Parameters

OptionTypeDefaultDescription
name (required)stringDNS name. Normalized automatically.
gatewayUrlsreadonly string[]DNSSEC gateways to use instead of the deployment's.

Also takes the read options.

Returns

Resolves to OffchainResolver | null. The resolver and context, or null.

FieldTypeDescription
resolverstringResolver address or ENS name the record points to.
contextstring | nullExtra data passed to the resolver, or null.

Errors

ErrorCodesWhen
InvalidInputErrorINVALID_NAMEnames that are not DNS names.
GatewayErrorGATEWAY_REQUEST_FAILED, GATEWAY_RESPONSE_INVALIDthe DNSSEC gateway fails.
UnsupportedErrorUNSUPPORTED_ON_DEPLOYMENTwithout a DNSSEC gateway or gatewayUrls.
NetworkErrorRPC_REQUEST_FAILED, RPC_TIMEOUT, RATE_LIMITEDthe RPC request fails.

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

See How errors work.

Examples

Reading a gasless DNS resolver
const offchain = await ens.dns.getOffchainResolver({ name: "example.com" })

See also

Was this page helpful?