{"version":3,"file":"tp-transaction.mjs","names":["transferPolicyContract._new","#setup","#validateInputs","royaltyRule.add","kioskLockRule.add","personalKioskRule.add","floorPriceRule.add","transferPolicyContract.removeRule"],"sources":["../../src/client/tp-transaction.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';\n\nimport * as royaltyRule from '../contracts/kiosk/royalty_rule.js';\nimport * as kioskLockRule from '../contracts/kiosk/kiosk_lock_rule.js';\nimport * as personalKioskRule from '../contracts/kiosk/personal_kiosk_rule.js';\nimport * as floorPriceRule from '../contracts/kiosk/floor_price_rule.js';\nimport * as transferPolicyContract from '../contracts/0x2/transfer_policy.js';\nimport { createTransferPolicy, withdrawFromPolicy } from '../tx/transfer-policy.js';\nimport type { ObjectArgument, TransferPolicyCap } from '../types/index.js';\nimport type { KioskClient } from './kiosk-client.js';\n\nexport type TransferPolicyBaseParams = {\n\ttype: string;\n\tpublisher: ObjectArgument;\n\tskipCheck?: boolean;\n};\n\nexport type TransferPolicyTransactionParams = {\n\tkioskClient: KioskClient;\n\ttransaction: Transaction;\n\tcap?: TransferPolicyCap;\n};\n\nexport class TransferPolicyTransaction {\n\ttransaction: Transaction;\n\tkioskClient: KioskClient;\n\tpolicy?: ObjectArgument;\n\tpolicyCap?: ObjectArgument;\n\ttype?: string;\n\n\tconstructor({ kioskClient, transaction, cap }: TransferPolicyTransactionParams) {\n\t\tthis.kioskClient = kioskClient;\n\t\tthis.transaction = transaction;\n\t\tif (cap) this.setCap(cap);\n\t}\n\n\t/**\n\t * A function to create a new transfer policy.\n\t * Checks if there's already an existing transfer policy to prevent\n\t * double transfer polciy mistakes.\n\t * There's an optional `skipCheck` flag that will just create the policy\n\t * without checking\n\t *\n\t * @param type The Type (`T`) for which we're creating the transfer policy.\n\t * @param publisher The Publisher Object Id.\n\t * @param address Address to save the `TransferPolicyCap` object to.\n\t * @param skipCheck (Optional) skip checking if a transfer policy already exists\n\t */\n\tasync createAndShare({\n\t\ttype,\n\t\tpublisher,\n\t\taddress,\n\t\tskipCheck,\n\t}: TransferPolicyBaseParams & {\n\t\taddress: string;\n\t}) {\n\t\tif (!skipCheck) {\n\t\t\tconst policies = await this.kioskClient.getTransferPolicies({ type });\n\t\t\tif (policies.length > 0) throw new Error(\"There's already transfer policy for this Type.\");\n\t\t}\n\t\tconst cap = createTransferPolicy(this.transaction, type, publisher);\n\t\tthis.transaction.transferObjects([cap], address);\n\t}\n\n\t/**\n\t * A convenient function to create a Transfer Policy and attach some rules\n\t * before sharing it (so you can prepare it in a single PTB)\n\t * @param type The Type (`T`) for which we're creating the transfer policy.\n\t * @param publisher The Publisher Object Id.\n\t * @param address Address to save the `TransferPolicyCap` object to.\n\t * @param skipCheck (Optional) skip checking if a transfer policy already exists\n\t */\n\tasync create({\n\t\ttype,\n\t\tpublisher,\n\t\tskipCheck,\n\t}: TransferPolicyBaseParams): Promise<TransferPolicyTransaction> {\n\t\tif (!skipCheck) {\n\t\t\tconst policies = await this.kioskClient.getTransferPolicies({ type });\n\t\t\tif (policies.length > 0) throw new Error(\"There's already transfer policy for this Type.\");\n\t\t}\n\t\tconst publisherArg =\n\t\t\ttypeof publisher === 'string' ? this.transaction.object(publisher) : publisher;\n\t\tconst [policy, policyCap] = this.transaction.add(\n\t\t\ttransferPolicyContract._new({\n\t\t\t\targuments: [publisherArg],\n\t\t\t\ttypeArguments: [type],\n\t\t\t}),\n\t\t);\n\n\t\tthis.#setup(policy, policyCap, type); // sets the client's TP to the newly created one.\n\t\treturn this;\n\t}\n\n\t/**\n\t * This can be called after calling the `create` function to share the `TransferPolicy`,\n\t * and transfer the `TransferPolicyCap` to the specified address\n\t *\n\t * @param address The address to transfer the `TransferPolicyCap`\n\t */\n\tshareAndTransferCap(address: string) {\n\t\tif (!this.type || !this.policyCap || !this.policy)\n\t\t\tthrow new Error('This function can only be called after `transferPolicyManager.create`');\n\n\t\tthis.transaction.moveCall({\n\t\t\ttarget: '0x2::transfer::public_share_object',\n\t\t\targuments: [\n\t\t\t\ttypeof this.policy === 'string' ? this.transaction.object(this.policy) : this.policy,\n\t\t\t],\n\t\t\ttypeArguments: [`0x2::transfer_policy::TransferPolicy<${this.type}>`],\n\t\t});\n\t\tthis.transaction.transferObjects(\n\t\t\t[\n\t\t\t\ttypeof this.policyCap === 'string'\n\t\t\t\t\t? this.transaction.object(this.policyCap)\n\t\t\t\t\t: this.policyCap,\n\t\t\t],\n\t\t\taddress,\n\t\t);\n\t}\n\n\t/**\n\t * Setup the TransferPolicy by passing a `cap` returned from `kioskClient.getOwnedTransferPolicies` or\n\t * `kioskClient.getOwnedTransferPoliciesByType`.\n\t * @param policyCapId The `TransferPolicyCap`\n\t */\n\tsetCap({ policyId, policyCapId, type }: TransferPolicyCap) {\n\t\treturn this.#setup(policyId, policyCapId, type);\n\t}\n\n\t/**\n\t * Withdraw from the transfer policy's profits.\n\t * @param address Address to transfer the profits to.\n\t * @param amount (Optional) amount parameter. Will withdraw all profits if the amount is not specified.\n\t */\n\twithdraw(address: string, amount?: string | bigint) {\n\t\tthis.#validateInputs();\n\t\t// Withdraw coin for specified amount (or none)\n\t\tconst coin = withdrawFromPolicy(\n\t\t\tthis.transaction,\n\t\t\tthis.type!,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\n\t\t\tamount,\n\t\t);\n\n\t\tthis.transaction.transferObjects([coin], address);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t *  Adds the Kiosk Royalty rule to the Transfer Policy.\n\t *  You can pass the percentage, as well as a minimum amount.\n\t *  The royalty that will be paid is the MAX(percentage, minAmount).\n\t * \tYou can pass 0 in either value if you want only percentage royalty, or a fixed amount fee.\n\t * \t(but you should define at least one of them for the rule to make sense).\n\t *\n\t * \t@param percentageBps The royalty percentage in basis points. Use `percentageToBasisPoints` helper to convert from percentage [0,100].\n\t * \t@param minAmount The minimum royalty amount per request in MIST.\n\t */\n\taddRoyaltyRule(\n\t\tpercentageBps: number | string, // this is in basis points.\n\t\tminAmount: number | string,\n\t) {\n\t\tthis.#validateInputs();\n\n\t\tconst policyArg =\n\t\t\ttypeof this.policy === 'string'\n\t\t\t\t? this.transaction.object(this.policy)\n\t\t\t\t: (this.policy as TransactionObjectArgument);\n\t\tconst policyCapArg =\n\t\t\ttypeof this.policyCap === 'string'\n\t\t\t\t? this.transaction.object(this.policyCap)\n\t\t\t\t: (this.policyCap as TransactionObjectArgument);\n\n\t\tconst packageId = this.kioskClient.getRulePackageId('royaltyRulePackageId');\n\n\t\tthis.transaction.add(\n\t\t\troyaltyRule.add({\n\t\t\t\tpackage: packageId,\n\t\t\t\targuments: {\n\t\t\t\t\tpolicy: policyArg,\n\t\t\t\t\tcap: policyCapArg,\n\t\t\t\t\tamountBp: Number(percentageBps),\n\t\t\t\t\tminAmount: typeof minAmount === 'string' ? BigInt(minAmount) : BigInt(minAmount),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [this.type!],\n\t\t\t}),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds the Kiosk Lock Rule to the Transfer Policy.\n\t * This Rule forces buyer to lock the item in the kiosk, preserving strong royalties.\n\t */\n\taddLockRule() {\n\t\tthis.#validateInputs();\n\n\t\tconst policyArg =\n\t\t\ttypeof this.policy === 'string'\n\t\t\t\t? this.transaction.object(this.policy)\n\t\t\t\t: (this.policy as TransactionObjectArgument);\n\t\tconst policyCapArg =\n\t\t\ttypeof this.policyCap === 'string'\n\t\t\t\t? this.transaction.object(this.policyCap)\n\t\t\t\t: (this.policyCap as TransactionObjectArgument);\n\n\t\tconst packageId = this.kioskClient.getRulePackageId('kioskLockRulePackageId');\n\n\t\tthis.transaction.add(\n\t\t\tkioskLockRule.add({\n\t\t\t\tpackage: packageId,\n\t\t\t\targuments: {\n\t\t\t\t\tpolicy: policyArg,\n\t\t\t\t\tcap: policyCapArg,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [this.type!],\n\t\t\t}),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Attaches the Personal Kiosk Rule, making a purchase valid only for `SoulBound` kiosks.\n\t */\n\taddPersonalKioskRule() {\n\t\tthis.#validateInputs();\n\n\t\tconst policyArg =\n\t\t\ttypeof this.policy === 'string'\n\t\t\t\t? this.transaction.object(this.policy)\n\t\t\t\t: (this.policy as TransactionObjectArgument);\n\t\tconst policyCapArg =\n\t\t\ttypeof this.policyCap === 'string'\n\t\t\t\t? this.transaction.object(this.policyCap)\n\t\t\t\t: (this.policyCap as TransactionObjectArgument);\n\n\t\tconst packageId = this.kioskClient.getRulePackageId('personalKioskRulePackageId');\n\n\t\tthis.transaction.add(\n\t\t\tpersonalKioskRule.add({\n\t\t\t\tpackage: packageId,\n\t\t\t\targuments: {\n\t\t\t\t\tpolicy: policyArg,\n\t\t\t\t\tcap: policyCapArg,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [this.type!],\n\t\t\t}),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * A function to add the floor price rule to a transfer policy.\n\t * @param minPrice The minimum price in MIST.\n\t */\n\taddFloorPriceRule(minPrice: string | bigint) {\n\t\tthis.#validateInputs();\n\n\t\tconst policyArg =\n\t\t\ttypeof this.policy === 'string'\n\t\t\t\t? this.transaction.object(this.policy)\n\t\t\t\t: (this.policy as TransactionObjectArgument);\n\t\tconst policyCapArg =\n\t\t\ttypeof this.policyCap === 'string'\n\t\t\t\t? this.transaction.object(this.policyCap)\n\t\t\t\t: (this.policyCap as TransactionObjectArgument);\n\n\t\tconst packageId = this.kioskClient.getRulePackageId('floorPriceRulePackageId');\n\n\t\tthis.transaction.add(\n\t\t\tfloorPriceRule.add({\n\t\t\t\tpackage: packageId,\n\t\t\t\targuments: {\n\t\t\t\t\tpolicy: policyArg,\n\t\t\t\t\tcap: policyCapArg,\n\t\t\t\t\tfloorPrice: typeof minPrice === 'string' ? BigInt(minPrice) : minPrice,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [this.type!],\n\t\t\t}),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Generic helper to remove a rule, not from the SDK's base ruleset.\n\t * @param ruleType The Rule Type\n\t * @param configType The Config Type\n\t */\n\tremoveRule({ ruleType, configType }: { ruleType: string; configType: string }) {\n\t\tthis.#validateInputs();\n\n\t\tthis.transaction.add(\n\t\t\ttransferPolicyContract.removeRule({\n\t\t\t\targuments: [this.policy!, this.policyCap!],\n\t\t\t\ttypeArguments: [this.type!, ruleType, configType],\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Removes the lock rule.\n\t */\n\tremoveLockRule() {\n\t\tthis.#validateInputs();\n\n\t\tconst packageId = this.kioskClient.getRulePackageId('kioskLockRulePackageId');\n\n\t\tthis.transaction.add(\n\t\t\ttransferPolicyContract.removeRule({\n\t\t\t\targuments: [this.policy!, this.policyCap!],\n\t\t\t\ttypeArguments: [\n\t\t\t\t\tthis.type!,\n\t\t\t\t\t`${packageId}::kiosk_lock_rule::Rule`,\n\t\t\t\t\t`${packageId}::kiosk_lock_rule::Config`,\n\t\t\t\t],\n\t\t\t}),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes the Royalty rule\n\t */\n\tremoveRoyaltyRule() {\n\t\tthis.#validateInputs();\n\n\t\tconst packageId = this.kioskClient.getRulePackageId('royaltyRulePackageId');\n\n\t\tthis.transaction.add(\n\t\t\ttransferPolicyContract.removeRule({\n\t\t\t\targuments: [this.policy!, this.policyCap!],\n\t\t\t\ttypeArguments: [\n\t\t\t\t\tthis.type!,\n\t\t\t\t\t`${packageId}::royalty_rule::Rule`,\n\t\t\t\t\t`${packageId}::royalty_rule::Config`,\n\t\t\t\t],\n\t\t\t}),\n\t\t);\n\t\treturn this;\n\t}\n\n\tremovePersonalKioskRule() {\n\t\tthis.#validateInputs();\n\n\t\tconst packageId = this.kioskClient.getRulePackageId('personalKioskRulePackageId');\n\n\t\tthis.transaction.add(\n\t\t\ttransferPolicyContract.removeRule({\n\t\t\t\targuments: [this.policy!, this.policyCap!],\n\t\t\t\ttypeArguments: [this.type!, `${packageId}::personal_kiosk_rule::Rule`, `bool`],\n\t\t\t}),\n\t\t);\n\t\treturn this;\n\t}\n\n\tremoveFloorPriceRule() {\n\t\tthis.#validateInputs();\n\n\t\tconst packageId = this.kioskClient.getRulePackageId('floorPriceRulePackageId');\n\n\t\tthis.transaction.add(\n\t\t\ttransferPolicyContract.removeRule({\n\t\t\t\targuments: [this.policy!, this.policyCap!],\n\t\t\t\ttypeArguments: [\n\t\t\t\t\tthis.type!,\n\t\t\t\t\t`${packageId}::floor_price_rule::Rule`,\n\t\t\t\t\t`${packageId}::floor_price_rule::Config`,\n\t\t\t\t],\n\t\t\t}),\n\t\t);\n\t\treturn this;\n\t}\n\n\tgetPolicy() {\n\t\tif (!this.policy) throw new Error('Policy not set.');\n\t\treturn this.policy;\n\t}\n\n\tgetPolicyCap() {\n\t\tif (!this.policyCap) throw new Error('Transfer Policy Cap not set.');\n\t\treturn this.policyCap;\n\t}\n\n\t// Internal function that that the policy's Id + Cap + type have been set.\n\t#validateInputs() {\n\t\tconst genericErrorMessage = `Please use 'setCap()' to setup the TransferPolicy.`;\n\t\tif (!this.policy) throw new Error(`${genericErrorMessage} Missing: Transfer Policy Object.`);\n\t\tif (!this.policyCap)\n\t\t\tthrow new Error(`${genericErrorMessage} Missing: TransferPolicyCap Object ID`);\n\t\tif (!this.type)\n\t\t\tthrow new Error(\n\t\t\t\t`${genericErrorMessage} Missing: Transfer Policy object type (e.g. {packageId}::item::Item)`,\n\t\t\t);\n\t}\n\n\t/**\n\t * Setup the state of the TransferPolicyTransaction.\n\t */\n\t#setup(policyId: ObjectArgument, policyCap: ObjectArgument, type: string) {\n\t\tthis.policy = policyId;\n\t\tthis.policyCap = policyCap;\n\t\tthis.type = type;\n\t\treturn this;\n\t}\n}\n"],"mappings":";;;;;;;;AA0BA,IAAa,4BAAb,MAAuC;CAOtC,YAAY,EAAE,aAAa,aAAa,OAAwC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