This is a lightweight SDK (1kB minified bundle size), providing utility classes and functions for applications to interact with on-chain .sui
and .move
domains registered from Sui Name Service (suins.io).
The SDK is published to npm registry. To use it in your project:
$ npm install @suins/toolkit
You can also use yarn or pnpm.
Create an instance of SuinsClient:
import { JsonRpcProvider } from '@mysten/sui.js';
import { SuinsClient } from '@suins/toolkit';
const provider = new JsonRpcProvider();
export const suinsClient = new SuinsClient(provider);
Note: To ensure best performance, please make sure to create only one instance of the SuinsClient class in your application. Then, import the created
suinsClient
instance to use its functions.
Fetch a SuiAddress
linked to a domain:
const address = await suinsClient.getAddress('suins.sui');
Fetch the default domain of a SuiAddress
:
const defaultDomain = await suinsClient.getName(
'0x484f1024c91ad8c9824bf46a708e3529251b2bc3',
);
Fetch resolver data of a domain:
const resolverData = await suinsClient.getResolverData('suins.sui');