Deep Mind AI
  • Introduction
  • Examples
    • Getting Started with NextJS
    • Telegram Agent
    • Persistent Agent with PostgreSQL
    • AI Guided Market Making Agent
    • Discord Agent Integration
  • Guides
    • Add your own tool
    • Setup locally
    • Test it out
  • Features
    • Transfer Tokens
    • Stake SOL
    • Deploy SPL Token
    • Check Token Balances
    • Token Data Retrieval
    • Deploy NFT Collection
    • Mint NFT
    • Tensor NFT Marketplace
    • Jupiter Exchange Swaps
    • Solana Name Service (SNS)
    • Launch Token on Pump.fun
Powered by GitBook
On this page
  • ​Core Features
  • ​Usage
  • ​Example Prompts
  • ​Implementation Details
  • ​Error Handling
  • ​Best Practices
  • ​Common Issues
  • ​Response Formats
  • ​Space Allocation Guide
  • ​Related Functions
  • ​Notes
  1. Features

Solana Name Service (SNS)

Register and manage your .SOL domains using SNS

PreviousJupiter Exchange SwapsNextLaunch Token on Pump.fun

Last updated 3 months ago

Register, resolve, and manage .SOL domains using the Solana Name Service. The documentation includes domain name registrations, resolution, and management functions.

Core Features

  1. Domain Management

    • Register new domains

    • Resolve domains to addresses

    • Get primary domains

    • List registered domains

  2. Domain Operations

    • Custom space allocation

    • Domain resolution

    • Multi-TLD support

    • Primary domain lookup

Usage

Register Domain

const signature = await agent.registerDomain(
  "mydomain",     // Domain name (without .sol)
  1               // Space in KB (optional)
);
const address = await agent.resolveSolDomain("mydomain.sol");
console.log("Owner:", address.toString());
const domain = await agent.getPrimaryDomain(
  new PublicKey("owner-address")
);
const domains = await agent.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 handling
interface ResolutionParams {
  domain: string;    // Domain to resolve
}

// Features
- .sol suffix handling
- Error recovery
- Stale check
- Multi-TLD support
interface PrimaryDomainResponse {
  reverse: string;    // Domain name
  stale: boolean;     // Staleness status
}

// Features
- Staleness check
- Error handling
- Reverse lookup
try {
  const result = await agent.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
  }
}
  1. Domain Registration

    • Choose appropriate space

    • Verify domain availability

    • Check USDC balance

    • Plan for renewals

  2. Domain Resolution

    • Handle missing domains

    • Check staleness

    • Implement caching

    • Validate inputs

  3. Domain Management

    • Monitor expiration

    • Update records

    • Backup settings

    • Regular validation

  4. Performance

    • Cache resolutions

    • Batch operations

    • Handle timeouts

    • Monitor errors

  1. Registration

    • Insufficient USDC

    • Name taken

    • Invalid characters

    • Space limits

  2. Resolution

    • Stale records

    • Invalid domains

    • Missing records

    • Network issues

  3. Management

    • Expired domains

    • Update failures

    • Permission issues

    • Sync problems

{
  status: "success",
  message: "Domain registered successfully",
  transaction: "5UfgJ5vVZxUx...",
  domain: "mydomain.sol",
  spaceKB: 1
}
{
  status: "success",
  message: "Domain resolved successfully",
  publicKey: "7nxQB..."
}
Use Case
Recommended Space

Basic Domain

1KB

With Records

2KB

Full Profile

5KB

Maximum

10KB

  • getBalance: Check USDC balance

  • transfer: Transfer domains

  • createAssociatedTokenAccount: Setup USDC

  • getAllDomainsTLDs: List available TLDs

  1. Registration Cost

    • Based on name length

    • Space allocation fee

    • USDC payment required

    • Renewal considerations

  2. Resolution Process

    • Caching recommended

    • Handle timeouts

    • Validate responses

    • Multiple attempts

  3. Management Tips

    • Regular validation

    • Backup records

    • Monitor expiration

    • Update settings

Resolve Domain

Get Primary Domain

List All Domains

Example Prompts

Natural Language Prompts

LangChain Tool Prompts

Register Domain

Resolve Domain

Implementation Details

Domain Registration

Domain Resolution

Primary Domain

Error Handling

Best Practices

Common Issues

Response Formats

Registration Response

Resolution Response

Space Allocation Guide

Related Functions

Notes

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​