{"version":3,"file":"floor_price_rule.mjs","names":[],"sources":["../../../src/contracts/kiosk/floor_price_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 sets the floor price for items of\n * type T.\n *\n * Configuration:\n *\n * - floor_price - the floor price in MIST.\n *\n * Use cases:\n *\n * - Defining a floor price for all trades of type T.\n * - Prevent trading of locked items with low amounts (e.g. by using purchase_cap).\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::floor_price_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\tfloor_price: bcs.u64(),\n\t},\n});\nexport interface AddArguments {\n\tpolicy: RawTransactionArgument<string>;\n\tcap: RawTransactionArgument<string>;\n\tfloorPrice: RawTransactionArgument<number | bigint>;\n}\nexport interface AddOptions {\n\tpackage?: string;\n\targuments:\n\t\t| AddArguments\n\t\t| [\n\t\t\t\tpolicy: RawTransactionArgument<string>,\n\t\t\t\tcap: RawTransactionArgument<string>,\n\t\t\t\tfloorPrice: RawTransactionArgument<number | bigint>,\n\t\t  ];\n\ttypeArguments: [string];\n}\n/**\n * Creator action: Add the Floor Price Rule for the `T`. Pass in the\n * `TransferPolicy`, `TransferPolicyCap` and `floor_price`.\n */\nexport function add(options: AddOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null, null, 'u64'] satisfies (string | null)[];\n\tconst parameterNames = ['policy', 'cap', 'floorPrice'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'floor_price_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\tpolicy: RawTransactionArgument<string>;\n\trequest: TransactionArgument;\n}\nexport interface ProveOptions {\n\tpackage?: string;\n\targuments:\n\t\tProveArguments | [policy: RawTransactionArgument<string>, request: TransactionArgument];\n\ttypeArguments: [string];\n}\n/** Buyer action: Prove that the amount is higher or equal to the floor_price. */\nexport function prove(options: ProveOptions) {\n\tconst packageAddress = options.package ?? '@local-pkg/kiosk';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['policy', 'request'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'floor_price_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":";;;;;;;;;;;;;;;;;;;;AAqBA,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,KAAK,EACtB;CACD,CAAC;;;;;AAqBF,SAAgB,IAAI,SAAqB;CACxC,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB;EAAC;EAAM;EAAM;EAAM;CAC1C,MAAM,iBAAiB;EAAC;EAAU;EAAO;EAAa;AACtD,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,eAAe,QAAQ;EACvB,CAAC;;;AAaJ,SAAgB,MAAM,SAAuB;CAC5C,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB,CAAC,MAAM,KAAK;CACnC,MAAM,iBAAiB,CAAC,UAAU,UAAU;AAC5C,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,eAAe,QAAQ;EACvB,CAAC"}