Skip to main content

KioskTransaction

@iota/kiosk


@iota/kiosk / KioskTransaction

Class: KioskTransaction

Defined in: client/kiosk-transaction.ts:45

A helper for building transactions that involve kiosk.

Constructors

Constructor

new KioskTransaction(__namedParameters): KioskTransaction

Defined in: client/kiosk-transaction.ts:61

Parameters

__namedParameters

KioskTransactionParams

Returns

KioskTransaction

Properties

kiosk?

optional kiosk?: TransactionObjectArgument

Defined in: client/kiosk-transaction.ts:48


kioskCap?

optional kioskCap?: TransactionObjectArgument

Defined in: client/kiosk-transaction.ts:49


kioskClient

kioskClient: KioskClient

Defined in: client/kiosk-transaction.ts:47


transaction

transaction: Transaction

Defined in: client/kiosk-transaction.ts:46

Methods

borrow()

borrow(__namedParameters): [TransactionArgument, TransactionArgument]

Defined in: client/kiosk-transaction.ts:174

Borrows an item from the kiosk. This will fail if the item is listed for sale.

Requires calling return.

Parameters

__namedParameters

ItemId

Returns

[TransactionArgument, TransactionArgument]


borrowTx()

borrowTx(__namedParameters, callback): KioskTransaction

Defined in: client/kiosk-transaction.ts:153

A function to borrow an item from a kiosk & execute any function with it.

Parameters

__namedParameters

ItemId

callback

(item) => void

Returns

KioskTransaction


convertToPersonal()

convertToPersonal(borrow?): KioskTransaction

Defined in: client/kiosk-transaction.ts:99

Converts a kiosk to a Personal (Soulbound) Kiosk. Requires initialization by either calling ktxb.create() or ktxb.setCap().

Parameters

borrow?

boolean

Returns

KioskTransaction


create()

create(): KioskTransaction

Defined in: client/kiosk-transaction.ts:73

Creates a kiosk and saves kiosk and kioskOwnerCap in state. Helpful if we want to chain some actions before sharing + transferring the cap to the specified address.

Returns

KioskTransaction


createAndShare()

createAndShare(address): KioskTransaction

Defined in: client/kiosk-transaction.ts:120

Single function way to create a kiosk, share it and transfer the cap to the specified address.

Parameters

address

string

Returns

KioskTransaction


createPersonal()

createPersonal(borrow?): KioskTransaction

Defined in: client/kiosk-transaction.ts:90

Creates a personal kiosk & shares it. The PersonalKioskCap is transferred to the signer.

Parameters

borrow?

boolean

If true, the kioskOwnerCap is borrowed from the PersonalKioskCap to be used in next transactions.

Returns

KioskTransaction


delist()

delist(itemType): KioskTransaction

Defined in: client/kiosk-transaction.ts:254

A function to delist an item from the kiosk.

Parameters

itemType

ItemId

The type T of the item

Returns

KioskTransaction


finalize()

finalize(): void

Defined in: client/kiosk-transaction.ts:428

A function that ends up the kiosk building tx & returns the kioskOwnerCap back to the PersonalKioskCap, in case we are operating on a personal kiosk. It will also share the kiosk if it's not shared, and finalize the transfer of the personal cap if it's pending.

Returns

void


getKiosk()

getKiosk(): TransactionObjectArgument

Defined in: client/kiosk-transaction.ts:482

Returns

TransactionObjectArgument


getKioskCap()

getKioskCap(): TransactionObjectArgument

Defined in: client/kiosk-transaction.ts:491

Returns

TransactionObjectArgument


list()

list(itemType): KioskTransaction

Defined in: client/kiosk-transaction.ts:243

A function to list an item in the kiosk.

Parameters

itemType

ItemId & object

The type T of the item

Returns

KioskTransaction


lock()

lock(itemType): KioskTransaction

Defined in: client/kiosk-transaction.ts:293

A function to take lock an item in the kiosk.

Parameters

itemType

ItemReference & object

The type T of the item

Returns

KioskTransaction


place()

place(itemType): KioskTransaction

Defined in: client/kiosk-transaction.ts:219

A function to place an item in the kiosk.

Parameters

itemType

ItemReference

The type T of the item

Returns

KioskTransaction


placeAndList()

placeAndList(itemType): KioskTransaction

Defined in: client/kiosk-transaction.ts:231

A function to place an item in the kiosk and list it for sale in one transaction.

Parameters

itemType

ItemReference & Price

The type T of the item

Returns

KioskTransaction


purchase()

purchase(itemType): [TransactionObjectArgument, TransactionObjectArgument]

Defined in: client/kiosk-transaction.ts:320

Purchase an item from a seller's kiosk. Returns [item, transferRequest] Can be called like: const [item, transferRequest] = kioskTx.purchase({...})

Parameters

itemType

ItemId & Price & object

The type T of the item

Returns

[TransactionObjectArgument, TransactionObjectArgument]


purchaseAndResolve()

purchaseAndResolve(itemType): Promise<KioskTransaction>

Defined in: client/kiosk-transaction.ts:346

A function to purchase and resolve a transfer policy. If the transfer policy has the lock rule, the item is locked in the kiosk. Otherwise, the item is placed in the kiosk.

Parameters

itemType

ItemId & Price & object & PurchaseOptions

The type of the item

Returns

Promise<KioskTransaction>


return()

return(__namedParameters): KioskTransaction

Defined in: client/kiosk-transaction.ts:191

Returns the item back to the kiosk. Accepts the parameters returned from the borrow function.

Parameters

__namedParameters

ItemValue & object

Returns

KioskTransaction


setCap()

setCap(cap): KioskTransaction | undefined

Defined in: client/kiosk-transaction.ts:412

A function to setup the client using an existing ownerCap, as return from the kioskClient.getOwnedKiosks function.

Parameters

cap

KioskOwnerCap

KioskOwnerCap object as returned from getOwnedKiosks SDK call.

Returns

KioskTransaction | undefined


setKiosk()

setKiosk(kiosk): KioskTransaction

Defined in: client/kiosk-transaction.ts:472

Parameters

kiosk

TransactionObjectArgument

Returns

KioskTransaction


setKioskCap()

setKioskCap(cap): KioskTransaction

Defined in: client/kiosk-transaction.ts:466

Parameters

cap

TransactionObjectArgument

Returns

KioskTransaction


share()

share(): KioskTransaction

Defined in: client/kiosk-transaction.ts:130

Shares the kiosk.

Returns

KioskTransaction


shareAndTransferCap()

shareAndTransferCap(address): KioskTransaction

Defined in: client/kiosk-transaction.ts:141

Should be called only after create is called. It shares the kiosk & transfers the cap to the specified address.

Parameters

address

string

Returns

KioskTransaction


take()

take(itemType): TransactionObjectArgument

Defined in: client/kiosk-transaction.ts:266

A function to take an item from the kiosk. The transaction won't succeed if the item is listed or locked.

Parameters

itemType

ItemId

The type T of the item

Returns

TransactionObjectArgument


transfer()

transfer(itemType): KioskTransaction

Defined in: client/kiosk-transaction.ts:278

Transfer a non-locked/non-listed item to an address.

Parameters

itemType

ItemId & object

The type T of the item

Returns

KioskTransaction


withdraw()

withdraw(address, amount?): KioskTransaction

Defined in: client/kiosk-transaction.ts:202

A function to withdraw from kiosk

Parameters

address

string

Where to transfer the coin.

amount?

string | number | bigint

The amount we aim to withdraw.

Returns

KioskTransaction