Ping Name Service (PNS)
const signature = await agent.methods.registerDomain(
"mydomain", // Domain name (without .sol)
1 // Space in KB (optional)
);Use Case
Recommended Space
Last updated
const signature = await agent.methods.registerDomain(
"mydomain", // Domain name (without .sol)
1 // Space in KB (optional)
);Last updated
const address = await agent.methods.resolveSolDomain("mydomain.sol");
console.log("Owner:", address.toString());const domain = await agent.methods.getPrimaryDomain(
new PublicKey("owner-address")
);const domains = await agent.methods.getAllRegisteredAllDomains();
console.log("Registered domains:", domains);"Register mydomain.sol with 2KB storage"
"Look up the owner of vitalik.sol"
"Get the primary domain for this wallet"
"Find all registered .sol domains"{
"name": "mydomain",
"spaceKB": 2
}{
"domain": "vitalik.sol"
}interface RegistrationParams {
name: string; // Domain name
spaceKB?: number; // Storage space (max 10KB)
}
// Features
- Automatic USDC payment
- Space validation
- Transaction bundling
- Associated token handlinginterface ResolutionParams {
domain: string; // Domain to resolve
}
// Features
- .sol suffix handling
- Error recovery
- Stale check
- Multi-TLD supportinterface PrimaryDomainResponse {
reverse: string; // Domain name
stale: boolean; // Staleness status
}
// Features
- Staleness check
- Error handling
- Reverse lookuptry {
const result = await agent.methods.registerDomain("mydomain");
} catch (error) {
if (error.message.includes("Maximum domain size")) {
// Handle size limit exceeded
} else if (error.message.includes("insufficient funds")) {
// Handle payment issues
}
}{
status: "success",
message: "Domain registered successfully",
transaction: "5UfgJ5vVZxUx...",
domain: "mydomain.sol",
spaceKB: 1
}{
status: "success",
message: "Domain resolved successfully",
publicKey: "7nxQB..."
}