resolver.getLink
Reads which record set an ENS name uses on its PermissionedResolver. Parameters, return value, errors and examples for resolver.getLink in @ensforge/sdk.
Reads which record set an ENS name uses on its PermissionedResolver.
When to use
Use to tell whether names share records: linked names have the same recordId on the same
resolver.
Details
- Every name gets its own record ID on its first write;
resolver.linkpoints a name at another name's record ID. - Returns
nullwhen the name has no records on the resolver yet, unlessstrictis set.
Signature
function getLink(client: Like, options: getLink.Options): Promise<getLink.ReturnType>Call it as ens.resolver.getLink(options) on a client, or Actions.resolver.getLink(client, options).
resolver.getLink.request(options) builds a deferred read for Actions.batch. See Look up many at once.
Parameters
| Option | Type | Default | Description |
|---|---|---|---|
name (required) | string | ENS name to read. Normalized automatically. |
Also takes the read options.
Returns
Resolves to { readonly resolver: Address; readonly recordId: bigint } | null. The resolver and the name's record ID, or null when it has no records there.
| Field | Type | Description |
|---|---|---|
resolver | Address | |
recordId | bigint |
Errors
| Error | Codes | When |
|---|---|---|
InvalidInputError | INVALID_NAME | the name cannot be normalized. |
NotFoundError | RESOLVER_NOT_FOUND, RECORD_NOT_FOUND | without a resolver, or with strict and no records. |
UnsupportedError | RESOLVER_PROFILE_UNSUPPORTED | the resolver is not a PermissionedResolver. |
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 [a, b] = await Promise.all([
ens.resolver.getLink({ name: "alice.eth" }),
ens.resolver.getLink({ name: "alice-main.eth" }),
])
const shared = a !== null && b !== null && a.resolver === b.resolver && a.recordId === b.recordIdExample response
Recorded from Ethereum mainnet on 2026-11-18 at block 26443964. Values change as the chain does.
await ens.resolver.getLink({ name: "nick.eth" }){
"resolver": "0xF4f1007EA430848F2fAd60e405A54Fc100fEc341",
"recordId": "3n"
}See also
resolver.linkto link names
Was this page helpful?