Sonic Name Service (SNS) Snap Knowledge Base

Overview

The Sonic Name Service (SNS) Snap enables MetaMask users to resolve .s domain names on the Sonic blockchain (Chain ID: 146). It integrates with MetaMask to provide a seamless experience when sending transactions to human-readable domain names instead of long hexadecimal addresses.

Technical Specifications

  • Supported Chain: Sonic (Chain ID: 146)

  • Supported TLDs: .s

  • Contract Addresses:

    • Resolver: 0x90DB11399F3577BeFbF5B8E094BcaD35DA348Fc9

    • Registrar: 0xc50DBB6F0BAab19C6D0473B225f7F58e4a2d440b

    • Registry: 0x3D9D5ACc7dBACf1662Bc6D1ea8479F88B90b3cfb

  • NPM Package: [sonic_resolver]

Features

The SNS Snap provides the following functionality:

  1. Domain Resolution: Resolves .s domains to Ethereum addresses

  2. Integration with MetaMask Send Flow: Allows users to type .s domains in the recipient field

  3. RPC Methods for Developers:

    • reverseLookup: Get the SNS name for a given address

    • getTokenIdForName: Get the token ID for a given name

    • getNameForTokenId: Get the name for a given token ID

Installation Guide

Prerequisites

  • MetaMask (version 11.0 or higher)

Installation Steps

  1. Open MetaMask Snaps [https://snaps.metamask.io]

  2. Search for "Sonic Name Service"

  3. Click "Install"

  4. Review and approve the permissions

Required Permissions

  • Network Access: Needed to connect to the Sonic blockchain

  • Name Lookup: Needed to resolve .s domains

Usage Guide

Sending to a .s Domain

  1. Open MetaMask

  2. Click "Send"

  3. In the recipient field, type a .s domain (e.g., "example.s")

  4. MetaMask will resolve the domain to an address

  5. Enter the amount and complete the transaction

Verifying Domain Resolution

  1. When entering a .s domain, MetaMask will display the resolved address

  2. Always verify that the resolved address is correct before confirming any transaction

Developer Integration

Using SNS Snap in Your dApp

// Connect to the SNS Snap
async function connectToSNSSnap() {
  await window.ethereum.request({
    method: 'wallet_requestSnaps',
    params: {
      'npm:sonic_resolver': {}
    }
  });
}

// Resolve a domain name
async function resolveName(name) {
  // SNS Snap handles this automatically in MetaMask UI
  // This is for programmatic access
  const result = await window.ethereum.request({
    method: 'wallet_invokeSnap',
    params: {
      snapId: 'npm:sonic_resolver',
      request: {
        method: 'getTokenIdForName',
        params: { name }
      }
    }
  });
  return result;
}

// Perform a reverse lookup
async function reverseLookup(address) {
  const name = await window.ethereum.request({
    method: 'wallet_invokeSnap',
    params: {
      snapId: 'npm:sonic_resolver',
      request: {
        method: 'reverseLookup',
        params: { address }
      }
    }
  });
  return name;
}