Integration

Integration

Integration with SuiNS works in multiple ways. For dApps, you typically integrate SuiNS through off-chain resolution using remote procedural calls (RPCs). The calls enable you to interact with the Sui network or display names instead of addresses. For example, your RPCs might create transactions that send assets to names, or show names instead of addresses in a leaderboard.

Resolution works in two ways:

  • Lookup: A name can point to an address or an object (for example, example.sui might point to 0x2).
  • Reverse lookup: An address can have a default name (for example, 0x2 might have the default example.sui).

Off-chain resolution

For off-chain resolution, use the available Sui API endpoints:

For GraphQL's default name resolution, there's a defaultSuinsName field (opens in a new tab) you can use.

On-chain resolution

Use the SuiNS core package as a dependency to your own package for on-chain resolution. Use the following dependency on your Move.toml file depending on which network you're targeting:

[dependencies]
suins = { git = "https://github.com/mystenlabs/suins-contracts/", subdir = "packages/suins", rev = "releases/mainnet/core/v3" }

For more implementation details, review the available code examples that use the SuiNS core package for name resolution.

⚠️

You should integrate SuiNS on chain using the core package only. The utility packages are likely to be replaced, rendering your logic non-functional unless you update your code with each change.