Kiosk Client
Kiosk Client is the base for all Kiosk SDK functionality.
We recommend you keep only one instance of
KioskClient
throughout your dApp or script. For example, in react, you'd use a context to provide the client.
Creating a kiosk client
You can follow the example to create a KioskClient
. The client currently supports MAINNET
and
TESTNET
. View next section for usage in 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 { KioskClient, Network } from '@mysten/kiosk';
import { getFullnodeUrl, SuiClient } from '@mysten/sui.js/client';
// We need a Sui Client. You can re-use the SuiClient of your project
// (it's not recommended to create a new one).
const client = new SuiClient({ url: getFullnodeUrl('testnet') });
// Now we can use it to create a kiosk Client.
const kioskClient = new KioskClient({
client,
network: Network.TESTNET,
});
Using KioskClient on devnet or localnet
To use all the functionality of Kiosk SDK outside of MAINNET
and TESTNET
, use Network.CUSTOM
as the network, and pass the packageIds
for the rules and extensions you want to use.
// constructing it for custom network use.
const kioskClient = new KioskClient({
client,
network: Network.CUSTOM,
packageIds: {
kioskLockRulePackageId: '0x...',
royaltyRulePackageId: '0x...',
personalKioskRulePackageId: '0x...',
floorPriceRulePackageId: '0x...',
},
});