0.4.7 • Published 13 days ago

@mysten/suins-toolkit v0.4.7

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
13 days ago

SuiNS TypeScript SDK

This is a lightweight SDK (1kB minified bundle size), providing utility classes and functions for applications to interact with on-chain .sui names registered from Sui Name Service (suins.io).

Getting started

The SDK is published to npm registry. To use it in your project:

$ npm install @mysten/suins-toolkit

You can also use yarn or pnpm.

Examples

Create an instance of SuinsClient:

import { SuiClient } from '@mysten/sui.js/client';
import { SuinsClient } from '@mysten/suins-toolkit';

const client = new SuiClient();
export const suinsClient = new SuinsClient(client);

Choose network type:

export const suinsClient = new SuinsClient(client, {
	networkType: 'testnet',
});

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 an address linked to a name:

const address = await suinsClient.getAddress('suins.sui');

Fetch the default name of an address:

const defaultName = await suinsClient.getName(
	'0xc2f08b6490b87610629673e76bab7e821fe8589c7ea6e752ea5dac2a4d371b41',
);

Fetch a name object:

const nameObject = await suinsClient.getNameObject('suins.sui');

Fetch a name object including the owner:

const nameObject = await suinsClient.getNameObject('suins.sui', {
	showOwner: true,
});

Fetch a name object including the Avatar the owner has set (it automatically includes owner too):

const nameObject = await suinsClient.getNameObject('suins.sui', {
	showOwner: true, // this can be skipped as showAvatar includes it by default
	showAvatar: true,
});

License

Apache-2.0

0.4.7

13 days ago

0.4.6

1 month ago

0.4.5

1 month ago

0.4.4

2 months ago

0.4.3

3 months ago

0.4.2

3 months ago

0.4.1

4 months ago

0.4.0

4 months ago

0.3.18

5 months ago

0.3.17

5 months ago

0.3.0

9 months ago

0.3.6

8 months ago

0.3.5

8 months ago

0.3.8

7 months ago

0.3.7

7 months ago

0.3.2

9 months ago

0.3.1

9 months ago

0.3.4

8 months ago

0.3.3

9 months ago

0.3.9

7 months ago

0.3.16

6 months ago

0.3.15

6 months ago

0.3.14

6 months ago

0.3.13

6 months ago

0.3.12

6 months ago

0.3.11

7 months ago

0.3.10

7 months ago

0.2.3

10 months ago

0.2.2

10 months ago

0.2.1

11 months ago

0.2.0

11 months ago