Smart Contracts
Contracts
Resolvers
NameResolver

NameResolver

Git Source (opens in a new tab)

Inherits: INameResolver, BaseResolver

Author: Sam Ward (hodl.esf.eth)

NameResolver is a contract that allows users to set the domain name for their address

State Variables

nameMap

mapping(address => string) public nameMap;

Functions

name

function name(bytes32 node) external view returns (string memory);

setName

setName sets the domain linked to an address.

setName sets the domain value associated with a specific address. It uses msg.sender to get the address and then sets the value for that address.

function setName(string calldata _name) external;

Parameters

NameTypeDescription
_namestringThe domain name you wish to set. Can be TLD or SLD.

getName

getName records the value associated with a specific domain for an address.

getName gets the value associated with a specific domain for an address. This is validated that the address is correct and not invalid or changed

function getName(address _addr, uint256 _coinType) external view returns (string memory);

Parameters

NameTypeDescription
_addraddressThe address to query.
_coinTypeuint256The coin type to query.

getText

getText records the value associated with a specific key for an address.

getText records the value associated with a specific key for an address. This is validated that the address is correct and not invalid or changed

function getText(address _addr, string calldata _key, uint256 _coinType) external view returns (string memory);

Parameters

NameTypeDescription
_addraddressThe address to query.
_keystringThe key to query.
_coinTypeuint256The coin type to query.

getResolver

function getResolver(bytes32 node) private view returns (IResolver);

supportsInterface

function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool);