{"version":3,"file":"personal_kiosk.mjs","names":["kiosk.KioskOwnerCap"],"sources":["../../../src/contracts/kiosk/personal_kiosk.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Description: This module provides a wrapper for the KioskOwnerCap that makes the\n * Kiosk non-transferable and \"owned\".\n */\n\nimport { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as kiosk from './deps/sui/kiosk.js';\nconst $moduleName = '@local-pkg/kiosk::personal_kiosk';\nexport const PersonalKioskCap = new MoveStruct({\n\tname: `${$moduleName}::PersonalKioskCap`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\tcap: bcs.option(kiosk.KioskOwnerCap),\n\t},\n});\nexport const Borrow = new MoveStruct({\n\tname: `${$moduleName}::Borrow`,\n\tfields: {\n\t\tcap_id: bcs.Address,\n\t\towned_id: bcs.Address,\n\t},\n});\nexport const OwnerMarker = new MoveStruct({\n\tname: `${$moduleName}::OwnerMarker`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const NewPersonalKiosk = new MoveStruct({\n\tname: `${$moduleName}::NewPersonalKiosk`,\n\tfields: {\n\t\tkiosk_id: bcs.Address,\n\t},\n});\nexport interface DefaultArguments {\n\tkiosk: RawTransactionArgument<string>;\n\tcap: RawTransactionArgument<string>;\n}\nexport interface DefaultOptions {\n\tpackage?: string;\n\targuments:\n\t\tDefaultArguments | [kiosk: RawTransactionArgument<string>, cap: RawTransactionArgument<string>];\n}\n/** The default setup for the PersonalKioskCap. */\nexport function _default(options: DefaultOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['kiosk', 'cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'default',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface NewArguments {\n\tkiosk: RawTransactionArgument<string>;\n\tcap: RawTransactionArgument<string>;\n}\nexport interface NewOptions {\n\tpackage?: string;\n\targuments:\n\t\tNewArguments | [kiosk: RawTransactionArgument<string>, cap: RawTransactionArgument<string>];\n}\n/**\n * Wrap the KioskOwnerCap making the Kiosk \"owned\" and non-transferable. The\n * `PersonalKioskCap` is returned to allow chaining within a PTB, but the value\n * must be consumed by the `transfer_to_sender` call in any case.\n */\nexport function _new(options: NewOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['kiosk', 'cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'new',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface CreateForArguments {\n\tkiosk: RawTransactionArgument<string>;\n\tcap: RawTransactionArgument<string>;\n\trecipient: RawTransactionArgument<string>;\n}\nexport interface CreateForOptions {\n\tpackage?: string;\n\targuments:\n\t\t| CreateForArguments\n\t\t| [\n\t\t\t\tkiosk: RawTransactionArgument<string>,\n\t\t\t\tcap: RawTransactionArgument<string>,\n\t\t\t\trecipient: RawTransactionArgument<string>,\n\t\t  ];\n}\n/**\n * Create a `PersonalKiosk` for `recipient`. This is useful when (e.g.) an admin\n * account wants to mint an asset with royalty enforcement on behalf of a user.\n */\nexport function createFor(options: CreateForOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null, null, 'address'] satisfies (string | null)[];\n\tconst parameterNames = ['kiosk', 'cap', 'recipient'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'create_for',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface BorrowArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface BorrowOptions {\n\tpackage?: string;\n\targuments: BorrowArguments | [self: RawTransactionArgument<string>];\n}\n/** Borrow the `KioskOwnerCap` from the `PersonalKioskCap` object. */\nexport function borrow(options: BorrowOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'borrow',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface BorrowMutArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface BorrowMutOptions {\n\tpackage?: string;\n\targuments: BorrowMutArguments | [self: RawTransactionArgument<string>];\n}\n/** Mutably borrow the `KioskOwnerCap` from the `PersonalKioskCap` object. */\nexport function borrowMut(options: BorrowMutOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'borrow_mut',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface BorrowValArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface BorrowValOptions {\n\tpackage?: string;\n\targuments: BorrowValArguments | [self: RawTransactionArgument<string>];\n}\n/**\n * Borrow the `KioskOwnerCap` from the `PersonalKioskCap` object; `Borrow`\n * hot-potato makes sure that the Cap is returned via `return_val` call.\n */\nexport function borrowVal(options: BorrowValOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'borrow_val',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface ReturnValArguments {\n\tself: RawTransactionArgument<string>;\n\tcap: RawTransactionArgument<string>;\n\tborrow: TransactionArgument;\n}\nexport interface ReturnValOptions {\n\tpackage?: string;\n\targuments:\n\t\t| ReturnValArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tcap: RawTransactionArgument<string>,\n\t\t\t\tborrow: TransactionArgument,\n\t\t  ];\n}\n/** Return the Cap to the PersonalKioskCap object. */\nexport function returnVal(options: ReturnValOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'cap', 'borrow'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'return_val',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface IsPersonalArguments {\n\tkiosk: RawTransactionArgument<string>;\n}\nexport interface IsPersonalOptions {\n\tpackage?: string;\n\targuments: IsPersonalArguments | [kiosk: RawTransactionArgument<string>];\n}\n/** Check if the Kiosk is \"personal\". */\nexport function isPersonal(options: IsPersonalOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['kiosk'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'is_personal',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface OwnerArguments {\n\tkiosk: RawTransactionArgument<string>;\n}\nexport interface OwnerOptions {\n\tpackage?: string;\n\targuments: OwnerArguments | [kiosk: RawTransactionArgument<string>];\n}\n/** Get the owner of the Kiosk if the Kiosk is \"personal\". Aborts otherwise. */\nexport function owner(options: OwnerOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['kiosk'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'owner',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface TryOwnerArguments {\n\tkiosk: RawTransactionArgument<string>;\n}\nexport interface TryOwnerOptions {\n\tpackage?: string;\n\targuments: TryOwnerArguments | [kiosk: RawTransactionArgument<string>];\n}\n/**\n * Try to get the owner of the Kiosk if the Kiosk is \"personal\". Returns None\n * otherwise.\n */\nexport function tryOwner(options: TryOwnerOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['kiosk'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'try_owner',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface TransferToSenderArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface TransferToSenderOptions {\n\tpackage?: string;\n\targuments: TransferToSenderArguments | [self: RawTransactionArgument<string>];\n}\n/** Transfer the `PersonalKioskCap` to the transaction sender. */\nexport function transferToSender(options: TransferToSenderOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'personal_kiosk',\n\t\t\tfunction: 'transfer_to_sender',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,cAAc;AACpB,MAAa,mBAAmB,IAAI,WAAW;CAC9C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,IAAI,IAAI;EACR,KAAK,IAAI,OAAOA,cAAoB;EACpC;CACD,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,QAAQ,IAAI;EACZ,UAAU,IAAI;EACd;CACD,CAAC;AACF,MAAa,cAAc,IAAI,WAAW;CACzC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,mBAAmB,IAAI,WAAW;CAC9C,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,UAAU,IAAI,SACd;CACD,CAAC;;;;;;AAqCF,SAAgB,KAAK,SAAqB;CACzC,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB,CAAC,MAAM,KAAK;CACnC,MAAM,iBAAiB,CAAC,SAAS,MAAM;AACvC,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;;;;AAoFJ,SAAgB,UAAU,SAA2B;CACpD,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB,CAAC,KAAK;CAC7B,MAAM,iBAAiB,CAAC,OAAO;AAC/B,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;AAkBJ,SAAgB,UAAU,SAA2B;CACpD,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB;EAAC;EAAM;EAAM;EAAK;CACzC,MAAM,iBAAiB;EAAC;EAAQ;EAAO;EAAS;AAChD,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;AAyEJ,SAAgB,iBAAiB,SAAkC;CAClE,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB,CAAC,KAAK;CAC7B,MAAM,iBAAiB,CAAC,OAAO;AAC/B,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC"}