Skip to main content

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. View next section for usage in custom networks.

import { KioskClient } from '@iota/kiosk';
import { getFullnodeUrl, IotaClient, Network } from '@iota/iota-sdk/client';

// We need a IOTA Client. You can re-use the IotaClient of your project
// (it's not recommended to create a new one).
const client = new IotaClient({ url: getFullnodeUrl(Network.Testnet) });

// Now we can use it to create a kiosk Client.
const kioskClient = new KioskClient({
client,
network: Network.Testnet,
});

Using KioskClient on custom networks

To use all the functionality of Kiosk SDK outside of official networks, 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...',
},
});