@mysten/kiosk 0.14.5 → 1.0.0

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 (267) hide show
  1. package/CHANGELOG.md +112 -2
  2. package/dist/client/kiosk-client.d.mts +126 -0
  3. package/dist/client/kiosk-client.d.mts.map +1 -0
  4. package/dist/client/kiosk-client.mjs +124 -0
  5. package/dist/client/kiosk-client.mjs.map +1 -0
  6. package/dist/client/kiosk-transaction.d.mts +236 -0
  7. package/dist/client/kiosk-transaction.d.mts.map +1 -0
  8. package/dist/client/kiosk-transaction.mjs +472 -0
  9. package/dist/client/kiosk-transaction.mjs.map +1 -0
  10. package/dist/client/tp-transaction.d.mts +139 -0
  11. package/dist/client/tp-transaction.d.mts.map +1 -0
  12. package/dist/client/tp-transaction.mjs +273 -0
  13. package/dist/client/tp-transaction.mjs.map +1 -0
  14. package/dist/constants.d.mts +42 -0
  15. package/dist/constants.d.mts.map +1 -0
  16. package/dist/constants.mjs +62 -0
  17. package/dist/constants.mjs.map +1 -0
  18. package/dist/contracts/0x2/bag.mjs +19 -0
  19. package/dist/contracts/0x2/bag.mjs.map +1 -0
  20. package/dist/contracts/0x2/balance.mjs +20 -0
  21. package/dist/contracts/0x2/balance.mjs.map +1 -0
  22. package/dist/contracts/0x2/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs +16 -0
  23. package/dist/contracts/0x2/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs.map +1 -0
  24. package/dist/contracts/0x2/kiosk.mjs +244 -0
  25. package/dist/contracts/0x2/kiosk.mjs.map +1 -0
  26. package/dist/contracts/0x2/kiosk_extension.mjs +25 -0
  27. package/dist/contracts/0x2/kiosk_extension.mjs.map +1 -0
  28. package/dist/contracts/0x2/transfer_policy.mjs +99 -0
  29. package/dist/contracts/0x2/transfer_policy.mjs.map +1 -0
  30. package/dist/contracts/0x2/vec_set.mjs +18 -0
  31. package/dist/contracts/0x2/vec_set.mjs.map +1 -0
  32. package/dist/contracts/kiosk/deps/sui/kiosk.mjs +98 -0
  33. package/dist/contracts/kiosk/deps/sui/kiosk.mjs.map +1 -0
  34. package/dist/contracts/kiosk/floor_price_rule.mjs +70 -0
  35. package/dist/contracts/kiosk/floor_price_rule.mjs.map +1 -0
  36. package/dist/contracts/kiosk/kiosk_lock_rule.mjs +72 -0
  37. package/dist/contracts/kiosk/kiosk_lock_rule.mjs.map +1 -0
  38. package/dist/contracts/kiosk/personal_kiosk.mjs +102 -0
  39. package/dist/contracts/kiosk/personal_kiosk.mjs.map +1 -0
  40. package/dist/contracts/kiosk/personal_kiosk_rule.mjs +66 -0
  41. package/dist/contracts/kiosk/personal_kiosk_rule.mjs.map +1 -0
  42. package/dist/contracts/kiosk/royalty_rule.mjs +115 -0
  43. package/dist/contracts/kiosk/royalty_rule.mjs.map +1 -0
  44. package/dist/contracts/utils/index.mjs +118 -0
  45. package/dist/contracts/utils/index.mjs.map +1 -0
  46. package/dist/index.d.mts +9 -0
  47. package/dist/index.mjs +9 -0
  48. package/dist/query/client-utils.mjs +30 -0
  49. package/dist/query/client-utils.mjs.map +1 -0
  50. package/dist/query/kiosk.mjs +154 -0
  51. package/dist/query/kiosk.mjs.map +1 -0
  52. package/dist/query/transfer-policy.mjs +110 -0
  53. package/dist/query/transfer-policy.mjs.map +1 -0
  54. package/dist/tx/kiosk.mjs +20 -0
  55. package/dist/tx/kiosk.mjs.map +1 -0
  56. package/dist/tx/rules/resolve.mjs +114 -0
  57. package/dist/tx/rules/resolve.mjs.map +1 -0
  58. package/dist/tx/transfer-policy.mjs +38 -0
  59. package/dist/tx/transfer-policy.mjs.map +1 -0
  60. package/dist/types/index.d.mts +23 -0
  61. package/dist/types/index.d.mts.map +1 -0
  62. package/dist/types/kiosk.d.mts +165 -0
  63. package/dist/types/kiosk.d.mts.map +1 -0
  64. package/dist/types/kiosk.mjs +21 -0
  65. package/dist/types/kiosk.mjs.map +1 -0
  66. package/dist/types/transfer-policy.d.mts +56 -0
  67. package/dist/types/transfer-policy.d.mts.map +1 -0
  68. package/dist/types/transfer-policy.mjs +19 -0
  69. package/dist/types/transfer-policy.mjs.map +1 -0
  70. package/dist/utils.d.mts +45 -0
  71. package/dist/utils.d.mts.map +1 -0
  72. package/dist/utils.mjs +156 -0
  73. package/dist/utils.mjs.map +1 -0
  74. package/package.json +31 -20
  75. package/src/client/kiosk-client.ts +42 -5
  76. package/src/client/kiosk-transaction.ts +144 -65
  77. package/src/client/tp-transaction.ts +149 -95
  78. package/src/constants.ts +19 -24
  79. package/src/contracts/0x2/accumulator.ts +24 -0
  80. package/src/contracts/0x2/accumulator_metadata.ts +38 -0
  81. package/src/contracts/0x2/accumulator_settlement.ts +14 -0
  82. package/src/contracts/0x2/address.ts +145 -0
  83. package/src/contracts/0x2/address_alias.ts +92 -0
  84. package/src/contracts/0x2/authenticator_state.ts +44 -0
  85. package/src/contracts/0x2/bag.ts +192 -0
  86. package/src/contracts/0x2/balance.ts +269 -0
  87. package/src/contracts/0x2/bcs.ts +495 -0
  88. package/src/contracts/0x2/bls12381.ts +717 -0
  89. package/src/contracts/0x2/borrow.ts +99 -0
  90. package/src/contracts/0x2/clock.ts +30 -0
  91. package/src/contracts/0x2/coin.ts +977 -0
  92. package/src/contracts/0x2/coin_registry.ts +874 -0
  93. package/src/contracts/0x2/config.ts +30 -0
  94. package/src/contracts/0x2/deny_list.ts +55 -0
  95. package/src/contracts/0x2/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.ts +12 -0
  96. package/src/contracts/0x2/derived_object.ts +95 -0
  97. package/src/contracts/0x2/display.ts +258 -0
  98. package/src/contracts/0x2/dynamic_field.ts +171 -0
  99. package/src/contracts/0x2/dynamic_object_field.ts +167 -0
  100. package/src/contracts/0x2/ecdsa_k1.ts +65 -0
  101. package/src/contracts/0x2/ecdsa_r1.ts +49 -0
  102. package/src/contracts/0x2/ecvrf.ts +29 -0
  103. package/src/contracts/0x2/ed25519.ts +25 -0
  104. package/src/contracts/0x2/event.ts +42 -0
  105. package/src/contracts/0x2/funds_accumulator.ts +86 -0
  106. package/src/contracts/0x2/groth16.ts +171 -0
  107. package/src/contracts/0x2/group_ops.ts +49 -0
  108. package/src/contracts/0x2/hash.ts +37 -0
  109. package/src/contracts/0x2/hex.ts +37 -0
  110. package/src/contracts/0x2/hmac.ts +21 -0
  111. package/src/contracts/0x2/kiosk.ts +797 -0
  112. package/src/contracts/0x2/kiosk_extension.ts +270 -0
  113. package/src/contracts/0x2/linked_table.ts +354 -0
  114. package/src/contracts/0x2/math.ts +117 -0
  115. package/src/contracts/0x2/nitro_attestation.ts +186 -0
  116. package/src/contracts/0x2/object.ts +249 -0
  117. package/src/contracts/0x2/object_bag.ts +210 -0
  118. package/src/contracts/0x2/object_table.ts +200 -0
  119. package/src/contracts/0x2/package.ts +414 -0
  120. package/src/contracts/0x2/party.ts +37 -0
  121. package/src/contracts/0x2/pay.ts +153 -0
  122. package/src/contracts/0x2/poseidon.ts +21 -0
  123. package/src/contracts/0x2/priority_queue.ts +139 -0
  124. package/src/contracts/0x2/random.ts +294 -0
  125. package/src/contracts/0x2/sui.ts +29 -0
  126. package/src/contracts/0x2/table.ts +200 -0
  127. package/src/contracts/0x2/table_vec.ts +232 -0
  128. package/src/contracts/0x2/token.ts +873 -0
  129. package/src/contracts/0x2/transfer.ts +216 -0
  130. package/src/contracts/0x2/transfer_policy.ts +400 -0
  131. package/src/contracts/0x2/tx_context.ts +129 -0
  132. package/src/contracts/0x2/types.ts +24 -0
  133. package/src/contracts/0x2/url.ts +77 -0
  134. package/src/contracts/0x2/vdf.ts +45 -0
  135. package/src/contracts/0x2/vec_map.ts +401 -0
  136. package/src/contracts/0x2/vec_set.ts +211 -0
  137. package/src/contracts/0x2/versioned.ts +153 -0
  138. package/src/contracts/0x2/zklogin_verified_id.ts +172 -0
  139. package/src/contracts/0x2/zklogin_verified_issuer.ts +99 -0
  140. package/src/contracts/kiosk/deps/sui/kiosk.ts +94 -0
  141. package/src/contracts/kiosk/deps/sui/object.ts +15 -0
  142. package/src/contracts/kiosk/floor_price_rule.ts +92 -0
  143. package/src/contracts/kiosk/kiosk_lock_rule.ts +97 -0
  144. package/src/contracts/kiosk/personal_kiosk.ts +295 -0
  145. package/src/contracts/kiosk/personal_kiosk_rule.ts +89 -0
  146. package/src/contracts/kiosk/royalty_rule.ts +144 -0
  147. package/src/contracts/kiosk/witness_rule.ts +92 -0
  148. package/src/contracts/utils/index.ts +234 -0
  149. package/src/query/client-utils.ts +51 -0
  150. package/src/query/kiosk.ts +128 -100
  151. package/src/query/transfer-policy.ts +112 -78
  152. package/src/tx/kiosk.ts +7 -231
  153. package/src/tx/rules/resolve.ts +97 -48
  154. package/src/tx/transfer-policy.ts +25 -86
  155. package/src/types/index.ts +3 -14
  156. package/src/types/kiosk.ts +10 -12
  157. package/src/types/transfer-policy.ts +4 -4
  158. package/src/utils.ts +90 -128
  159. package/dist/cjs/bcs.d.ts +0 -23
  160. package/dist/cjs/bcs.js +0 -50
  161. package/dist/cjs/bcs.js.map +0 -7
  162. package/dist/cjs/client/kiosk-client.d.ts +0 -76
  163. package/dist/cjs/client/kiosk-client.js +0 -123
  164. package/dist/cjs/client/kiosk-client.js.map +0 -7
  165. package/dist/cjs/client/kiosk-transaction.d.ts +0 -186
  166. package/dist/cjs/client/kiosk-transaction.js +0 -462
  167. package/dist/cjs/client/kiosk-transaction.js.map +0 -7
  168. package/dist/cjs/client/tp-transaction.d.ts +0 -114
  169. package/dist/cjs/client/tp-transaction.js +0 -307
  170. package/dist/cjs/client/tp-transaction.js.map +0 -7
  171. package/dist/cjs/constants.d.ts +0 -31
  172. package/dist/cjs/constants.js +0 -102
  173. package/dist/cjs/constants.js.map +0 -7
  174. package/dist/cjs/index.d.ts +0 -6
  175. package/dist/cjs/index.js +0 -24
  176. package/dist/cjs/index.js.map +0 -7
  177. package/dist/cjs/package.json +0 -5
  178. package/dist/cjs/query/kiosk.d.ts +0 -8
  179. package/dist/cjs/query/kiosk.js +0 -181
  180. package/dist/cjs/query/kiosk.js.map +0 -7
  181. package/dist/cjs/query/transfer-policy.d.ts +0 -29
  182. package/dist/cjs/query/transfer-policy.js +0 -92
  183. package/dist/cjs/query/transfer-policy.js.map +0 -7
  184. package/dist/cjs/tx/kiosk.d.ts +0 -71
  185. package/dist/cjs/tx/kiosk.js +0 -130
  186. package/dist/cjs/tx/kiosk.js.map +0 -7
  187. package/dist/cjs/tx/personal-kiosk.d.ts +0 -7
  188. package/dist/cjs/tx/personal-kiosk.js +0 -38
  189. package/dist/cjs/tx/personal-kiosk.js.map +0 -7
  190. package/dist/cjs/tx/rules/attach.d.ts +0 -7
  191. package/dist/cjs/tx/rules/attach.js +0 -62
  192. package/dist/cjs/tx/rules/attach.js.map +0 -7
  193. package/dist/cjs/tx/rules/resolve.d.ts +0 -15
  194. package/dist/cjs/tx/rules/resolve.js +0 -109
  195. package/dist/cjs/tx/rules/resolve.js.map +0 -7
  196. package/dist/cjs/tx/transfer-policy.d.ts +0 -29
  197. package/dist/cjs/tx/transfer-policy.js +0 -78
  198. package/dist/cjs/tx/transfer-policy.js.map +0 -7
  199. package/dist/cjs/types/index.d.ts +0 -27
  200. package/dist/cjs/types/index.js +0 -33
  201. package/dist/cjs/types/index.js.map +0 -7
  202. package/dist/cjs/types/kiosk.d.ts +0 -160
  203. package/dist/cjs/types/kiosk.js +0 -37
  204. package/dist/cjs/types/kiosk.js.map +0 -7
  205. package/dist/cjs/types/transfer-policy.d.ts +0 -53
  206. package/dist/cjs/types/transfer-policy.js +0 -35
  207. package/dist/cjs/types/transfer-policy.js.map +0 -7
  208. package/dist/cjs/utils.d.ts +0 -51
  209. package/dist/cjs/utils.js +0 -198
  210. package/dist/cjs/utils.js.map +0 -7
  211. package/dist/esm/bcs.d.ts +0 -23
  212. package/dist/esm/bcs.js +0 -35
  213. package/dist/esm/bcs.js.map +0 -7
  214. package/dist/esm/client/kiosk-client.d.ts +0 -76
  215. package/dist/esm/client/kiosk-client.js +0 -114
  216. package/dist/esm/client/kiosk-client.js.map +0 -7
  217. package/dist/esm/client/kiosk-transaction.d.ts +0 -186
  218. package/dist/esm/client/kiosk-transaction.js +0 -432
  219. package/dist/esm/client/kiosk-transaction.js.map +0 -7
  220. package/dist/esm/client/tp-transaction.d.ts +0 -114
  221. package/dist/esm/client/tp-transaction.js +0 -298
  222. package/dist/esm/client/tp-transaction.js.map +0 -7
  223. package/dist/esm/constants.d.ts +0 -31
  224. package/dist/esm/constants.js +0 -87
  225. package/dist/esm/constants.js.map +0 -7
  226. package/dist/esm/index.d.ts +0 -6
  227. package/dist/esm/index.js +0 -7
  228. package/dist/esm/index.js.map +0 -7
  229. package/dist/esm/package.json +0 -5
  230. package/dist/esm/query/kiosk.d.ts +0 -8
  231. package/dist/esm/query/kiosk.js +0 -169
  232. package/dist/esm/query/kiosk.js.map +0 -7
  233. package/dist/esm/query/transfer-policy.d.ts +0 -29
  234. package/dist/esm/query/transfer-policy.js +0 -76
  235. package/dist/esm/query/transfer-policy.js.map +0 -7
  236. package/dist/esm/tx/kiosk.d.ts +0 -71
  237. package/dist/esm/tx/kiosk.js +0 -110
  238. package/dist/esm/tx/kiosk.js.map +0 -7
  239. package/dist/esm/tx/personal-kiosk.d.ts +0 -7
  240. package/dist/esm/tx/personal-kiosk.js +0 -18
  241. package/dist/esm/tx/personal-kiosk.js.map +0 -7
  242. package/dist/esm/tx/rules/attach.d.ts +0 -7
  243. package/dist/esm/tx/rules/attach.js +0 -42
  244. package/dist/esm/tx/rules/attach.js.map +0 -7
  245. package/dist/esm/tx/rules/resolve.d.ts +0 -15
  246. package/dist/esm/tx/rules/resolve.js +0 -89
  247. package/dist/esm/tx/rules/resolve.js.map +0 -7
  248. package/dist/esm/tx/transfer-policy.d.ts +0 -29
  249. package/dist/esm/tx/transfer-policy.js +0 -58
  250. package/dist/esm/tx/transfer-policy.js.map +0 -7
  251. package/dist/esm/types/index.d.ts +0 -27
  252. package/dist/esm/types/index.js +0 -12
  253. package/dist/esm/types/index.js.map +0 -7
  254. package/dist/esm/types/kiosk.d.ts +0 -160
  255. package/dist/esm/types/kiosk.js +0 -17
  256. package/dist/esm/types/kiosk.js.map +0 -7
  257. package/dist/esm/types/transfer-policy.d.ts +0 -53
  258. package/dist/esm/types/transfer-policy.js +0 -15
  259. package/dist/esm/types/transfer-policy.js.map +0 -7
  260. package/dist/esm/utils.d.ts +0 -51
  261. package/dist/esm/utils.js +0 -183
  262. package/dist/esm/utils.js.map +0 -7
  263. package/dist/tsconfig.esm.tsbuildinfo +0 -1
  264. package/dist/tsconfig.tsbuildinfo +0 -1
  265. package/src/bcs.ts +0 -39
  266. package/src/tx/personal-kiosk.ts +0 -34
  267. package/src/tx/rules/attach.ts +0 -73
@@ -0,0 +1,94 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * Kiosk is a primitive for building safe, decentralized and trustless trading
7
+ * experiences. It allows storing and trading any types of assets as long as the
8
+ * creator of these assets implements a `TransferPolicy` for them.
9
+ *
10
+ * ### Principles and philosophy:
11
+ *
12
+ * - Kiosk provides guarantees of "true ownership"; - just like single owner
13
+ * objects, assets stored in the Kiosk can only be managed by the Kiosk owner.
14
+ * Only the owner can `place`, `take`, `list`, perform any other actions on
15
+ * assets in the Kiosk.
16
+ *
17
+ * - Kiosk aims to be generic - allowing for a small set of default behaviors and
18
+ * not imposing any restrictions on how the assets can be traded. The only
19
+ * default scenario is a `list` + `purchase` flow; any other trading logic can be
20
+ * implemented on top using the `list_with_purchase_cap` (and a matching
21
+ * `purchase_with_cap`) flow.
22
+ *
23
+ * - For every transaction happening with a third party a `TransferRequest` is
24
+ * created - this way creators are fully in control of the trading experience.
25
+ *
26
+ * ### Asset states in the Kiosk:
27
+ *
28
+ * - `placed` - An asset is `place`d into the Kiosk and can be `take`n out by the
29
+ * Kiosk owner; it's freely tradable and modifiable via the `borrow_mut` and
30
+ * `borrow_val` functions.
31
+ *
32
+ * - `locked` - Similar to `placed` except that `take` is disabled and the only way
33
+ * to move the asset out of the Kiosk is to `list` it or `list_with_purchase_cap`
34
+ * therefore performing a trade (issuing a `TransferRequest`). The check on the
35
+ * `lock` function makes sure that the `TransferPolicy` exists to not lock the
36
+ * item in a `Kiosk` forever.
37
+ *
38
+ * - `listed` - A `place`d or a `lock`ed item can be `list`ed for a fixed price
39
+ * allowing anyone to `purchase` it from the Kiosk. While listed, an item can not
40
+ * be taken or modified. However, an immutable borrow via `borrow` call is still
41
+ * available. The `delist` function returns the asset to the previous state.
42
+ *
43
+ * - `listed_exclusively` - An item is listed via the `list_with_purchase_cap`
44
+ * function (and a `PurchaseCap` is created). While listed this way, an item can
45
+ * not be `delist`-ed unless a `PurchaseCap` is returned. All actions available
46
+ * at this item state require a `PurchaseCap`:
47
+ *
48
+ * 1. `purchase_with_cap` - to purchase the item for a price equal or higher than
49
+ * the `min_price` set in the `PurchaseCap`.
50
+ * 2. `return_purchase_cap` - to return the `PurchaseCap` and return the asset
51
+ * into the previous state.
52
+ *
53
+ * When an item is listed exclusively it cannot be modified nor taken and losing a
54
+ * `PurchaseCap` would lock the item in the Kiosk forever. Therefore, it is
55
+ * recommended to only use `PurchaseCap` functionality in trusted applications and
56
+ * not use it for direct trading (eg sending to another account).
57
+ *
58
+ * ### Using multiple Transfer Policies for different "tracks":
59
+ *
60
+ * Every `purchase` or `purchase_with_purchase_cap` creates a `TransferRequest` hot
61
+ * potato which must be resolved in a matching `TransferPolicy` for the transaction
62
+ * to pass. While the default scenario implies that there should be a single
63
+ * `TransferPolicy<T>` for `T`; it is possible to have multiple, each one having
64
+ * its own set of rules.
65
+ *
66
+ * ### Examples:
67
+ *
68
+ * - I create one `TransferPolicy` with "Royalty Rule" for everyone
69
+ * - I create a special `TransferPolicy` for bearers of a "Club Membership" object
70
+ * so they don't have to pay anything
71
+ * - I create and wrap a `TransferPolicy` so that players of my game can transfer
72
+ * items between `Kiosk`s in game without any charge (and maybe not even paying
73
+ * the price with a 0 SUI PurchaseCap)
74
+ *
75
+ * ```
76
+ * Kiosk -> (Item, TransferRequest)
77
+ * ... TransferRequest ------> Common Transfer Policy
78
+ * ... TransferRequest ------> In-game Wrapped Transfer Policy
79
+ * ... TransferRequest ------> Club Membership Transfer Policy
80
+ * ```
81
+ *
82
+ * See `transfer_policy` module for more details on how they function.
83
+ */
84
+
85
+ import { MoveStruct } from '../../../utils/index.js';
86
+ import { bcs } from '@mysten/sui/bcs';
87
+ const $moduleName = '0x2::kiosk';
88
+ export const KioskOwnerCap = new MoveStruct({
89
+ name: `${$moduleName}::KioskOwnerCap`,
90
+ fields: {
91
+ id: bcs.Address,
92
+ for: bcs.Address,
93
+ },
94
+ });
@@ -0,0 +1,15 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /** Sui object identifiers */
6
+
7
+ import { MoveStruct } from '../../../utils/index.js';
8
+ import { bcs } from '@mysten/sui/bcs';
9
+ const $moduleName = '0x2::object';
10
+ export const UID = new MoveStruct({
11
+ name: `${$moduleName}::UID`,
12
+ fields: {
13
+ id: bcs.Address,
14
+ },
15
+ });
@@ -0,0 +1,92 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * Description: This module defines a Rule which sets the floor price for items of
7
+ * type T.
8
+ *
9
+ * Configuration:
10
+ *
11
+ * - floor_price - the floor price in MIST.
12
+ *
13
+ * Use cases:
14
+ *
15
+ * - Defining a floor price for all trades of type T.
16
+ * - Prevent trading of locked items with low amounts (e.g. by using purchase_cap).
17
+ */
18
+
19
+ import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
20
+ import { bcs } from '@mysten/sui/bcs';
21
+ import { type Transaction } from '@mysten/sui/transactions';
22
+ const $moduleName = '@local-pkg/kiosk::floor_price_rule';
23
+ export const Rule = new MoveStruct({
24
+ name: `${$moduleName}::Rule`,
25
+ fields: {
26
+ dummy_field: bcs.bool(),
27
+ },
28
+ });
29
+ export const Config = new MoveStruct({
30
+ name: `${$moduleName}::Config`,
31
+ fields: {
32
+ floor_price: bcs.u64(),
33
+ },
34
+ });
35
+ export interface AddArguments {
36
+ policy: RawTransactionArgument<string>;
37
+ cap: RawTransactionArgument<string>;
38
+ floorPrice: RawTransactionArgument<number | bigint>;
39
+ }
40
+ export interface AddOptions {
41
+ package?: string;
42
+ arguments:
43
+ | AddArguments
44
+ | [
45
+ policy: RawTransactionArgument<string>,
46
+ cap: RawTransactionArgument<string>,
47
+ floorPrice: RawTransactionArgument<number | bigint>,
48
+ ];
49
+ typeArguments: [string];
50
+ }
51
+ /**
52
+ * Creator action: Add the Floor Price Rule for the `T`. Pass in the
53
+ * `TransferPolicy`, `TransferPolicyCap` and `floor_price`.
54
+ */
55
+ export function add(options: AddOptions) {
56
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
57
+ const argumentsTypes = [null, null, 'u64'] satisfies (string | null)[];
58
+ const parameterNames = ['policy', 'cap', 'floorPrice'];
59
+ return (tx: Transaction) =>
60
+ tx.moveCall({
61
+ package: packageAddress,
62
+ module: 'floor_price_rule',
63
+ function: 'add',
64
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
65
+ typeArguments: options.typeArguments,
66
+ });
67
+ }
68
+ export interface ProveArguments {
69
+ policy: RawTransactionArgument<string>;
70
+ request: RawTransactionArgument<string>;
71
+ }
72
+ export interface ProveOptions {
73
+ package?: string;
74
+ arguments:
75
+ | ProveArguments
76
+ | [policy: RawTransactionArgument<string>, request: RawTransactionArgument<string>];
77
+ typeArguments: [string];
78
+ }
79
+ /** Buyer action: Prove that the amount is higher or equal to the floor_price. */
80
+ export function prove(options: ProveOptions) {
81
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
82
+ const argumentsTypes = [null, null] satisfies (string | null)[];
83
+ const parameterNames = ['policy', 'request'];
84
+ return (tx: Transaction) =>
85
+ tx.moveCall({
86
+ package: packageAddress,
87
+ module: 'floor_price_rule',
88
+ function: 'prove',
89
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
90
+ typeArguments: options.typeArguments,
91
+ });
92
+ }
@@ -0,0 +1,97 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * Description: This module defines a Rule which forces buyers to put the purchased
7
+ * item into the Kiosk and lock it. The most common use case for the Rule is making
8
+ * sure an item never leaves Kiosks and has policies enforced on every transfer.
9
+ *
10
+ * Configuration:
11
+ *
12
+ * - None
13
+ *
14
+ * Use cases:
15
+ *
16
+ * - Enforcing policies on every trade
17
+ * - Making sure an item never leaves the Kiosk / certain ecosystem
18
+ *
19
+ * Notes:
20
+ *
21
+ * - "locking" mechanic disallows the `kiosk::take` function and forces the owner
22
+ * to use `list` or `list_with_purchase_cap` methods if they wish to move the
23
+ * item somewhere else.
24
+ */
25
+
26
+ import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
27
+ import { bcs } from '@mysten/sui/bcs';
28
+ import { type Transaction } from '@mysten/sui/transactions';
29
+ const $moduleName = '@local-pkg/kiosk::kiosk_lock_rule';
30
+ export const Rule = new MoveStruct({
31
+ name: `${$moduleName}::Rule`,
32
+ fields: {
33
+ dummy_field: bcs.bool(),
34
+ },
35
+ });
36
+ export const Config = new MoveStruct({
37
+ name: `${$moduleName}::Config`,
38
+ fields: {
39
+ dummy_field: bcs.bool(),
40
+ },
41
+ });
42
+ export interface AddArguments {
43
+ policy: RawTransactionArgument<string>;
44
+ cap: RawTransactionArgument<string>;
45
+ }
46
+ export interface AddOptions {
47
+ package?: string;
48
+ arguments:
49
+ | AddArguments
50
+ | [policy: RawTransactionArgument<string>, cap: RawTransactionArgument<string>];
51
+ typeArguments: [string];
52
+ }
53
+ /**
54
+ * Creator: Adds a `kiosk_lock_rule` Rule to the `TransferPolicy` forcing buyers to
55
+ * lock the item in a Kiosk on purchase.
56
+ */
57
+ export function add(options: AddOptions) {
58
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
59
+ const argumentsTypes = [null, null] satisfies (string | null)[];
60
+ const parameterNames = ['policy', 'cap'];
61
+ return (tx: Transaction) =>
62
+ tx.moveCall({
63
+ package: packageAddress,
64
+ module: 'kiosk_lock_rule',
65
+ function: 'add',
66
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
67
+ typeArguments: options.typeArguments,
68
+ });
69
+ }
70
+ export interface ProveArguments {
71
+ request: RawTransactionArgument<string>;
72
+ kiosk: RawTransactionArgument<string>;
73
+ }
74
+ export interface ProveOptions {
75
+ package?: string;
76
+ arguments:
77
+ | ProveArguments
78
+ | [request: RawTransactionArgument<string>, kiosk: RawTransactionArgument<string>];
79
+ typeArguments: [string];
80
+ }
81
+ /**
82
+ * Buyer: Prove the item was locked in the Kiosk to get the receipt and unblock the
83
+ * transfer request confirmation.
84
+ */
85
+ export function prove(options: ProveOptions) {
86
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
87
+ const argumentsTypes = [null, null] satisfies (string | null)[];
88
+ const parameterNames = ['request', 'kiosk'];
89
+ return (tx: Transaction) =>
90
+ tx.moveCall({
91
+ package: packageAddress,
92
+ module: 'kiosk_lock_rule',
93
+ function: 'prove',
94
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
95
+ typeArguments: options.typeArguments,
96
+ });
97
+ }
@@ -0,0 +1,295 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * Description: This module provides a wrapper for the KioskOwnerCap that makes the
7
+ * Kiosk non-transferable and "owned".
8
+ */
9
+
10
+ import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
11
+ import { bcs } from '@mysten/sui/bcs';
12
+ import { type Transaction } from '@mysten/sui/transactions';
13
+ import * as kiosk from './deps/sui/kiosk.js';
14
+ const $moduleName = '@local-pkg/kiosk::personal_kiosk';
15
+ export const PersonalKioskCap = new MoveStruct({
16
+ name: `${$moduleName}::PersonalKioskCap`,
17
+ fields: {
18
+ id: bcs.Address,
19
+ cap: bcs.option(kiosk.KioskOwnerCap),
20
+ },
21
+ });
22
+ export const Borrow = new MoveStruct({
23
+ name: `${$moduleName}::Borrow`,
24
+ fields: {
25
+ cap_id: bcs.Address,
26
+ owned_id: bcs.Address,
27
+ },
28
+ });
29
+ export const OwnerMarker = new MoveStruct({
30
+ name: `${$moduleName}::OwnerMarker`,
31
+ fields: {
32
+ dummy_field: bcs.bool(),
33
+ },
34
+ });
35
+ export const NewPersonalKiosk = new MoveStruct({
36
+ name: `${$moduleName}::NewPersonalKiosk`,
37
+ fields: {
38
+ kiosk_id: bcs.Address,
39
+ },
40
+ });
41
+ export interface DefaultArguments {
42
+ kiosk: RawTransactionArgument<string>;
43
+ cap: RawTransactionArgument<string>;
44
+ }
45
+ export interface DefaultOptions {
46
+ package?: string;
47
+ arguments:
48
+ | DefaultArguments
49
+ | [kiosk: RawTransactionArgument<string>, cap: RawTransactionArgument<string>];
50
+ }
51
+ /** The default setup for the PersonalKioskCap. */
52
+ export function _default(options: DefaultOptions) {
53
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
54
+ const argumentsTypes = [null, null] satisfies (string | null)[];
55
+ const parameterNames = ['kiosk', 'cap'];
56
+ return (tx: Transaction) =>
57
+ tx.moveCall({
58
+ package: packageAddress,
59
+ module: 'personal_kiosk',
60
+ function: 'default',
61
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
62
+ });
63
+ }
64
+ export interface NewArguments {
65
+ kiosk: RawTransactionArgument<string>;
66
+ cap: RawTransactionArgument<string>;
67
+ }
68
+ export interface NewOptions {
69
+ package?: string;
70
+ arguments:
71
+ | NewArguments
72
+ | [kiosk: RawTransactionArgument<string>, cap: RawTransactionArgument<string>];
73
+ }
74
+ /**
75
+ * Wrap the KioskOwnerCap making the Kiosk "owned" and non-transferable. The
76
+ * `PersonalKioskCap` is returned to allow chaining within a PTB, but the value
77
+ * must be consumed by the `transfer_to_sender` call in any case.
78
+ */
79
+ export function _new(options: NewOptions) {
80
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
81
+ const argumentsTypes = [null, null] satisfies (string | null)[];
82
+ const parameterNames = ['kiosk', 'cap'];
83
+ return (tx: Transaction) =>
84
+ tx.moveCall({
85
+ package: packageAddress,
86
+ module: 'personal_kiosk',
87
+ function: 'new',
88
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
89
+ });
90
+ }
91
+ export interface CreateForArguments {
92
+ kiosk: RawTransactionArgument<string>;
93
+ cap: RawTransactionArgument<string>;
94
+ recipient: RawTransactionArgument<string>;
95
+ }
96
+ export interface CreateForOptions {
97
+ package?: string;
98
+ arguments:
99
+ | CreateForArguments
100
+ | [
101
+ kiosk: RawTransactionArgument<string>,
102
+ cap: RawTransactionArgument<string>,
103
+ recipient: RawTransactionArgument<string>,
104
+ ];
105
+ }
106
+ /**
107
+ * Create a `PersonalKiosk` for `recipient`. This is useful when (e.g.) an admin
108
+ * account wants to mint an asset with royalty enforcement on behalf of a user.
109
+ */
110
+ export function createFor(options: CreateForOptions) {
111
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
112
+ const argumentsTypes = [null, null, 'address'] satisfies (string | null)[];
113
+ const parameterNames = ['kiosk', 'cap', 'recipient'];
114
+ return (tx: Transaction) =>
115
+ tx.moveCall({
116
+ package: packageAddress,
117
+ module: 'personal_kiosk',
118
+ function: 'create_for',
119
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
120
+ });
121
+ }
122
+ export interface BorrowArguments {
123
+ self: RawTransactionArgument<string>;
124
+ }
125
+ export interface BorrowOptions {
126
+ package?: string;
127
+ arguments: BorrowArguments | [self: RawTransactionArgument<string>];
128
+ }
129
+ /** Borrow the `KioskOwnerCap` from the `PersonalKioskCap` object. */
130
+ export function borrow(options: BorrowOptions) {
131
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
132
+ const argumentsTypes = [null] satisfies (string | null)[];
133
+ const parameterNames = ['self'];
134
+ return (tx: Transaction) =>
135
+ tx.moveCall({
136
+ package: packageAddress,
137
+ module: 'personal_kiosk',
138
+ function: 'borrow',
139
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
140
+ });
141
+ }
142
+ export interface BorrowMutArguments {
143
+ self: RawTransactionArgument<string>;
144
+ }
145
+ export interface BorrowMutOptions {
146
+ package?: string;
147
+ arguments: BorrowMutArguments | [self: RawTransactionArgument<string>];
148
+ }
149
+ /** Mutably borrow the `KioskOwnerCap` from the `PersonalKioskCap` object. */
150
+ export function borrowMut(options: BorrowMutOptions) {
151
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
152
+ const argumentsTypes = [null] satisfies (string | null)[];
153
+ const parameterNames = ['self'];
154
+ return (tx: Transaction) =>
155
+ tx.moveCall({
156
+ package: packageAddress,
157
+ module: 'personal_kiosk',
158
+ function: 'borrow_mut',
159
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
160
+ });
161
+ }
162
+ export interface BorrowValArguments {
163
+ self: RawTransactionArgument<string>;
164
+ }
165
+ export interface BorrowValOptions {
166
+ package?: string;
167
+ arguments: BorrowValArguments | [self: RawTransactionArgument<string>];
168
+ }
169
+ /**
170
+ * Borrow the `KioskOwnerCap` from the `PersonalKioskCap` object; `Borrow`
171
+ * hot-potato makes sure that the Cap is returned via `return_val` call.
172
+ */
173
+ export function borrowVal(options: BorrowValOptions) {
174
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
175
+ const argumentsTypes = [null] satisfies (string | null)[];
176
+ const parameterNames = ['self'];
177
+ return (tx: Transaction) =>
178
+ tx.moveCall({
179
+ package: packageAddress,
180
+ module: 'personal_kiosk',
181
+ function: 'borrow_val',
182
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
183
+ });
184
+ }
185
+ export interface ReturnValArguments {
186
+ self: RawTransactionArgument<string>;
187
+ cap: RawTransactionArgument<string>;
188
+ borrow: RawTransactionArgument<string>;
189
+ }
190
+ export interface ReturnValOptions {
191
+ package?: string;
192
+ arguments:
193
+ | ReturnValArguments
194
+ | [
195
+ self: RawTransactionArgument<string>,
196
+ cap: RawTransactionArgument<string>,
197
+ borrow: RawTransactionArgument<string>,
198
+ ];
199
+ }
200
+ /** Return the Cap to the PersonalKioskCap object. */
201
+ export function returnVal(options: ReturnValOptions) {
202
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
203
+ const argumentsTypes = [null, null, null] satisfies (string | null)[];
204
+ const parameterNames = ['self', 'cap', 'borrow'];
205
+ return (tx: Transaction) =>
206
+ tx.moveCall({
207
+ package: packageAddress,
208
+ module: 'personal_kiosk',
209
+ function: 'return_val',
210
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
211
+ });
212
+ }
213
+ export interface IsPersonalArguments {
214
+ kiosk: RawTransactionArgument<string>;
215
+ }
216
+ export interface IsPersonalOptions {
217
+ package?: string;
218
+ arguments: IsPersonalArguments | [kiosk: RawTransactionArgument<string>];
219
+ }
220
+ /** Check if the Kiosk is "personal". */
221
+ export function isPersonal(options: IsPersonalOptions) {
222
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
223
+ const argumentsTypes = [null] satisfies (string | null)[];
224
+ const parameterNames = ['kiosk'];
225
+ return (tx: Transaction) =>
226
+ tx.moveCall({
227
+ package: packageAddress,
228
+ module: 'personal_kiosk',
229
+ function: 'is_personal',
230
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
231
+ });
232
+ }
233
+ export interface OwnerArguments {
234
+ kiosk: RawTransactionArgument<string>;
235
+ }
236
+ export interface OwnerOptions {
237
+ package?: string;
238
+ arguments: OwnerArguments | [kiosk: RawTransactionArgument<string>];
239
+ }
240
+ /** Get the owner of the Kiosk if the Kiosk is "personal". Aborts otherwise. */
241
+ export function owner(options: OwnerOptions) {
242
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
243
+ const argumentsTypes = [null] satisfies (string | null)[];
244
+ const parameterNames = ['kiosk'];
245
+ return (tx: Transaction) =>
246
+ tx.moveCall({
247
+ package: packageAddress,
248
+ module: 'personal_kiosk',
249
+ function: 'owner',
250
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
251
+ });
252
+ }
253
+ export interface TryOwnerArguments {
254
+ kiosk: RawTransactionArgument<string>;
255
+ }
256
+ export interface TryOwnerOptions {
257
+ package?: string;
258
+ arguments: TryOwnerArguments | [kiosk: RawTransactionArgument<string>];
259
+ }
260
+ /**
261
+ * Try to get the owner of the Kiosk if the Kiosk is "personal". Returns None
262
+ * otherwise.
263
+ */
264
+ export function tryOwner(options: TryOwnerOptions) {
265
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
266
+ const argumentsTypes = [null] satisfies (string | null)[];
267
+ const parameterNames = ['kiosk'];
268
+ return (tx: Transaction) =>
269
+ tx.moveCall({
270
+ package: packageAddress,
271
+ module: 'personal_kiosk',
272
+ function: 'try_owner',
273
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
274
+ });
275
+ }
276
+ export interface TransferToSenderArguments {
277
+ self: RawTransactionArgument<string>;
278
+ }
279
+ export interface TransferToSenderOptions {
280
+ package?: string;
281
+ arguments: TransferToSenderArguments | [self: RawTransactionArgument<string>];
282
+ }
283
+ /** Transfer the `PersonalKioskCap` to the transaction sender. */
284
+ export function transferToSender(options: TransferToSenderOptions) {
285
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
286
+ const argumentsTypes = [null] satisfies (string | null)[];
287
+ const parameterNames = ['self'];
288
+ return (tx: Transaction) =>
289
+ tx.moveCall({
290
+ package: packageAddress,
291
+ module: 'personal_kiosk',
292
+ function: 'transfer_to_sender',
293
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
294
+ });
295
+ }
@@ -0,0 +1,89 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * Description: This module defines a Rule which checks that the Kiosk is
7
+ * "personal" meaning that the owner cannot change. By default, `KioskOwnerCap` can
8
+ * be transferred and owned by an application therefore the owner of the Kiosk is
9
+ * not fixed.
10
+ *
11
+ * Configuration:
12
+ *
13
+ * - None
14
+ *
15
+ * Use cases:
16
+ *
17
+ * - Strong royalty enforcement - personal Kiosks cannot be transferred with the
18
+ * assets inside which means that the item will never change the owner.
19
+ *
20
+ * Notes:
21
+ *
22
+ * - Combination of `kiosk_lock_rule` and `personal_kiosk_rule` can be used to
23
+ * enforce policies on every trade (item can be transferred only through a
24
+ * trade + Kiosk is fixed to the owner).
25
+ */
26
+
27
+ import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
28
+ import { bcs } from '@mysten/sui/bcs';
29
+ import { type Transaction } from '@mysten/sui/transactions';
30
+ const $moduleName = '@local-pkg/kiosk::personal_kiosk_rule';
31
+ export const Rule = new MoveStruct({
32
+ name: `${$moduleName}::Rule`,
33
+ fields: {
34
+ dummy_field: bcs.bool(),
35
+ },
36
+ });
37
+ export interface AddArguments {
38
+ policy: RawTransactionArgument<string>;
39
+ cap: RawTransactionArgument<string>;
40
+ }
41
+ export interface AddOptions {
42
+ package?: string;
43
+ arguments:
44
+ | AddArguments
45
+ | [policy: RawTransactionArgument<string>, cap: RawTransactionArgument<string>];
46
+ typeArguments: [string];
47
+ }
48
+ /** Add the "owned" rule to the KioskOwnerCap. */
49
+ export function add(options: AddOptions) {
50
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
51
+ const argumentsTypes = [null, null] satisfies (string | null)[];
52
+ const parameterNames = ['policy', 'cap'];
53
+ return (tx: Transaction) =>
54
+ tx.moveCall({
55
+ package: packageAddress,
56
+ module: 'personal_kiosk_rule',
57
+ function: 'add',
58
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
59
+ typeArguments: options.typeArguments,
60
+ });
61
+ }
62
+ export interface ProveArguments {
63
+ kiosk: RawTransactionArgument<string>;
64
+ request: RawTransactionArgument<string>;
65
+ }
66
+ export interface ProveOptions {
67
+ package?: string;
68
+ arguments:
69
+ | ProveArguments
70
+ | [kiosk: RawTransactionArgument<string>, request: RawTransactionArgument<string>];
71
+ typeArguments: [string];
72
+ }
73
+ /**
74
+ * Make sure that the destination Kiosk has the Owner key. Item is already placed
75
+ * by the time this check is performed - otherwise fails.
76
+ */
77
+ export function prove(options: ProveOptions) {
78
+ const packageAddress = options.package ?? '@local-pkg/kiosk';
79
+ const argumentsTypes = [null, null] satisfies (string | null)[];
80
+ const parameterNames = ['kiosk', 'request'];
81
+ return (tx: Transaction) =>
82
+ tx.moveCall({
83
+ package: packageAddress,
84
+ module: 'personal_kiosk_rule',
85
+ function: 'prove',
86
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
87
+ typeArguments: options.typeArguments,
88
+ });
89
+ }