Resolving a chain address (for example, a Bitcoin address) associated to a domain consist of 4 steps:
Obtain the identifier of the domain.
Get the domain’s resolver contract.
Detect if contract supports chainAddr(bytes32,bytes4)
interface via ERC-165 interface detection.
Use supportsInterface(bytes4)
with interface ID: 0x8be4b5f6
Query for address resolution.
Use chainAddr(bytes32,bytes4)
with the domain identifier and the chain hexa identifier
function getAddr(domain, chain) {
const node = namehash(domain)
const resolver = rns.resolver(node)
if (!resolver.supportsInterface('0x8be4b5f6'))
throw;
return resolver.chainAddr(node, chain);
}
Go to top