Skip to main content

SuiNS SDK

Use the SuiNS SDK to interact with the Sui Name Service. Query SuiNS data in a usable way and build transactions that interact with service names.

Installation​

To use with the latest version of the TypeScript SDK, install using:

$ npm i @mysten/suins

The suins client extension​

The suins() extension adds SuiNS functionality to any Sui client, exposed under client.suins.

info

You should keep only 1 extended client throughout your app, API, or script. For example, in React, you should use a context to provide the client.

Attach the extension​

caution

Always keep the dependency updated so you get the latest constants. If you do not, some of your transactions might fail to build.

Attach SuiNS to a Sui client with the suins() extension. Pass no arguments to use the built-in constants for Mainnet and Testnet, or pass a packageInfo object to target any other deployment.

import { suins } from '@mysten/suins';
import { SuiGrpcClient } from '@mysten/sui/grpc';

// Re-use the Sui client of your project rather than creating a new one.
const client = new SuiGrpcClient({
network: 'testnet',
baseUrl: 'https://fullnode.testnet.sui.io:443',
}).$extend(suins());

// SuiNS methods are now available under client.suins.
const nameRecord = await client.suins.getNameRecord('example.sui');