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

SuinsClient

SuinsClient is the base for all SuiNS functionality.

info

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

Initialize a SuinsClient

caution

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

You can initialize a SuinsClient by either providing the active network (mainnet or testnet), or by passing in the constants (usable for any network).

import { SuinsClient } from '@mysten/suins';
import { getFullnodeUrl, SuiClient } from '@mysten/sui/client';

// You need a Sui client. You can re-use the Sui client of your project
// (it's not recommended to create a new one).
const client = new SuiClient({ url: getFullnodeUrl('testnet') });

// Now you can use it to create a SuiNS client.
const suinsClient = new SuinsClient({
client,
network: 'testnet',
});