Finding the resolver responsible for an unregistered ENS subname

An application looks up pay.team.eth directly in the ENS registry and gets no resolver. The parent namespace can still answer using wildcard resolution.

Locate the first configured resolver

For this simplified registry fixture, walk from the full name toward the root and select R-team. In a real lookup, test whether that resolver supports the extended resolution interface. Pass the full DNS-encoded name and the encoded record query to its resolve method. Asking the parent for its own address would instead return data about team.eth.

const records = new Map([["team.eth","R-team"],["eth","R-tld"]]);
let labels = "pay.team.eth".split(".");
while (labels.length && !records.has(labels.join("."))) labels.shift();
console.log(records.get(labels.join(".")));

Respect a nearer resolver that shadows its ancestors

If pay.team.eth has its own resolver, that resolver takes precedence. When the first resolver you find is an ancestor without extended support, the wildcard lookup cannot use it; continuing to a more distant wildcard server would bypass the nearer namespace boundary. Log both the queried name and the ancestor that supplied the resolver so missing support can be diagnosed.

docs.ens.domains ENSIP-10 wildcard resolution