Place and Take
Kiosk owner can place any assets into their Kiosk, placed assets can be taken by the owner if they're not listed.
There's no limitations to which assets can be placed into the Kiosk, however, it does not guarantee that they will be tradable - that depends on whether there's a TransferPolicy for the type. See the Purchase section for more details.
Placing an item into the Kiosk
To place an item to the Kiosk, the owner needs to call the sui::kiosk::place
function on the Kiosk object and pass the KioskOwnerCap and the Item as arguments.
ITEM_TYPE
in the examples below is the full type of the item.
Example Kiosk SDK
import { place } from '@mysten/kiosk';
let tx = new TransactionBuilder();
let itemArg = tx.object('<ID>');
let kioskArg = tx.object('<ID>');
let kioskOwnerCapArg = tx.object('<ID>');
place(tx, '<ITEM_TYPE>', kioskArg, kioskOwnerCapArg, item);
Example PTB
let tx = new TransactionBuilder();
let itemArg = tx.object('<ID>');
let kioskArg = tx.object('<ID>');
let kioskOwnerCapArg = tx.object('<ID>');
tx.moveCall({
target: '0x2::kiosk::place',
arguments: [ kioskArg, kioskOwnerCapArg, itemArg ],
typeArguments: [ '<ITEM_TYPE>' ]
})
Example CLI
sui client call \
--package 0x2 \
--module kiosk \
--function place \
--args "<KIOSK_ID>" "<CAP_ID>" "<ITEM_ID>" \
--type-args "<ITEM_TYPE>" \
--gas-budget 1000000000
Taking an item from the Kiosk
To take an item from the Kiosk, the owner needs to call the sui::kiosk::take
function on the Kiosk object and pass the KioskOwnerCap and ID of the item as arguments.
ITEM_TYPE
in the examples below is the full type of the item.
Example Kiosk SDK
import { take } from '@mysten/kiosk';
let tx = new TransactionBuilder();
let itemId = tx.pure('<ITEM_ID>', 'address');
let kioskArg = tx.object('<ID>');
let kioskOwnerCapArg = tx.object('<ID>');
let item = take('<ITEM_TYPE>', kioskArg, kioskOwnerCapArg, itemId);
tx.transferObjects([ item ], tx.pure(sender, 'address'));
Example PTB
let tx = new TransactionBuilder();
let itemId = tx.pure('<ITEM_ID>', 'address');
let kioskArg = tx.object('<ID>');
let kioskOwnerCapArg = tx.object('<ID>');
let item = tx.moveCall({
target: '0x2::kiosk::take',
arguments: [ kioskArg, kioskOwnerCapArg, itemId ],
typeArguments: [ '<ITEM_TYPE>' ]
});
Example CLI
The kiosk::take
function is built to be PTB friendly and returns the asset, and CLI does not support transaction chaining yet.