SuiNS SDK

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.

ℹ️

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

Initializing a SuinsClient

ℹ️

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

You can initalize a SuinsClient by either providing the active network (mainnet/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',
});