@mysten/sui v2.0 and a new dApp Kit are here! Check out the migration guide
Mysten Labs SDKs
Kiosk client

Kiosk Client

The Kiosk SDK exports a client extension that provides all Kiosk functionality.

We recommend you keep only one client instance throughout your dApp or script. For example, in React, you'd use a context to provide the client.

Note: The Kiosk SDK requires SuiJsonRpcClient or SuiGraphQLClient. It does not work with SuiGrpcClient because it uses event queries that are not available in gRPC.

Setting up the kiosk extension

Add the kiosk extension to your Sui client using $extend(). The extension currently supports mainnet and testnet. See the next section for usage on other networks.

Mysten Kiosk rules and extensions are not supported in Devnet due to network wipes (that would require constantly changing the package IDs).

import { kiosk } from '@mysten/kiosk';
import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc';

const client = new SuiJsonRpcClient({
	url: getJsonRpcFullnodeUrl('testnet'),
	network: 'testnet',
}).$extend(kiosk());

// Now you can use client.kiosk for all kiosk operations
const { kioskOwnerCaps } = await client.kiosk.getOwnedKiosks({ address: '0x...' });

Using the kiosk extension on devnet or localnet

To use all the functionality of Kiosk SDK outside of mainnet and testnet, pass the packageIds for the rules and extensions you want to use.

import { kiosk } from '@mysten/kiosk';
import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc';

const client = new SuiJsonRpcClient({
	url: getJsonRpcFullnodeUrl('devnet'),
	network: 'devnet',
}).$extend(
	kiosk({
		packageIds: {
			kioskLockRulePackageId: '0x...',
			royaltyRulePackageId: '0x...',
			personalKioskRulePackageId: '0x...',
			floorPriceRulePackageId: '0x...',
		},
	}),
);

On this page