Kiosk Client
Introduction to the KioskClient extension for querying and managing kiosks on Sui
The Kiosk SDK exports a client extension that provides all Kiosk functionality.
We recommend you keep only one client instance throughout your app or script. For example, in React, you'd use a context to provide the client.
The Kiosk extension accepts any Sui client that implements ClientWithCoreApi. Use SuiGrpcClient
for new Kiosk code; SuiGraphQLClient and the deprecated SuiJsonRpcClient are also compatible.
The gRPC object API returns Display v2 metadata. Use GraphQL or JSON-RPC when reading objects whose types still rely on legacy Display metadata.
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 { SuiGrpcClient } from '@mysten/sui/grpc';
const client = new SuiGrpcClient({
baseUrl: 'https://fullnode.testnet.sui.io:443',
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 { SuiGrpcClient } from '@mysten/sui/grpc';
const client = new SuiGrpcClient({
baseUrl: 'https://fullnode.devnet.sui.io:443',
network: 'devnet',
}).$extend(
kiosk({
packageIds: {
kioskLockRulePackageId: '0x...',
royaltyRulePackageId: '0x...',
personalKioskRulePackageId: '0x...',
floorPriceRulePackageId: '0x...',
},
}),
);