Cancel an exclusive Sui Kiosk offer with its purchase capability

A Kiosk can give a particular buyer or sale contract the right to buy an item above a minimum price. Closing this offer requires accounting for the issued PurchaseCap.

Track which kiosk issued the capability

This test creates an exclusive offer and immediately cancels it. In a live trade the two operations may occur in different transactions. Record the capability’s custody at issuance: cancellation requires returning that value to its originating kiosk.

let offer = kiosk::list_with_purchase_cap<Art>(
    shop, owner_cap, item_id, 500, ctx
);
// Cancel this exclusive offer while holding its capability.
kiosk::return_purchase_cap(shop, offer);

Distinguish cancellation from purchase and unlocking

Returning the cap removes the exclusive offer without a payment. Presenting it to another kiosk fails. Check the item’s underlying locked state separately before promising that a seller can take it out. An item locked under a transfer policy can remain in the kiosk even after its offer is gone.

Sources