Register your custom domain on the Sui Name System using @mysten/suins.

Usage

// Register Suins
const result = await agent.registerSns("yourname", 1, "SUI");

Parameters

ParameterTypeRequiredDescription
namestringYesThe name to be registered
yearsnumberYesNumber of years to register
payTokenstringYesThe token used for registration (SUI, NS, USDC)

Example Prompts

Natural Language Prompts

// with or without the .sui suffix
"Register the domain name mydomain for 1 year"

LangChain Tool Prompts

// Register domain 1 year
{
 "name": "mydomain",
 "years": 1,
 "payToken": "SUI"
}

Example Implementation

import { SuiAgentKit } from "@getnimbus/sui-agent-kit";

async function registerSns(agent: SuiAgentKit) {
  try {
    const result = await agent.registerSns("mydomain", 1, "SUI");
    console.log("Register successful:", result);
  } catch (error) {
    console.error("Register failed:", error);
  }
}

Implementation Details

  • Registers via mysten/suins
  • Holds the new NFT domain in the generated wallet
  • Transfers the domain from the generated wallet to yours

Response Format

// Successful response
{
  tx_hash: "DHGKz1EZDnDHbiRC2P3dZd7xuLnfGdncDaBvaExyTAfM",
  tx_status: "success",
}

// Error response
{
  tx_hash: "DHGKz1EZDnDHbiRC2P3dZd7xuLnfGdncDaBvaExyTAfM",
  tx_status: "failed",
}

Error Handling

try {
  const result = await agent.registerSns("mydomain", 1, "SUI");
} catch (error) {
  if (error.message.includes("Insufficient balance")) {
    // Handle insufficient balance
  } else {
    // Handle other transaction failures
  }
}

Best Practices

  1. Check domain is not used
  • Check if the domain is available on SuiNS
  • Use our tool to resolve the domain name
  1. Balance Check
  • Ensure sufficient funds for payment
  • Supported tokens: SUI, NS, USDC
  1. Security
  • Verify transaction details
  • Double-check amounts
  • Keep private keys secure
  1. User Experience
  • Show transaction progress