{"version":3,"file":"kiosk_lock_rule.mjs","names":[],"sources":["../../../src/contracts/kiosk/kiosk_lock_rule.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Description: This module defines a Rule which forces buyers to put the purchased\n * item into the Kiosk and lock it. The most common use case for the Rule is making\n * sure an item never leaves Kiosks and has policies enforced on every transfer.\n *\n * Configuration:\n *\n * - None\n *\n * Use cases:\n *\n * - Enforcing policies on every trade\n * - Making sure an item never leaves the Kiosk / certain ecosystem\n *\n * Notes:\n *\n * - \"locking\" mechanic disallows the `kiosk::take` function and forces the owner\n *   to use `list` or `list_with_purchase_cap` methods if they wish to move the\n *   item somewhere else.\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';\nconst $moduleName = '@local-pkg/kiosk::kiosk_lock_rule';\nexport const Rule = new MoveStruct({\n\tname: `${$moduleName}::Rule`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const Config = new MoveStruct({\n\tname: `${$moduleName}::Config`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport interface AddArguments {\n\tpolicy: RawTransactionArgument<string>;\n\tcap: RawTransactionArgument<string>;\n}\nexport interface AddOptions {\n\tpackage?: string;\n\targuments:\n\t\tAddArguments | [policy: RawTransactionArgument<string>, cap: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/**\n * Creator: Adds a `kiosk_lock_rule` Rule to the `TransferPolicy` forcing buyers to\n * lock the item in a Kiosk on purchase.\n */\nexport function add(options: AddOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['policy', 'cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'kiosk_lock_rule',\n\t\t\tfunction: 'add',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface ProveArguments {\n\trequest: TransactionArgument;\n\tkiosk: RawTransactionArgument<string>;\n}\nexport interface ProveOptions {\n\tpackage?: string;\n\targuments: ProveArguments | [request: TransactionArgument, kiosk: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/**\n * Buyer: Prove the item was locked in the Kiosk to get the receipt and unblock the\n * transfer request confirmation.\n */\nexport function prove(options: ProveOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['request', 'kiosk'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'kiosk_lock_rule',\n\t\t\tfunction: 'prove',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,cAAc;AACpB,MAAa,OAAO,IAAI,WAAW;CAClC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;;;;;AAeF,SAAgB,IAAI,SAAqB;CACxC,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB,CAAC,MAAM,KAAK;CACnC,MAAM,iBAAiB,CAAC,UAAU,MAAM;AACxC,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,eAAe,QAAQ;EACvB,CAAC;;;;;;AAeJ,SAAgB,MAAM,SAAuB;CAC5C,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB,CAAC,MAAM,KAAK;CACnC,MAAM,iBAAiB,CAAC,WAAW,QAAQ;AAC3C,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,eAAe,QAAQ;EACvB,CAAC"}