Custom Resolvers
Overview
Custom resolvers allow you to implement specialized resolution logic and store additional data for domains.
Implementation Example
// Custom resolver with social media handles
contract SocialMediaResolver {
PNS pns;
mapping(bytes32 => string) twitter;
mapping(bytes32 => string) github;
constructor(PNS _pns) {
pns = _pns;
}
modifier onlyOwner(bytes32 node) {
require(pns.owner(node) == msg.sender);
_;
}
function setTwitter(bytes32 node, string calldata handle)
external
onlyOwner(node)
{
twitter[node] = handle;
}
function setGithub(bytes32 node, string calldata profile)
external
onlyOwner(node)
{
github[node] = profile;
}
}Deployment and Setup
Deploy Custom Resolver
Set Resolver for Domain
Configure Records
Last updated