{"version":3,"file":"transfer-policy.mjs","names":[],"sources":["../../src/types/transfer-policy.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ObjectOwner } from '@mysten/sui/jsonRpc';\nimport type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';\n\nimport type { KioskClient } from '../client/kiosk-client.js';\nimport type { ObjectArgument } from './index.js';\n\nimport { SUI_FRAMEWORK_ADDRESS } from '@mysten/sui/utils';\n\n/** The Transfer Policy module. */\nexport const TRANSFER_POLICY_MODULE = `${SUI_FRAMEWORK_ADDRESS}::transfer_policy`;\n\n/** Name of the event emitted when a TransferPolicy for T is created. */\nexport const TRANSFER_POLICY_CREATED_EVENT = `${TRANSFER_POLICY_MODULE}::TransferPolicyCreated`;\n\n/** The Transfer Policy Type */\nexport const TRANSFER_POLICY_TYPE = `${TRANSFER_POLICY_MODULE}::TransferPolicy`;\n\n/** The Transfer Policy Cap Type */\nexport const TRANSFER_POLICY_CAP_TYPE = `${TRANSFER_POLICY_MODULE}::TransferPolicyCap`;\n\n/** The Kiosk Lock Rule */\nexport const KIOSK_LOCK_RULE = 'kiosk_lock_rule::Rule';\n\n/** The Royalty rule */\nexport const ROYALTY_RULE = 'royalty_rule::Rule';\n\n/**\n * The Transfer Policy Cap in a consumable way.\n */\nexport type TransferPolicyCap = {\n\tpolicyId: string;\n\tpolicyCapId: string;\n\ttype: string;\n};\n\n/** The `TransferPolicy` object */\nexport type TransferPolicy = {\n\tid: string;\n\ttype: string;\n\tbalance: string;\n\trules: string[];\n\towner: ObjectOwner;\n};\n\n/** Event emitted when a TransferPolicy is created. */\nexport type TransferPolicyCreated = {\n\tid: string;\n};\n\n// The object a Rule resolving function accepts\n// It can accept a set of fixed fields, that are part of every purchase flow as well any extra arguments to resolve custom policies!\n// Each rule resolving function should check that the key it's seeking is in the object\n// e.g. `if(!'my_key' in ruleParams!) throw new Error(\"Can't resolve that rule!\")`\nexport type RuleResolvingParams = {\n\ttransaction: Transaction;\n\titemType: string;\n\titemId: string;\n\tprice: string;\n\tpolicyId: ObjectArgument;\n\tsellerKiosk: ObjectArgument;\n\tkiosk: ObjectArgument;\n\tkioskCap: ObjectArgument;\n\ttransferRequest: TransactionObjectArgument;\n\tpurchasedItem: TransactionObjectArgument;\n\tpackageId: string;\n\textraArgs: Record<string, any>; // extraParams contains more possible {key, values} to pass for custom rules.\n\tkioskClient: KioskClient;\n};\n"],"mappings":";;;;AAYA,MAAa,yBAAyB,GAAG,sBAAsB;;AAG/D,MAAa,gCAAgC,GAAG,uBAAuB;;AAGvE,MAAa,uBAAuB,GAAG,uBAAuB;;AAG9D,MAAa,2BAA2B,GAAG,uBAAuB;;AAGlE,MAAa,kBAAkB;;AAG/B,MAAa,eAAe"}