{"version":3,"file":"kiosk.mjs","names":[],"sources":["../../src/types/kiosk.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { TransactionArgument } from '@mysten/sui/transactions';\n\nimport type { ObjectArgument } from './index.js';\n\nimport { SUI_FRAMEWORK_ADDRESS } from '@mysten/sui/utils';\nimport { SuiClientTypes } from '@mysten/sui/client';\n\n/** The Kiosk module. */\nexport const KIOSK_MODULE = `${SUI_FRAMEWORK_ADDRESS}::kiosk`;\n\n/** The Kiosk type. */\nexport const KIOSK_TYPE = `${KIOSK_MODULE}::Kiosk`;\n\n/** The Kiosk Owner Cap Type */\nexport const KIOSK_OWNER_CAP = `${KIOSK_MODULE}::KioskOwnerCap`;\n\n/** The Kiosk Item Type */\nexport const KIOSK_ITEM = `${KIOSK_MODULE}::Item`;\n\n/** The Kiosk Listing Type */\nexport const KIOSK_LISTING = `${KIOSK_MODULE}::Listing`;\n\n/** The Kiosk Lock Type */\nexport const KIOSK_LOCK = `${KIOSK_MODULE}::Lock`;\n\n/** The Kiosk PurchaseCap type */\nexport const KIOSK_PURCHASE_CAP = `${KIOSK_MODULE}::PurchaseCap`;\n\n/**\n * The Kiosk object fields (for BCS queries).\n */\nexport type Kiosk = {\n\tid: string;\n\tprofits: string;\n\towner: string;\n\titemCount: number;\n\tallowExtensions: boolean;\n};\n\n/**\n * PurchaseCap object fields (for BCS queries).\n */\nexport type PurchaseCap = {\n\tid: string;\n\tkioskId: string;\n\titemId: string;\n\tminPrice: string;\n};\n\n/**\n * The response type of a successful purchase flow.\n * Returns the item, and a `canTransfer` param.\n */\nexport type PurchaseAndResolvePoliciesResponse = {\n\titem: TransactionArgument;\n\tcanTransfer: boolean;\n};\n\n/**\n * Optional parameters for `purchaseAndResolvePolicies` flow.\n * This gives us the chance to extend the function in further releases\n * without introducing more breaking changes.\n */\nexport type PurchaseOptionalParams = {\n\townedKiosk?: ObjectArgument;\n\townedKioskCap?: ObjectArgument;\n};\n\n/**\n * A dynamic field `Listing { ID, isExclusive }` attached to the Kiosk.\n * Holds a `u64` value - the price of the item.\n */\nexport type KioskListing = {\n\t/** The ID of the Item */\n\tobjectId: string;\n\t/**\n\t * Whether or not there's a `PurchaseCap` issued. `true` means that\n\t * the listing is controlled by some logic and can't be purchased directly.\n\t *\n\t * TODO: consider renaming the field for better indication.\n\t */\n\tisExclusive: boolean;\n\t/** The ID of the listing */\n\tlistingId: string;\n\tprice?: string;\n};\n\nexport type KioskDisplay = {\n\tdata: Record<string, unknown> | null;\n\terror: string | null;\n};\n\nexport type ObjectWithDisplay = Omit<\n\tSuiClientTypes.Object<{\n\t\tcontent: true;\n\t\tpreviousTransaction: true;\n\t}>,\n\t'display'\n> & {\n\tdisplay?: KioskDisplay;\n};\n\n/**\n * A dynamic field `Item { ID }` attached to the Kiosk.\n * Holds an Item `T`. The type of the item is known upfront.\n */\nexport type KioskItem = {\n\t/** The ID of the Item */\n\tobjectId: string;\n\t/** The type of the Item */\n\ttype: string;\n\t/** Whether the item is Locked (there must be a `Lock` Dynamic Field) */\n\tisLocked: boolean;\n\t/** Optional listing */\n\tlisting?: KioskListing;\n\t/** The ID of the kiosk the item is placed in */\n\tkioskId: string;\n\t/** Optional object data with display metadata */\n\tdata?: ObjectWithDisplay;\n};\n\n/** The overview type returned from `getKiosk` */\nexport type KioskExtensionOverview = {\n\t/** The ID of the extension's DF */\n\tobjectId: string;\n\t/** The inner type of the Extension */\n\ttype: string;\n};\n/**\n * Hold the KioskExtension data\n */\nexport type KioskExtension = KioskExtensionOverview & {\n\t/** These fields are only there if we have `withExtensions` flag */\n\tisEnabled: boolean;\n\tpermissions: string;\n\tstorageId: string;\n\tstorageSize: number;\n};\n\n/**\n * Aggregated data from the Kiosk.\n */\nexport type KioskData = {\n\titems: KioskItem[];\n\titemIds: string[];\n\tlistingIds: string[];\n\tkiosk?: Kiosk;\n\textensions: KioskExtensionOverview[]; // type will be defined on later versions of the SDK.\n};\n\nexport type PagedKioskData = {\n\tdata: KioskData;\n\tnextCursor: string | null | undefined;\n\thasNextPage: boolean;\n};\n\nexport type FetchKioskOptions = {\n\t/** Include the base kiosk object, which includes the profits, the owner and the base fields. */\n\twithKioskFields?: boolean;\n\t/** Include the listing prices. */\n\twithListingPrices?: boolean;\n\t/** Include the objects for the Items in the kiosk. */\n\twithObjects?: boolean;\n};\n\nexport type OwnedKiosks = {\n\tkioskOwnerCaps: KioskOwnerCap[];\n\tkioskIds: string[];\n\tnextCursor: string | null;\n\thasNextPage: boolean;\n};\n\nexport type KioskOwnerCap = {\n\tisPersonal?: boolean;\n\tobjectId: string;\n\tkioskId: string;\n\tdigest: string;\n\tversion: string;\n};\n\nexport type PurchaseOptions = {\n\textraArgs?: Record<string, any>;\n};\n\nexport type ItemId = { itemType: string; itemId: string };\nexport type ItemReference = { itemType: string; item: ObjectArgument };\nexport type ItemValue = { itemType: string; item: TransactionArgument };\nexport type Price = { price: string | bigint };\n"],"mappings":";;;;AAWA,MAAa,eAAe,GAAG,sBAAsB;;AAGrD,MAAa,aAAa,GAAG,aAAa;;AAG1C,MAAa,kBAAkB,GAAG,aAAa;;AAG/C,MAAa,aAAa,GAAG,aAAa;;AAG1C,MAAa,gBAAgB,GAAG,aAAa;;AAG7C,MAAa,aAAa,GAAG,aAAa;;AAG1C,MAAa,qBAAqB,GAAG,aAAa"}