dns.getOffchainResolver
Reads the gasless DNS resolver a DNS name sets in an ENS1 TXT record. Options, result, errors and examples for dns.getOffchainResolver.
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. nullwhen 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
| Option | Type | Default | Description |
|---|---|---|---|
name (required) | string | DNS name. Normalized automatically. | |
gatewayUrls | readonly 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.
| Field | Type | Description |
|---|---|---|
resolver | string | Resolver address or ENS name the record points to. |
context | string | null | Extra data passed to the resolver, or null. |
Errors
| Error | Codes | When |
|---|---|---|
InvalidInputError | INVALID_NAME | names that are not DNS names. |
GatewayError | GATEWAY_REQUEST_FAILED, GATEWAY_RESPONSE_INVALID | the DNSSEC gateway fails. |
UnsupportedError | UNSUPPORTED_ON_DEPLOYMENT | without a DNSSEC gateway or gatewayUrls. |
NetworkError | RPC_REQUEST_FAILED, RPC_TIMEOUT, 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.
Examples
const offchain = await ens.dns.getOffchainResolver({ name: "example.com" })See also
record.getto resolve its records
Was this page helpful?