@mysten/kiosk 0.0.0-experimental-20231212183109 → 0.0.0-experimental-20240104225555

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.md +13 -2
  2. package/dist/cjs/bcs.js +47 -0
  3. package/dist/cjs/bcs.js.map +7 -0
  4. package/dist/cjs/client/kiosk-client.js +126 -0
  5. package/dist/cjs/client/kiosk-client.js.map +7 -0
  6. package/dist/cjs/client/kiosk-transaction.js +489 -0
  7. package/dist/cjs/client/kiosk-transaction.js.map +7 -0
  8. package/dist/cjs/client/tp-transaction.js +317 -0
  9. package/dist/cjs/client/tp-transaction.js.map +7 -0
  10. package/dist/cjs/constants.js +102 -0
  11. package/dist/cjs/constants.js.map +7 -0
  12. package/dist/cjs/index.js +24 -0
  13. package/dist/cjs/index.js.map +7 -0
  14. package/dist/cjs/package.json +5 -0
  15. package/dist/cjs/query/kiosk.js +124 -0
  16. package/dist/cjs/query/kiosk.js.map +7 -0
  17. package/dist/cjs/query/transfer-policy.js +94 -0
  18. package/dist/cjs/query/transfer-policy.js.map +7 -0
  19. package/dist/cjs/tx/kiosk.js +130 -0
  20. package/dist/cjs/tx/kiosk.js.map +7 -0
  21. package/dist/cjs/tx/personal-kiosk.js +38 -0
  22. package/dist/cjs/tx/personal-kiosk.js.map +7 -0
  23. package/dist/cjs/tx/rules/attach.js +62 -0
  24. package/dist/cjs/tx/rules/attach.js.map +7 -0
  25. package/dist/cjs/tx/rules/resolve.js +81 -0
  26. package/dist/cjs/tx/rules/resolve.js.map +7 -0
  27. package/dist/cjs/tx/transfer-policy.js +78 -0
  28. package/dist/cjs/tx/transfer-policy.js.map +7 -0
  29. package/dist/cjs/types/index.js +33 -0
  30. package/dist/cjs/types/index.js.map +7 -0
  31. package/dist/cjs/types/kiosk.js +37 -0
  32. package/dist/cjs/types/kiosk.js.map +7 -0
  33. package/dist/cjs/types/transfer-policy.js +35 -0
  34. package/dist/cjs/types/transfer-policy.js.map +7 -0
  35. package/dist/cjs/utils.js +203 -0
  36. package/dist/cjs/utils.js.map +7 -0
  37. package/dist/esm/bcs.d.ts +2 -0
  38. package/dist/esm/bcs.js +32 -0
  39. package/dist/esm/bcs.js.map +7 -0
  40. package/dist/esm/client/kiosk-client.d.ts +73 -0
  41. package/dist/esm/client/kiosk-client.js +119 -0
  42. package/dist/esm/client/kiosk-client.js.map +7 -0
  43. package/dist/esm/client/kiosk-transaction.d.ts +182 -0
  44. package/dist/esm/client/kiosk-transaction.js +459 -0
  45. package/dist/esm/client/kiosk-transaction.js.map +7 -0
  46. package/dist/esm/client/tp-transaction.d.ts +112 -0
  47. package/dist/esm/client/tp-transaction.js +308 -0
  48. package/dist/esm/client/tp-transaction.js.map +7 -0
  49. package/dist/esm/constants.d.ts +30 -0
  50. package/dist/esm/constants.js +87 -0
  51. package/dist/esm/constants.js.map +7 -0
  52. package/dist/esm/index.d.ts +6 -0
  53. package/dist/esm/index.js +7 -0
  54. package/dist/esm/index.js.map +7 -0
  55. package/dist/esm/package.json +5 -0
  56. package/dist/esm/query/kiosk.d.ts +14 -0
  57. package/dist/esm/query/kiosk.js +114 -0
  58. package/dist/esm/query/kiosk.js.map +7 -0
  59. package/dist/esm/query/transfer-policy.d.ts +28 -0
  60. package/dist/esm/query/transfer-policy.js +78 -0
  61. package/dist/esm/query/transfer-policy.js.map +7 -0
  62. package/dist/esm/tx/kiosk.d.ts +71 -0
  63. package/dist/esm/tx/kiosk.js +110 -0
  64. package/dist/esm/tx/kiosk.js.map +7 -0
  65. package/dist/esm/tx/personal-kiosk.d.ts +7 -0
  66. package/dist/esm/tx/personal-kiosk.js +18 -0
  67. package/dist/esm/tx/personal-kiosk.js.map +7 -0
  68. package/dist/esm/tx/rules/attach.d.ts +7 -0
  69. package/dist/esm/tx/rules/attach.js +42 -0
  70. package/dist/esm/tx/rules/attach.js.map +7 -0
  71. package/dist/esm/tx/rules/resolve.d.ts +15 -0
  72. package/dist/esm/tx/rules/resolve.js +61 -0
  73. package/dist/esm/tx/rules/resolve.js.map +7 -0
  74. package/dist/esm/tx/transfer-policy.d.ts +29 -0
  75. package/dist/esm/tx/transfer-policy.js +58 -0
  76. package/dist/esm/tx/transfer-policy.js.map +7 -0
  77. package/dist/esm/types/index.d.ts +27 -0
  78. package/dist/esm/types/index.js +12 -0
  79. package/dist/esm/types/index.js.map +7 -0
  80. package/dist/esm/types/kiosk.d.ts +160 -0
  81. package/dist/esm/types/kiosk.js +17 -0
  82. package/dist/esm/types/kiosk.js.map +7 -0
  83. package/dist/esm/types/transfer-policy.d.ts +49 -0
  84. package/dist/esm/types/transfer-policy.js +15 -0
  85. package/dist/esm/types/transfer-policy.js.map +7 -0
  86. package/dist/esm/utils.d.ts +51 -0
  87. package/dist/esm/utils.js +186 -0
  88. package/dist/esm/utils.js.map +7 -0
  89. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  90. package/dist/tsconfig.tsbuildinfo +1 -0
  91. package/package.json +17 -19
  92. package/dist/index.js +0 -1643
  93. package/dist/index.js.map +0 -1
  94. package/dist/index.mjs +0 -1582
  95. package/dist/index.mjs.map +0 -1
  96. /package/dist/{bcs.d.ts → cjs/bcs.d.ts} +0 -0
  97. /package/dist/{client → cjs/client}/kiosk-client.d.ts +0 -0
  98. /package/dist/{client → cjs/client}/kiosk-transaction.d.ts +0 -0
  99. /package/dist/{client → cjs/client}/tp-transaction.d.ts +0 -0
  100. /package/dist/{constants.d.ts → cjs/constants.d.ts} +0 -0
  101. /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  102. /package/dist/{query → cjs/query}/kiosk.d.ts +0 -0
  103. /package/dist/{query → cjs/query}/transfer-policy.d.ts +0 -0
  104. /package/dist/{tx → cjs/tx}/kiosk.d.ts +0 -0
  105. /package/dist/{tx → cjs/tx}/personal-kiosk.d.ts +0 -0
  106. /package/dist/{tx → cjs/tx}/rules/attach.d.ts +0 -0
  107. /package/dist/{tx → cjs/tx}/rules/resolve.d.ts +0 -0
  108. /package/dist/{tx → cjs/tx}/transfer-policy.d.ts +0 -0
  109. /package/dist/{types → cjs/types}/index.d.ts +0 -0
  110. /package/dist/{types → cjs/types}/kiosk.d.ts +0 -0
  111. /package/dist/{types → cjs/types}/transfer-policy.d.ts +0 -0
  112. /package/dist/{utils.d.ts → cjs/utils.d.ts} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/client/kiosk-transaction.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n\tTransactionObjectArgument,\n\ttype TransactionArgument,\n\ttype TransactionBlock,\n} from '@mysten/sui.js/transactions';\n\nimport * as kioskTx from '../tx/kiosk';\nimport { convertToPersonalTx, transferPersonalCapTx } from '../tx/personal-kiosk';\nimport { confirmRequest } from '../tx/transfer-policy';\nimport {\n\tItemId,\n\tItemReference,\n\tItemValue,\n\tKioskOwnerCap,\n\tObjectArgument,\n\tPrice,\n\tPurchaseOptions,\n} from '../types';\nimport { getNormalizedRuleType } from '../utils';\nimport { type KioskClient } from './kiosk-client';\n\nexport type KioskTransactionParams = {\n\t/** The TransactionBlock for this run */\n\ttransactionBlock: TransactionBlock;\n\t/**\n\t * You can create a new KioskClient by calling `new KioskClient()`\n\t */\n\tkioskClient: KioskClient;\n\t/**\n\t * You can optionally pass in the `cap` as returned\n\t * from `kioskClient.getOwnedKiosks` when initializing the client\n\t * Otherwise, you can set it by calling `kioskTransaction.setCap()`\n\t */\n\tcap?: KioskOwnerCap;\n};\n\n/**\n * A helper for building transactions that involve kiosk.\n */\nexport class KioskTransaction {\n\ttransactionBlock: TransactionBlock;\n\tkioskClient: KioskClient;\n\tkiosk?: TransactionObjectArgument;\n\tkioskCap?: TransactionObjectArgument;\n\t// If we're pending `share` of a new kiosk, `finalize()` will share it.\n\t#pendingShare?: boolean;\n\t// If we're pending transferring of the cap, `finalize()` will either error or transfer the cap if it's a new personal.\n\t#pendingTransfer?: boolean;\n\t// The promise that the personalCap will be returned on `finalize()`.\n\t#promise?: TransactionArgument | undefined;\n\t// The personal kiosk argument.\n\t#personalCap?: TransactionObjectArgument;\n\t// A flag that checks whether kiosk TX is finalized.\n\t#finalized: boolean = false;\n\n\tconstructor({ transactionBlock, kioskClient, cap }: KioskTransactionParams) {\n\t\tthis.transactionBlock = transactionBlock;\n\t\tthis.kioskClient = kioskClient;\n\n\t\tif (cap) this.setCap(cap);\n\t}\n\n\t/**\n\t * Creates a kiosk and saves `kiosk` and `kioskOwnerCap` in state.\n\t * Helpful if we want to chain some actions before sharing + transferring the cap to the specified address.\n\t * @param borrow If true, the `kioskOwnerCap` is borrowed from the `PersonalKioskCap` to be used in next transactions.\n\t */\n\tcreate() {\n\t\tthis.#validateFinalizedStatus();\n\t\tthis.#setPendingStatuses({\n\t\t\tshare: true,\n\t\t\ttransfer: true,\n\t\t});\n\t\tconst [kiosk, cap] = kioskTx.createKiosk(this.transactionBlock);\n\t\tthis.kiosk = kiosk;\n\t\tthis.kioskCap = cap;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates a personal kiosk & shares it.\n\t * The `PersonalKioskCap` is transferred to the signer.\n\t * @param borrow If true, the `kioskOwnerCap` is borrowed from the `PersonalKioskCap` to be used in next transactions.\n\t */\n\tcreatePersonal(borrow?: boolean) {\n\t\tthis.#pendingShare = true;\n\t\treturn this.create().convertToPersonal(borrow);\n\t}\n\n\t/**\n\t * Converts a kiosk to a Personal (Soulbound) Kiosk.\n\t * Requires initialization by either calling `ktxb.create()` or `ktxb.setCap()`.\n\t */\n\tconvertToPersonal(borrow?: boolean) {\n\t\tthis.#validateKioskIsSet();\n\n\t\tconst cap = convertToPersonalTx(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.kiosk!,\n\t\t\tthis.kioskCap!,\n\t\t\tthis.kioskClient.getRulePackageId('personalKioskRulePackageId'),\n\t\t);\n\n\t\t// if we enable `borrow`, we borrow the kioskCap from the cap.\n\t\tif (borrow) this.#borrowFromPersonalCap(cap);\n\t\telse this.#personalCap = cap;\n\n\t\tthis.#setPendingStatuses({ transfer: true });\n\t\treturn this;\n\t}\n\n\t/**\n\t * Single function way to create a kiosk, share it and transfer the cap to the specified address.\n\t */\n\tcreateAndShare(address: string) {\n\t\tthis.#validateFinalizedStatus();\n\t\tconst cap = kioskTx.createKioskAndShare(this.transactionBlock);\n\t\tthis.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address));\n\t}\n\n\t/**\n\t * Shares the kiosk.\n\t */\n\tshare() {\n\t\tthis.#validateKioskIsSet();\n\t\tthis.#setPendingStatuses({ share: false });\n\t\tkioskTx.shareKiosk(this.transactionBlock, this.kiosk!);\n\t}\n\n\t/**\n\t * Should be called only after `create` is called.\n\t * It shares the kiosk & transfers the cap to the specified address.\n\t */\n\tshareAndTransferCap(address: string) {\n\t\tif (this.#personalCap)\n\t\t\tthrow new Error('You can only call `shareAndTransferCap` on a non-personal kiosk.');\n\t\tthis.#setPendingStatuses({ transfer: false });\n\t\tthis.share();\n\t\tthis.transactionBlock.transferObjects(\n\t\t\t[this.kioskCap!],\n\t\t\tthis.transactionBlock.pure.address(address),\n\t\t);\n\t}\n\n\t/**\n\t * A function to borrow an item from a kiosk & execute any function with it.\n\t * Example: You could borrow a Fren out of a kiosk, attach an accessory (or mix), and return it.\n\t */\n\tborrowTx({ itemType, itemId }: ItemId, callback: (item: TransactionArgument) => void) {\n\t\tthis.#validateKioskIsSet();\n\t\tconst [itemObj, promise] = kioskTx.borrowValue(\n\t\t\tthis.transactionBlock,\n\t\t\titemType,\n\t\t\tthis.kiosk!,\n\t\t\tthis.kioskCap!,\n\t\t\titemId,\n\t\t);\n\n\t\tcallback(itemObj);\n\n\t\tthis.return({ itemType, item: itemObj, promise });\n\t}\n\n\t/**\n\t * Borrows an item from the kiosk.\n\t * This will fail if the item is listed for sale.\n\t *\n\t * Requires calling `return`.\n\t */\n\tborrow({ itemType, itemId }: ItemId): [TransactionArgument, TransactionArgument] {\n\t\tthis.#validateKioskIsSet();\n\t\tconst [itemObj, promise] = kioskTx.borrowValue(\n\t\t\tthis.transactionBlock,\n\t\t\titemType,\n\t\t\tthis.kiosk!,\n\t\t\tthis.kioskCap!,\n\t\t\titemId,\n\t\t);\n\n\t\treturn [itemObj, promise];\n\t}\n\n\t/**\n\t * Returns the item back to the kiosk.\n\t * Accepts the parameters returned from the `borrow` function.\n\t */\n\treturn({ itemType, item, promise }: ItemValue & { promise: TransactionArgument }) {\n\t\tthis.#validateKioskIsSet();\n\t\tkioskTx.returnValue(this.transactionBlock, itemType, this.kiosk!, item, promise);\n\t\treturn this;\n\t}\n\n\t/**\n\t * A function to withdraw from kiosk\n\t * @param address Where to trasnfer the coin.\n\t * @param amount The amount we aim to withdraw.\n\t */\n\twithdraw(address: string, amount?: string | bigint | number) {\n\t\tthis.#validateKioskIsSet();\n\t\tconst coin = kioskTx.withdrawFromKiosk(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.kiosk!,\n\t\t\tthis.kioskCap!,\n\t\t\tamount,\n\t\t);\n\t\tthis.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address));\n\t\treturn this;\n\t}\n\n\t/**\n\t * A function to place an item in the kiosk.\n\t * @param itemType The type `T` of the item\n\t * @param item The ID or Transaction Argument of the item\n\t */\n\tplace({ itemType, item }: ItemReference) {\n\t\tthis.#validateKioskIsSet();\n\t\tkioskTx.place(this.transactionBlock, itemType, this.kiosk!, this.kioskCap!, item);\n\t\treturn this;\n\t}\n\n\t/**\n\t * A function to place an item in the kiosk and list it for sale in one transaction.\n\t * @param itemType The type `T` of the item\n\t * @param item The ID or Transaction Argument of the item\n\t * @param price The price in MIST\n\t */\n\tplaceAndList({ itemType, item, price }: ItemReference & Price) {\n\t\tthis.#validateKioskIsSet();\n\t\tkioskTx.placeAndList(this.transactionBlock, itemType, this.kiosk!, this.kioskCap!, item, price);\n\t\treturn this;\n\t}\n\n\t/**\n\t * A function to list an item in the kiosk.\n\t * @param itemType The type `T` of the item\n\t * @param itemId The ID of the item\n\t * @param price The price in MIST\n\t */\n\tlist({ itemType, itemId, price }: ItemId & { price: string | bigint }) {\n\t\tthis.#validateKioskIsSet();\n\t\tkioskTx.list(this.transactionBlock, itemType, this.kiosk!, this.kioskCap!, itemId, price);\n\t\treturn this;\n\t}\n\n\t/**\n\t * A function to delist an item from the kiosk.\n\t * @param itemType The type `T` of the item\n\t * @param itemId The ID of the item\n\t */\n\tdelist({ itemType, itemId }: ItemId) {\n\t\tthis.#validateKioskIsSet();\n\t\tkioskTx.delist(this.transactionBlock, itemType, this.kiosk!, this.kioskCap!, itemId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * A function to take an item from the kiosk. The transaction won't succeed if the item is listed or locked.\n\n\t * @param itemType The type `T` of the item\n\t * @param itemId The ID of the item\n\t */\n\ttake({ itemType, itemId }: ItemId): TransactionObjectArgument {\n\t\tthis.#validateKioskIsSet();\n\t\treturn kioskTx.take(this.transactionBlock, itemType, this.kiosk!, this.kioskCap!, itemId);\n\t}\n\n\t/**\n\t * Transfer a non-locked/non-listed item to an address.\n\t *\n\t * @param itemType The type `T` of the item\n\t * @param itemId The ID of the item\n\t * @param address The destination address\n\t */\n\ttransfer({ itemType, itemId, address }: ItemId & { address: string }) {\n\t\tthis.#validateKioskIsSet();\n\t\tconst item = this.take({ itemType, itemId });\n\t\tthis.transactionBlock.transferObjects([item], this.transactionBlock.pure.address(address));\n\t\treturn this;\n\t}\n\n\t/**\n\t * A function to take lock an item in the kiosk.\n\n\t * @param itemType The type `T` of the item\n\t * @param itemId The ID of the item\n\t * @param policy The Policy ID or Transaction Argument for item T\n\t */\n\tlock({ itemType, itemId, policy }: ItemId & { policy: ObjectArgument }) {\n\t\tthis.#validateKioskIsSet();\n\t\tkioskTx.lock(this.transactionBlock, itemType, this.kiosk!, this.kioskCap!, policy, itemId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Purchase an item from a seller's kiosk.\n\t * Returns [item, transferRequest]\n\t * Can be called like: `const [item, transferRequest] = kioskTx.purchase({...})`\n\t * @param itemType The type `T` of the item\n\t * @param itemId The ID of the item\n\t * @param price The price in MIST\n\t * @param sellerKiosk The kiosk which is selling the item. Can be an id or an object argument.\n\t */\n\tpurchase({\n\t\titemType,\n\t\titemId,\n\t\tprice,\n\t\tsellerKiosk,\n\t}: ItemId & Price & { sellerKiosk: ObjectArgument }): [\n\t\tTransactionObjectArgument,\n\t\tTransactionObjectArgument,\n\t] {\n\t\t// Split the coin for the amount of the listing.\n\t\tconst coin = this.transactionBlock.splitCoins(this.transactionBlock.gas, [\n\t\t\tthis.transactionBlock.pure.u64(price),\n\t\t]);\n\t\treturn kioskTx.purchase(this.transactionBlock, itemType, sellerKiosk, itemId, coin);\n\t}\n\n\t/**\n\t * A function to purchase and resolve a transfer policy.\n\t * If the transfer policy has the `lock` rule, the item is locked in the kiosk.\n\t * Otherwise, the item is placed in the kiosk.\n\t * @param itemType The type of the item\n\t * @param itemId The id of the item\n\t * @param price The price of the specified item\n\t * @param sellerKiosk The kiosk which is selling the item. Can be an id or an object argument.\n\t * @param extraArgs Used to pass arguments for custom rule resolvers.\n\t */\n\tasync purchaseAndResolve({\n\t\titemType,\n\t\titemId,\n\t\tprice,\n\t\tsellerKiosk,\n\t\textraArgs,\n\t}: ItemId & Price & { sellerKiosk: ObjectArgument } & PurchaseOptions) {\n\t\tthis.#validateKioskIsSet();\n\t\t// Get a list of the transfer policies.\n\t\tconst policies = await this.kioskClient.getTransferPolicies({ type: itemType });\n\n\t\tif (policies.length === 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`The type ${itemType} doesn't have a Transfer Policy so it can't be traded through kiosk.`,\n\t\t\t);\n\t\t}\n\n\t\tconst policy = policies[0]; // we now pick the first one. We need to add an option to define which one.\n\n\t\t// initialize the purchase `kiosk::purchase`\n\t\tconst [purchasedItem, transferRequest] = this.purchase({\n\t\t\titemType,\n\t\t\titemId,\n\t\t\tprice,\n\t\t\tsellerKiosk,\n\t\t});\n\n\t\tlet canTransferOutsideKiosk = true;\n\n\t\tfor (const rule of policy.rules) {\n\t\t\tconst ruleDefinition = this.kioskClient.rules.find(\n\t\t\t\t(x) => getNormalizedRuleType(x.rule) === getNormalizedRuleType(rule),\n\t\t\t);\n\t\t\tif (!ruleDefinition) throw new Error(`No resolver for the following rule: ${rule}.`);\n\n\t\t\tif (ruleDefinition.hasLockingRule) canTransferOutsideKiosk = false;\n\n\t\t\truleDefinition.resolveRuleFunction({\n\t\t\t\tpackageId: ruleDefinition.packageId,\n\t\t\t\ttransactionBlock: this.transactionBlock,\n\t\t\t\titemType,\n\t\t\t\titemId,\n\t\t\t\tprice: price.toString(),\n\t\t\t\tsellerKiosk,\n\t\t\t\tpolicyId: policy.id,\n\t\t\t\ttransferRequest,\n\t\t\t\tpurchasedItem,\n\t\t\t\tkiosk: this.kiosk!,\n\t\t\t\tkioskCap: this.kioskCap!,\n\t\t\t\textraArgs: extraArgs || {},\n\t\t\t});\n\t\t}\n\n\t\tconfirmRequest(this.transactionBlock, itemType, policy.id, transferRequest);\n\n\t\tif (canTransferOutsideKiosk) this.place({ itemType, item: purchasedItem });\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * A function to setup the client using an existing `ownerCap`,\n\t * as return from the `kioskClient.getOwnedKiosks` function.\n\t * @param cap `KioskOwnerCap` object as returned from `getOwnedKiosks` SDK call.\n\t */\n\tsetCap(cap: KioskOwnerCap) {\n\t\tthis.#validateFinalizedStatus();\n\t\tthis.kiosk = this.transactionBlock.object(cap.kioskId);\n\t\tif (!cap.isPersonal) {\n\t\t\tthis.kioskCap = this.transactionBlock.object(cap.objectId);\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#borrowFromPersonalCap(cap.objectId);\n\t}\n\n\t/**\n\t *\tA function that ends up the kiosk building txb & returns the `kioskOwnerCap` back to the\n\t * `PersonalKioskCap`, in case we are operating on a personal kiosk.\n\t * \tIt will also share the `kiosk` if it's not shared, and finalize the transfer of the personal cap if it's pending.\n\t */\n\tfinalize() {\n\t\tthis.#validateKioskIsSet();\n\t\t// If we're pending the sharing of the new kiosk, share it.\n\t\tif (this.#pendingShare) this.share();\n\n\t\t// If we're operating on a non-personal kiosk, we don't need to do anything else.\n\t\tif (!this.#personalCap) {\n\t\t\t// If we're pending transfer though, we inform user to call `shareAndTransferCap()`.\n\t\t\tif (this.#pendingTransfer)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'You need to transfer the `kioskOwnerCap` by calling `shareAndTransferCap()` before wrap',\n\t\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst packageId = this.kioskClient.getRulePackageId('personalKioskRulePackageId');\n\n\t\t// if we have a promise, return the `ownerCap` back to the personal cap.\n\t\tif (this.#promise) {\n\t\t\tthis.transactionBlock.moveCall({\n\t\t\t\ttarget: `${packageId}::personal_kiosk::return_val`,\n\t\t\t\targuments: [\n\t\t\t\t\tthis.#personalCap,\n\t\t\t\t\tthis.transactionBlock.object(this.kioskCap!),\n\t\t\t\t\tthis.#promise!,\n\t\t\t\t],\n\t\t\t});\n\t\t}\n\n\t\t// If we are pending transferring the personalCap, we do it here.\n\t\tif (this.#pendingTransfer)\n\t\t\ttransferPersonalCapTx(this.transactionBlock, this.#personalCap, packageId);\n\n\t\t// Mark the transaction block as finalized, so no other functions can be called.\n\t\tthis.#finalized = true;\n\t}\n\n\t// Some setters in case we want custom behavior.\n\tsetKioskCap(cap: TransactionObjectArgument) {\n\t\tthis.#validateFinalizedStatus();\n\t\tthis.kioskCap = cap;\n\t\treturn this;\n\t}\n\n\tsetKiosk(kiosk: TransactionObjectArgument) {\n\t\tthis.#validateFinalizedStatus();\n\t\tthis.kiosk = kiosk;\n\t\treturn this;\n\t}\n\n\t// Some getters\n\t/*\n\t * Returns the active transaction's kiosk, or undefined if `setCap` or `create()` hasn't been called yet.\n\t */\n\tgetKiosk() {\n\t\tthis.#validateFinalizedStatus();\n\t\tif (!this.kiosk) throw new Error('Kiosk is not set.');\n\t\treturn this.kiosk;\n\t}\n\n\t/*\n\t * Returns the active transaction's kioskOwnerCap, or undefined if `setCap` or `create()` hasn't been called yet.\n\t */\n\tgetKioskCap() {\n\t\tthis.#validateFinalizedStatus();\n\t\tif (!this.kioskCap) throw new Error('Kiosk cap is not set');\n\t\treturn this.kioskCap;\n\t}\n\n\t/**\n\t * A function to borrow from `personalCap`.\n\t */\n\t#borrowFromPersonalCap(personalCap: ObjectArgument) {\n\t\tconst [kioskCap, promise] = this.transactionBlock.moveCall({\n\t\t\ttarget: `${this.kioskClient.getRulePackageId(\n\t\t\t\t'personalKioskRulePackageId',\n\t\t\t)}::personal_kiosk::borrow_val`,\n\t\t\targuments: [this.transactionBlock.object(personalCap)],\n\t\t});\n\n\t\tthis.kioskCap = kioskCap;\n\t\tthis.#personalCap = this.transactionBlock.object(personalCap);\n\t\tthis.#promise = promise;\n\n\t\treturn this;\n\t}\n\n\t#setPendingStatuses({ share, transfer }: { share?: boolean; transfer?: boolean }) {\n\t\tif (transfer !== undefined) this.#pendingTransfer = transfer;\n\t\tif (share !== undefined) this.#pendingShare = share;\n\t}\n\n\t#validateKioskIsSet() {\n\t\tthis.#validateFinalizedStatus();\n\n\t\tif (!this.kiosk || !this.kioskCap)\n\t\t\tthrow new Error(\n\t\t\t\t'You need to initialize the client by either supplying an existing owner cap or by creating a new by calling `.create()`',\n\t\t\t);\n\t}\n\n\t// Validates that `finalize`\n\t#validateFinalizedStatus() {\n\t\tif (this.#finalized)\n\t\t\tthrow new Error(\"You can't add more transactions to a finalized kiosk transaction block.\");\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AASA,YAAY,aAAa;AACzB,SAAS,qBAAqB,6BAA6B;AAC3D,SAAS,sBAAsB;AAU/B,SAAS,6BAA6B;AAqB/B,MAAM,iBAAiB;AAAA,EAgB7B,YAAY,EAAE,kBAAkB,aAAa,IAAI,GAA2B;AA0a5E;AAAA;AAAA;AAAA;AAeA;AAKA;AAUA;AAA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AAG;AACrB,wBAAK,sDAAL;AAEA,MAAI,CAAC,KAAK,SAAS,CAAC,KAAK;AACxB,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AACF;AAGA;AAAA,6BAAwB,WAAG;AAC1B,MAAI,mBAAK;AACR,UAAM,IAAI,MAAM,yEAAyE;AAC3F;",
6
+ "names": []
7
+ }
@@ -0,0 +1,112 @@
1
+ import { type TransactionBlock } from '@mysten/sui.js/transactions';
2
+ import { TransferPolicyCap, type ObjectArgument } from '../types';
3
+ import { KioskClient } from './kiosk-client';
4
+ export type TransferPolicyBaseParams = {
5
+ type: string;
6
+ publisher: ObjectArgument;
7
+ skipCheck?: boolean;
8
+ };
9
+ export type TransferPolicyTransactionParams = {
10
+ kioskClient: KioskClient;
11
+ transactionBlock: TransactionBlock;
12
+ cap?: TransferPolicyCap;
13
+ };
14
+ export declare class TransferPolicyTransaction {
15
+ #private;
16
+ transactionBlock: TransactionBlock;
17
+ kioskClient: KioskClient;
18
+ policy?: ObjectArgument;
19
+ policyCap?: ObjectArgument;
20
+ type?: string;
21
+ constructor({ kioskClient, transactionBlock, cap }: TransferPolicyTransactionParams);
22
+ /**
23
+ * A function to create a new transfer policy.
24
+ * Checks if there's already an existing transfer policy to prevent
25
+ * double transfer polciy mistakes.
26
+ * There's an optional `skipCheck` flag that will just create the policy
27
+ * without checking
28
+ *
29
+ * @param type The Type (`T`) for which we're creating the transfer policy.
30
+ * @param publisher The Publisher Object Id.
31
+ * @param address Address to save the `TransferPolicyCap` object to.
32
+ * @param skipCheck (Optional) skip checking if a transfer policy already exists
33
+ */
34
+ createAndShare({ type, publisher, address, skipCheck, }: TransferPolicyBaseParams & {
35
+ address: string;
36
+ }): Promise<void>;
37
+ /**
38
+ * A convenient function to create a Transfer Policy and attach some rules
39
+ * before sharing it (so you can prepare it in a single PTB)
40
+ * @param type The Type (`T`) for which we're creating the transfer policy.
41
+ * @param publisher The Publisher Object Id.
42
+ * @param address Address to save the `TransferPolicyCap` object to.
43
+ * @param skipCheck (Optional) skip checking if a transfer policy already exists
44
+ */
45
+ create({ type, publisher, skipCheck, }: TransferPolicyBaseParams): Promise<TransferPolicyTransaction>;
46
+ /**
47
+ * This can be called after calling the `create` function to share the `TransferPolicy`,
48
+ * and transfer the `TransferPolicyCap` to the specified address
49
+ *
50
+ * @param address The address to transfer the `TransferPolicyCap`
51
+ */
52
+ shareAndTransferCap(address: string): void;
53
+ /**
54
+ * Setup the TransferPolicy by passing a `cap` returned from `kioskClient.getOwnedTransferPolicies` or
55
+ * `kioskClient.getOwnedTransferPoliciesByType`.
56
+ * @param policyCapId The `TransferPolicyCap`
57
+ */
58
+ setCap({ policyId, policyCapId, type }: TransferPolicyCap): this;
59
+ /**
60
+ * Withdraw from the transfer policy's profits.
61
+ * @param address Address to transfer the profits to.
62
+ * @param amount (Optional) amount parameter. Will withdraw all profits if the amount is not specified.
63
+ */
64
+ withdraw(address: string, amount?: string | bigint): this;
65
+ /**
66
+ * Adds the Kiosk Royalty rule to the Transfer Policy.
67
+ * You can pass the percentage, as well as a minimum amount.
68
+ * The royalty that will be paid is the MAX(percentage, minAmount).
69
+ * You can pass 0 in either value if you want only percentage royalty, or a fixed amount fee.
70
+ * (but you should define at least one of them for the rule to make sense).
71
+ *
72
+ * @param percentageBps The royalty percentage in basis points. Use `percentageToBasisPoints` helper to convert from percentage [0,100].
73
+ * @param minAmount The minimum royalty amount per request in MIST.
74
+ */
75
+ addRoyaltyRule(percentageBps: number | string, // this is in basis points.
76
+ minAmount: number | string): this;
77
+ /**
78
+ * Adds the Kiosk Lock Rule to the Transfer Policy.
79
+ * This Rule forces buyer to lock the item in the kiosk, preserving strong royalties.
80
+ */
81
+ addLockRule(): this;
82
+ /**
83
+ * Attaches the Personal Kiosk Rule, making a purchase valid only for `SoulBound` kiosks.
84
+ */
85
+ addPersonalKioskRule(): this;
86
+ /**
87
+ * A function to add the floor price rule to a transfer policy.
88
+ * @param minPrice The minimum price in MIST.
89
+ */
90
+ addFloorPriceRule(minPrice: string | bigint): this;
91
+ /**
92
+ * Generic helper to remove a rule, not from the SDK's base ruleset.
93
+ * @param ruleType The Rule Type
94
+ * @param configType The Config Type
95
+ */
96
+ removeRule({ ruleType, configType }: {
97
+ ruleType: string;
98
+ configType: string;
99
+ }): void;
100
+ /**
101
+ * Removes the lock rule.
102
+ */
103
+ removeLockRule(): this;
104
+ /**
105
+ * Removes the Royalty rule
106
+ */
107
+ removeRoyaltyRule(): this;
108
+ removePersonalKioskRule(): this;
109
+ removeFloorPriceRule(): this;
110
+ getPolicy(): ObjectArgument;
111
+ getPolicyCap(): ObjectArgument;
112
+ }
@@ -0,0 +1,308 @@
1
+ var __accessCheck = (obj, member, msg) => {
2
+ if (!member.has(obj))
3
+ throw TypeError("Cannot " + msg);
4
+ };
5
+ var __privateAdd = (obj, member, value) => {
6
+ if (member.has(obj))
7
+ throw TypeError("Cannot add the same private member more than once");
8
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
9
+ };
10
+ var __privateMethod = (obj, member, method) => {
11
+ __accessCheck(obj, member, "access private method");
12
+ return method;
13
+ };
14
+ var _validateInputs, validateInputs_fn, _setup, setup_fn;
15
+ import {
16
+ attachFloorPriceRuleTx,
17
+ attachKioskLockRuleTx,
18
+ attachPersonalKioskRuleTx,
19
+ attachRoyaltyRuleTx
20
+ } from "../tx/rules/attach";
21
+ import {
22
+ createTransferPolicy,
23
+ createTransferPolicyWithoutSharing,
24
+ removeTransferPolicyRule,
25
+ shareTransferPolicy,
26
+ withdrawFromPolicy
27
+ } from "../tx/transfer-policy";
28
+ class TransferPolicyTransaction {
29
+ constructor({ kioskClient, transactionBlock, cap }) {
30
+ // Internal function that that the policy's Id + Cap + type have been set.
31
+ __privateAdd(this, _validateInputs);
32
+ /**
33
+ * Setup the state of the TransferPolicyTransaction.
34
+ */
35
+ __privateAdd(this, _setup);
36
+ this.kioskClient = kioskClient;
37
+ this.transactionBlock = transactionBlock;
38
+ if (cap)
39
+ this.setCap(cap);
40
+ }
41
+ /**
42
+ * A function to create a new transfer policy.
43
+ * Checks if there's already an existing transfer policy to prevent
44
+ * double transfer polciy mistakes.
45
+ * There's an optional `skipCheck` flag that will just create the policy
46
+ * without checking
47
+ *
48
+ * @param type The Type (`T`) for which we're creating the transfer policy.
49
+ * @param publisher The Publisher Object Id.
50
+ * @param address Address to save the `TransferPolicyCap` object to.
51
+ * @param skipCheck (Optional) skip checking if a transfer policy already exists
52
+ */
53
+ async createAndShare({
54
+ type,
55
+ publisher,
56
+ address,
57
+ skipCheck
58
+ }) {
59
+ if (!skipCheck) {
60
+ const policies = await this.kioskClient.getTransferPolicies({ type });
61
+ if (policies.length > 0)
62
+ throw new Error("There's already transfer policy for this Type.");
63
+ }
64
+ const cap = createTransferPolicy(this.transactionBlock, type, publisher);
65
+ this.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address));
66
+ }
67
+ /**
68
+ * A convenient function to create a Transfer Policy and attach some rules
69
+ * before sharing it (so you can prepare it in a single PTB)
70
+ * @param type The Type (`T`) for which we're creating the transfer policy.
71
+ * @param publisher The Publisher Object Id.
72
+ * @param address Address to save the `TransferPolicyCap` object to.
73
+ * @param skipCheck (Optional) skip checking if a transfer policy already exists
74
+ */
75
+ async create({
76
+ type,
77
+ publisher,
78
+ skipCheck
79
+ }) {
80
+ if (!skipCheck) {
81
+ const policies = await this.kioskClient.getTransferPolicies({ type });
82
+ if (policies.length > 0)
83
+ throw new Error("There's already transfer policy for this Type.");
84
+ }
85
+ const [policy, policyCap] = createTransferPolicyWithoutSharing(
86
+ this.transactionBlock,
87
+ type,
88
+ publisher
89
+ );
90
+ __privateMethod(this, _setup, setup_fn).call(this, policy, policyCap, type);
91
+ return this;
92
+ }
93
+ /**
94
+ * This can be called after calling the `create` function to share the `TransferPolicy`,
95
+ * and transfer the `TransferPolicyCap` to the specified address
96
+ *
97
+ * @param address The address to transfer the `TransferPolicyCap`
98
+ */
99
+ shareAndTransferCap(address) {
100
+ if (!this.type || !this.policyCap || !this.policy)
101
+ throw new Error("This function can only be called after `transferPolicyManager.create`");
102
+ shareTransferPolicy(this.transactionBlock, this.type, this.policy);
103
+ this.transactionBlock.transferObjects(
104
+ [this.policyCap],
105
+ this.transactionBlock.pure.address(address)
106
+ );
107
+ }
108
+ /**
109
+ * Setup the TransferPolicy by passing a `cap` returned from `kioskClient.getOwnedTransferPolicies` or
110
+ * `kioskClient.getOwnedTransferPoliciesByType`.
111
+ * @param policyCapId The `TransferPolicyCap`
112
+ */
113
+ setCap({ policyId, policyCapId, type }) {
114
+ return __privateMethod(this, _setup, setup_fn).call(this, policyId, policyCapId, type);
115
+ }
116
+ /**
117
+ * Withdraw from the transfer policy's profits.
118
+ * @param address Address to transfer the profits to.
119
+ * @param amount (Optional) amount parameter. Will withdraw all profits if the amount is not specified.
120
+ */
121
+ withdraw(address, amount) {
122
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
123
+ const coin = withdrawFromPolicy(
124
+ this.transactionBlock,
125
+ this.type,
126
+ this.policy,
127
+ this.policyCap,
128
+ amount
129
+ );
130
+ this.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address));
131
+ return this;
132
+ }
133
+ /**
134
+ * Adds the Kiosk Royalty rule to the Transfer Policy.
135
+ * You can pass the percentage, as well as a minimum amount.
136
+ * The royalty that will be paid is the MAX(percentage, minAmount).
137
+ * You can pass 0 in either value if you want only percentage royalty, or a fixed amount fee.
138
+ * (but you should define at least one of them for the rule to make sense).
139
+ *
140
+ * @param percentageBps The royalty percentage in basis points. Use `percentageToBasisPoints` helper to convert from percentage [0,100].
141
+ * @param minAmount The minimum royalty amount per request in MIST.
142
+ */
143
+ addRoyaltyRule(percentageBps, minAmount) {
144
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
145
+ attachRoyaltyRuleTx(
146
+ this.transactionBlock,
147
+ this.type,
148
+ this.policy,
149
+ this.policyCap,
150
+ percentageBps,
151
+ minAmount,
152
+ this.kioskClient.getRulePackageId("royaltyRulePackageId")
153
+ );
154
+ return this;
155
+ }
156
+ /**
157
+ * Adds the Kiosk Lock Rule to the Transfer Policy.
158
+ * This Rule forces buyer to lock the item in the kiosk, preserving strong royalties.
159
+ */
160
+ addLockRule() {
161
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
162
+ attachKioskLockRuleTx(
163
+ this.transactionBlock,
164
+ this.type,
165
+ this.policy,
166
+ this.policyCap,
167
+ this.kioskClient.getRulePackageId("kioskLockRulePackageId")
168
+ );
169
+ return this;
170
+ }
171
+ /**
172
+ * Attaches the Personal Kiosk Rule, making a purchase valid only for `SoulBound` kiosks.
173
+ */
174
+ addPersonalKioskRule() {
175
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
176
+ attachPersonalKioskRuleTx(
177
+ this.transactionBlock,
178
+ this.type,
179
+ this.policy,
180
+ this.policyCap,
181
+ this.kioskClient.getRulePackageId("personalKioskRulePackageId")
182
+ );
183
+ return this;
184
+ }
185
+ /**
186
+ * A function to add the floor price rule to a transfer policy.
187
+ * @param minPrice The minimum price in MIST.
188
+ */
189
+ addFloorPriceRule(minPrice) {
190
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
191
+ attachFloorPriceRuleTx(
192
+ this.transactionBlock,
193
+ this.type,
194
+ this.policy,
195
+ this.policyCap,
196
+ minPrice,
197
+ this.kioskClient.getRulePackageId("floorPriceRulePackageId")
198
+ );
199
+ return this;
200
+ }
201
+ /**
202
+ * Generic helper to remove a rule, not from the SDK's base ruleset.
203
+ * @param ruleType The Rule Type
204
+ * @param configType The Config Type
205
+ */
206
+ removeRule({ ruleType, configType }) {
207
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
208
+ removeTransferPolicyRule(
209
+ this.transactionBlock,
210
+ this.type,
211
+ ruleType,
212
+ configType,
213
+ this.policy,
214
+ this.policyCap
215
+ );
216
+ }
217
+ /**
218
+ * Removes the lock rule.
219
+ */
220
+ removeLockRule() {
221
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
222
+ const packageId = this.kioskClient.getRulePackageId("kioskLockRulePackageId");
223
+ removeTransferPolicyRule(
224
+ this.transactionBlock,
225
+ this.type,
226
+ `${packageId}::kiosk_lock_rule::Rule`,
227
+ `${packageId}::kiosk_lock_rule::Config`,
228
+ this.policy,
229
+ this.policyCap
230
+ );
231
+ return this;
232
+ }
233
+ /**
234
+ * Removes the Royalty rule
235
+ */
236
+ removeRoyaltyRule() {
237
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
238
+ const packageId = this.kioskClient.getRulePackageId("royaltyRulePackageId");
239
+ removeTransferPolicyRule(
240
+ this.transactionBlock,
241
+ this.type,
242
+ `${packageId}::royalty_rule::Rule`,
243
+ `${packageId}::royalty_rule::Config`,
244
+ this.policy,
245
+ this.policyCap
246
+ );
247
+ return this;
248
+ }
249
+ removePersonalKioskRule() {
250
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
251
+ const packageId = this.kioskClient.getRulePackageId("personalKioskRulePackageId");
252
+ removeTransferPolicyRule(
253
+ this.transactionBlock,
254
+ this.type,
255
+ `${packageId}::personal_kiosk_rule::Rule`,
256
+ `bool`,
257
+ this.policy,
258
+ this.policyCap
259
+ );
260
+ return this;
261
+ }
262
+ removeFloorPriceRule() {
263
+ __privateMethod(this, _validateInputs, validateInputs_fn).call(this);
264
+ const packageId = this.kioskClient.getRulePackageId("floorPriceRulePackageId");
265
+ removeTransferPolicyRule(
266
+ this.transactionBlock,
267
+ this.type,
268
+ `${packageId}::floor_price_rule::Rule`,
269
+ `${packageId}::floor_price_rule::Config`,
270
+ this.policy,
271
+ this.policyCap
272
+ );
273
+ return this;
274
+ }
275
+ getPolicy() {
276
+ if (!this.policy)
277
+ throw new Error("Policy not set.");
278
+ return this.policy;
279
+ }
280
+ getPolicyCap() {
281
+ if (!this.policyCap)
282
+ throw new Error("Transfer Policy Cap not set.");
283
+ return this.policyCap;
284
+ }
285
+ }
286
+ _validateInputs = new WeakSet();
287
+ validateInputs_fn = function() {
288
+ const genericErrorMessage = `Please use 'setCap()' to setup the TransferPolicy.`;
289
+ if (!this.policy)
290
+ throw new Error(`${genericErrorMessage} Missing: Transfer Policy Object.`);
291
+ if (!this.policyCap)
292
+ throw new Error(`${genericErrorMessage} Missing: TransferPolicyCap Object ID`);
293
+ if (!this.type)
294
+ throw new Error(
295
+ `${genericErrorMessage} Missing: Transfer Policy object type (e.g. {packageId}::item::Item)`
296
+ );
297
+ };
298
+ _setup = new WeakSet();
299
+ setup_fn = function(policyId, policyCap, type) {
300
+ this.policy = policyId;
301
+ this.policyCap = policyCap;
302
+ this.type = type;
303
+ return this;
304
+ };
305
+ export {
306
+ TransferPolicyTransaction
307
+ };
308
+ //# sourceMappingURL=tp-transaction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/client/tp-transaction.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { TransactionObjectArgument, type TransactionBlock } from '@mysten/sui.js/transactions';\n\nimport {\n\tattachFloorPriceRuleTx,\n\tattachKioskLockRuleTx,\n\tattachPersonalKioskRuleTx,\n\tattachRoyaltyRuleTx,\n} from '../tx/rules/attach';\nimport {\n\tcreateTransferPolicy,\n\tcreateTransferPolicyWithoutSharing,\n\tremoveTransferPolicyRule,\n\tshareTransferPolicy,\n\twithdrawFromPolicy,\n} from '../tx/transfer-policy';\nimport { TransferPolicyCap, type ObjectArgument } from '../types';\nimport { KioskClient } from './kiosk-client';\n\nexport type TransferPolicyBaseParams = {\n\ttype: string;\n\tpublisher: ObjectArgument;\n\tskipCheck?: boolean;\n};\n\nexport type TransferPolicyTransactionParams = {\n\tkioskClient: KioskClient;\n\ttransactionBlock: TransactionBlock;\n\tcap?: TransferPolicyCap;\n};\n\nexport class TransferPolicyTransaction {\n\ttransactionBlock: TransactionBlock;\n\tkioskClient: KioskClient;\n\tpolicy?: ObjectArgument;\n\tpolicyCap?: ObjectArgument;\n\ttype?: string;\n\n\tconstructor({ kioskClient, transactionBlock, cap }: TransferPolicyTransactionParams) {\n\t\tthis.kioskClient = kioskClient;\n\t\tthis.transactionBlock = transactionBlock;\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.transactionBlock, type, publisher);\n\t\tthis.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(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 [policy, policyCap] = createTransferPolicyWithoutSharing(\n\t\t\tthis.transactionBlock,\n\t\t\ttype,\n\t\t\tpublisher,\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\tshareTransferPolicy(this.transactionBlock, this.type, this.policy as TransactionObjectArgument);\n\t\tthis.transactionBlock.transferObjects(\n\t\t\t[this.policyCap as TransactionObjectArgument],\n\t\t\tthis.transactionBlock.pure.address(address),\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.transactionBlock,\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.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(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\t// Hard-coding package Ids as these don't change.\n\t\t// Also, it's hard to keep versioning as with network wipes, mainnet\n\t\t// and testnet will conflict.\n\t\tattachRoyaltyRuleTx(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.type!,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\n\t\t\tpercentageBps,\n\t\t\tminAmount,\n\t\t\tthis.kioskClient.getRulePackageId('royaltyRulePackageId'),\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\tattachKioskLockRuleTx(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.type!,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\n\t\t\tthis.kioskClient.getRulePackageId('kioskLockRulePackageId'),\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\tattachPersonalKioskRuleTx(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.type!,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\n\t\t\tthis.kioskClient.getRulePackageId('personalKioskRulePackageId'),\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\tattachFloorPriceRuleTx(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.type!,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\n\t\t\tminPrice,\n\t\t\tthis.kioskClient.getRulePackageId('floorPriceRulePackageId'),\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\tremoveTransferPolicyRule(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.type!,\n\t\t\truleType,\n\t\t\tconfigType,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\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\tremoveTransferPolicyRule(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.type!,\n\t\t\t`${packageId}::kiosk_lock_rule::Rule`,\n\t\t\t`${packageId}::kiosk_lock_rule::Config`,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\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\tremoveTransferPolicyRule(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.type!,\n\t\t\t`${packageId}::royalty_rule::Rule`,\n\t\t\t`${packageId}::royalty_rule::Config`,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\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\tremoveTransferPolicyRule(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.type!,\n\t\t\t`${packageId}::personal_kiosk_rule::Rule`,\n\t\t\t`bool`,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\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\tremoveTransferPolicyRule(\n\t\t\tthis.transactionBlock,\n\t\t\tthis.type!,\n\t\t\t`${packageId}::floor_price_rule::Rule`,\n\t\t\t`${packageId}::floor_price_rule::Config`,\n\t\t\tthis.policy!,\n\t\t\tthis.policyCap!,\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"],
5
+ "mappings": ";;;;;;;;;;;;;AAAA;AAKA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,E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,MACA,KAAK;AAAA,MACL,KAAK;AAAA,IACN;AACA,WAAO;AAAA,EACR;AAAA,EAEA,uBAAuB;AACtB,0BAAK,oCAAL;AAEA,UAAM,YAAY,KAAK,YAAY,iBAAiB,yBAAyB;AAE7E;AAAA,MACC,KAAK;AAAA,MACL,KAAK;AAAA,MACL,GAAG;AAAA,MACH,GAAG;AAAA,MACH,KAAK;AAAA,MACL,KAAK;AAAA,IACN;AACA,WAAO;AAAA,EACR;AAAA,EAEA,YAAY;AACX,QAAI,CAAC,KAAK;AAAQ,YAAM,IAAI,MAAM,iBAAiB;AACnD,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,eAAe;AACd,QAAI,CAAC,KAAK;AAAW,YAAM,IAAI,MAAM,8BAA8B;AACnE,WAAO,KAAK;AAAA,EACb;AAuBD;AApBC;AAAA,oBAAe,WAAG;AACjB,QAAM,sBAAsB;AAC5B,MAAI,CAAC,KAAK;AAAQ,UAAM,IAAI,MAAM,GAAG,sDAAsD;AAC3F,MAAI,CAAC,KAAK;AACT,UAAM,IAAI,MAAM,GAAG,0DAA0D;AAC9E,MAAI,CAAC,KAAK;AACT,UAAM,IAAI;AAAA,MACT,GAAG;AAAA,IACJ;AACF;AAKA;AAAA,WAAM,SAAC,UAA0B,WAA2B,MAAc;AACzE,OAAK,SAAS;AACd,OAAK,YAAY;AACjB,OAAK,OAAO;AACZ,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -0,0 +1,30 @@
1
+ import { Network, type ObjectArgument, type RuleResolvingParams } from './types';
2
+ /**
3
+ * The base rule package ids that can be extended
4
+ */
5
+ export type BaseRulePackageIds = {
6
+ royaltyRulePackageId?: string;
7
+ kioskLockRulePackageId?: string;
8
+ personalKioskRulePackageId?: string;
9
+ floorPriceRulePackageId?: string;
10
+ };
11
+ /**
12
+ * The Transfer Policy rule.
13
+ */
14
+ export type TransferPolicyRule = {
15
+ rule: string;
16
+ packageId: string;
17
+ resolveRuleFunction: (rule: RuleResolvingParams) => ObjectArgument | void;
18
+ hasLockingRule?: boolean;
19
+ };
20
+ export declare const ROYALTY_RULE_ADDRESS: Record<Network, string>;
21
+ export declare const KIOSK_LOCK_RULE_ADDRESS: Record<Network, string>;
22
+ export declare const FLOOR_PRICE_RULE_ADDRESS: Record<Network, string>;
23
+ export declare const PERSONAL_KIOSK_RULE_ADDRESS: Record<Network, string>;
24
+ /**
25
+ * Constructs a list of rule resolvers based on the params.
26
+ */
27
+ export declare function getBaseRules({ royaltyRulePackageId, kioskLockRulePackageId, personalKioskRulePackageId, floorPriceRulePackageId, }: BaseRulePackageIds): TransferPolicyRule[];
28
+ export declare const testnetRules: TransferPolicyRule[];
29
+ export declare const mainnetRules: TransferPolicyRule[];
30
+ export declare const rules: TransferPolicyRule[];
@@ -0,0 +1,87 @@
1
+ import {
2
+ resolveFloorPriceRule,
3
+ resolveKioskLockRule,
4
+ resolvePersonalKioskRule,
5
+ resolveRoyaltyRule
6
+ } from "./tx/rules//resolve";
7
+ import { Network } from "./types";
8
+ const ROYALTY_RULE_ADDRESS = {
9
+ [Network.TESTNET]: "bd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585",
10
+ [Network.MAINNET]: "0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879",
11
+ [Network.CUSTOM]: ""
12
+ };
13
+ const KIOSK_LOCK_RULE_ADDRESS = {
14
+ [Network.TESTNET]: "bd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585",
15
+ [Network.MAINNET]: "0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879",
16
+ [Network.CUSTOM]: ""
17
+ };
18
+ const FLOOR_PRICE_RULE_ADDRESS = {
19
+ [Network.TESTNET]: "0x06f6bdd3f2e2e759d8a4b9c252f379f7a05e72dfe4c0b9311cdac27b8eb791b1",
20
+ [Network.MAINNET]: "0x34cc6762780f4f6f153c924c0680cfe2a1fb4601e7d33cc28a92297b62de1e0e",
21
+ [Network.CUSTOM]: ""
22
+ };
23
+ const PERSONAL_KIOSK_RULE_ADDRESS = {
24
+ [Network.TESTNET]: "0x06f6bdd3f2e2e759d8a4b9c252f379f7a05e72dfe4c0b9311cdac27b8eb791b1",
25
+ [Network.MAINNET]: "0x0cb4bcc0560340eb1a1b929cabe56b33fc6449820ec8c1980d69bb98b649b802",
26
+ [Network.CUSTOM]: ""
27
+ };
28
+ function getBaseRules({
29
+ royaltyRulePackageId,
30
+ kioskLockRulePackageId,
31
+ personalKioskRulePackageId,
32
+ floorPriceRulePackageId
33
+ }) {
34
+ const rules2 = [];
35
+ if (royaltyRulePackageId) {
36
+ rules2.push({
37
+ rule: `${royaltyRulePackageId}::royalty_rule::Rule`,
38
+ packageId: royaltyRulePackageId,
39
+ resolveRuleFunction: resolveRoyaltyRule
40
+ });
41
+ }
42
+ if (kioskLockRulePackageId) {
43
+ rules2.push({
44
+ rule: `${kioskLockRulePackageId}::kiosk_lock_rule::Rule`,
45
+ packageId: kioskLockRulePackageId,
46
+ resolveRuleFunction: resolveKioskLockRule,
47
+ hasLockingRule: true
48
+ });
49
+ }
50
+ if (personalKioskRulePackageId) {
51
+ rules2.push({
52
+ rule: `${personalKioskRulePackageId}::personal_kiosk_rule::Rule`,
53
+ packageId: personalKioskRulePackageId,
54
+ resolveRuleFunction: resolvePersonalKioskRule
55
+ });
56
+ }
57
+ if (floorPriceRulePackageId) {
58
+ rules2.push({
59
+ rule: `${floorPriceRulePackageId}::floor_price_rule::Rule`,
60
+ packageId: floorPriceRulePackageId,
61
+ resolveRuleFunction: resolveFloorPriceRule
62
+ });
63
+ }
64
+ return rules2;
65
+ }
66
+ const testnetRules = getBaseRules({
67
+ royaltyRulePackageId: ROYALTY_RULE_ADDRESS[Network.TESTNET],
68
+ kioskLockRulePackageId: KIOSK_LOCK_RULE_ADDRESS[Network.TESTNET],
69
+ personalKioskRulePackageId: PERSONAL_KIOSK_RULE_ADDRESS[Network.TESTNET],
70
+ floorPriceRulePackageId: FLOOR_PRICE_RULE_ADDRESS[Network.TESTNET]
71
+ });
72
+ const mainnetRules = getBaseRules({
73
+ royaltyRulePackageId: ROYALTY_RULE_ADDRESS[Network.MAINNET],
74
+ kioskLockRulePackageId: KIOSK_LOCK_RULE_ADDRESS[Network.MAINNET]
75
+ });
76
+ const rules = [...testnetRules, ...mainnetRules];
77
+ export {
78
+ FLOOR_PRICE_RULE_ADDRESS,
79
+ KIOSK_LOCK_RULE_ADDRESS,
80
+ PERSONAL_KIOSK_RULE_ADDRESS,
81
+ ROYALTY_RULE_ADDRESS,
82
+ getBaseRules,
83
+ mainnetRules,
84
+ rules,
85
+ testnetRules
86
+ };
87
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/constants.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n\tresolveFloorPriceRule,\n\tresolveKioskLockRule,\n\tresolvePersonalKioskRule,\n\tresolveRoyaltyRule,\n} from './tx/rules//resolve';\nimport { Network, type ObjectArgument, type RuleResolvingParams } from './types';\n\n/**\n * The base rule package ids that can be extended\n */\nexport type BaseRulePackageIds = {\n\troyaltyRulePackageId?: string;\n\tkioskLockRulePackageId?: string;\n\tpersonalKioskRulePackageId?: string;\n\tfloorPriceRulePackageId?: string;\n};\n\n/**\n * The Transfer Policy rule.\n */\nexport type TransferPolicyRule = {\n\trule: string;\n\tpackageId: string;\n\tresolveRuleFunction: (rule: RuleResolvingParams) => ObjectArgument | void;\n\thasLockingRule?: boolean;\n};\n\nexport const ROYALTY_RULE_ADDRESS: Record<Network, string> = {\n\t[Network.TESTNET]: 'bd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585',\n\t[Network.MAINNET]: '0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879',\n\t[Network.CUSTOM]: '',\n};\n\nexport const KIOSK_LOCK_RULE_ADDRESS: Record<Network, string> = {\n\t[Network.TESTNET]: 'bd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585',\n\t[Network.MAINNET]: '0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879',\n\t[Network.CUSTOM]: '',\n};\n\nexport const FLOOR_PRICE_RULE_ADDRESS: Record<Network, string> = {\n\t[Network.TESTNET]: '0x06f6bdd3f2e2e759d8a4b9c252f379f7a05e72dfe4c0b9311cdac27b8eb791b1',\n\t[Network.MAINNET]: '0x34cc6762780f4f6f153c924c0680cfe2a1fb4601e7d33cc28a92297b62de1e0e',\n\t[Network.CUSTOM]: '',\n};\n\nexport const PERSONAL_KIOSK_RULE_ADDRESS: Record<Network, string> = {\n\t[Network.TESTNET]: '0x06f6bdd3f2e2e759d8a4b9c252f379f7a05e72dfe4c0b9311cdac27b8eb791b1',\n\t[Network.MAINNET]: '0x0cb4bcc0560340eb1a1b929cabe56b33fc6449820ec8c1980d69bb98b649b802',\n\t[Network.CUSTOM]: '',\n};\n\n/**\n * Constructs a list of rule resolvers based on the params.\n */\nexport function getBaseRules({\n\troyaltyRulePackageId,\n\tkioskLockRulePackageId,\n\tpersonalKioskRulePackageId,\n\tfloorPriceRulePackageId,\n}: BaseRulePackageIds): TransferPolicyRule[] {\n\tconst rules = [];\n\n\tif (royaltyRulePackageId) {\n\t\trules.push({\n\t\t\trule: `${royaltyRulePackageId}::royalty_rule::Rule`,\n\t\t\tpackageId: royaltyRulePackageId,\n\t\t\tresolveRuleFunction: resolveRoyaltyRule,\n\t\t});\n\t}\n\n\tif (kioskLockRulePackageId) {\n\t\trules.push({\n\t\t\trule: `${kioskLockRulePackageId}::kiosk_lock_rule::Rule`,\n\t\t\tpackageId: kioskLockRulePackageId,\n\t\t\tresolveRuleFunction: resolveKioskLockRule,\n\t\t\thasLockingRule: true,\n\t\t});\n\t}\n\n\tif (personalKioskRulePackageId) {\n\t\trules.push({\n\t\t\trule: `${personalKioskRulePackageId}::personal_kiosk_rule::Rule`,\n\t\t\tpackageId: personalKioskRulePackageId,\n\t\t\tresolveRuleFunction: resolvePersonalKioskRule,\n\t\t});\n\t}\n\n\tif (floorPriceRulePackageId) {\n\t\trules.push({\n\t\t\trule: `${floorPriceRulePackageId}::floor_price_rule::Rule`,\n\t\t\tpackageId: floorPriceRulePackageId,\n\t\t\tresolveRuleFunction: resolveFloorPriceRule,\n\t\t});\n\t}\n\n\treturn rules;\n}\n\n// A list of testnet's base rules.\nexport const testnetRules: TransferPolicyRule[] = getBaseRules({\n\troyaltyRulePackageId: ROYALTY_RULE_ADDRESS[Network.TESTNET],\n\tkioskLockRulePackageId: KIOSK_LOCK_RULE_ADDRESS[Network.TESTNET],\n\tpersonalKioskRulePackageId: PERSONAL_KIOSK_RULE_ADDRESS[Network.TESTNET],\n\tfloorPriceRulePackageId: FLOOR_PRICE_RULE_ADDRESS[Network.TESTNET],\n});\n\n// A list of mainnet's base rules.\nexport const mainnetRules: TransferPolicyRule[] = getBaseRules({\n\troyaltyRulePackageId: ROYALTY_RULE_ADDRESS[Network.MAINNET],\n\tkioskLockRulePackageId: KIOSK_LOCK_RULE_ADDRESS[Network.MAINNET],\n});\n\nexport const rules: TransferPolicyRule[] = [...testnetRules, ...mainnetRules];\n"],
5
+ "mappings": "AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,eAA8D;AAsBhE,MAAM,uBAAgD;AAAA,EAC5D,CAAC,QAAQ,OAAO,GAAG;AAAA,EACnB,CAAC,QAAQ,OAAO,GAAG;AAAA,EACnB,CAAC,QAAQ,MAAM,GAAG;AACnB;AAEO,MAAM,0BAAmD;AAAA,EAC/D,CAAC,QAAQ,OAAO,GAAG;AAAA,EACnB,CAAC,QAAQ,OAAO,GAAG;AAAA,EACnB,CAAC,QAAQ,MAAM,GAAG;AACnB;AAEO,MAAM,2BAAoD;AAAA,EAChE,CAAC,QAAQ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;AAChE,CAAC;AAEM,MAAM,QAA8B,CAAC,GAAG,cAAc,GAAG,YAAY;",
6
+ "names": ["rules"]
7
+ }
@@ -0,0 +1,6 @@
1
+ export * from './utils';
2
+ export * from './types';
3
+ export * from './constants';
4
+ export * from './client/kiosk-client';
5
+ export * from './client/tp-transaction';
6
+ export * from './client/kiosk-transaction';