Overview
The SNS SDK is a JavaScript/TypeScript library for integrating with Sonic Name Service, the decentralized domain name system for the Sonic blockchain.Key Features
Simple API
Unified interface for domain resolution and management
TypeScript Support
Full TypeScript support with comprehensive type definitions
Batch Operations
Resolve multiple domains efficiently in a single call
Error Handling
Detailed error handling with clear messages
- Built-in caching and retry mechanisms
- Support for address, content, and text records
Installation
Core Functionality
Resolution Methods
resolve()- Convert domain names to Ethereum addressesreverseResolve()- Convert addresses back to domain namesgetContent()- Retrieve content hashesgetText()- Get text records by key
Batch Operations
resolveBatch()- Resolve multiple domains simultaneouslyreverseResolveBatch()- Reverse resolve multiple addresses
Domain Management
isAvailable()- Check registration availabilitygetPrice()- Calculate registration costsregister()- Register new domainsrenew()- Extend domain registrations
Record Management
setAddress()- Update address recordssetText()- Set text records (email, social media, etc.)setContent()- Update content hashes
Utilities
getDomainInfo()- Retrieve comprehensive domain datavalidateDomain()- Validate domain names per SNS rules
Pricing Structure
Base Rates (per year)
| Domain Length | Price (S) |
|---|---|
| 3 characters | 15 S |
| 4 characters | 10 S |
| 5 characters | 7.5 S |
| 6+ characters | 5 S |
Multi-Year Discounts
| Years | Discount |
|---|---|
| 2 years | 5% |
| 3 years | 10% |
| 4 years | 15% |
| 5 years | 20% |