@haneullabs/kiosk 0.1.0 → 1.1.3

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 (225) hide show
  1. package/CHANGELOG.md +281 -137
  2. package/README.md +2 -2
  3. package/dist/client/kiosk-client.d.mts +126 -0
  4. package/dist/client/kiosk-client.d.mts.map +1 -0
  5. package/dist/client/kiosk-client.mjs +124 -0
  6. package/dist/client/kiosk-client.mjs.map +1 -0
  7. package/dist/client/kiosk-transaction.d.mts +235 -0
  8. package/dist/client/kiosk-transaction.d.mts.map +1 -0
  9. package/dist/client/kiosk-transaction.mjs +472 -0
  10. package/dist/client/kiosk-transaction.mjs.map +1 -0
  11. package/dist/client/tp-transaction.d.mts +138 -0
  12. package/dist/client/tp-transaction.d.mts.map +1 -0
  13. package/dist/client/tp-transaction.mjs +273 -0
  14. package/dist/client/tp-transaction.mjs.map +1 -0
  15. package/dist/constants.d.mts +42 -0
  16. package/dist/constants.d.mts.map +1 -0
  17. package/dist/constants.mjs +62 -0
  18. package/dist/constants.mjs.map +1 -0
  19. package/dist/contracts/0x2/bag.mjs +19 -0
  20. package/dist/contracts/0x2/bag.mjs.map +1 -0
  21. package/dist/contracts/0x2/balance.mjs +16 -0
  22. package/dist/contracts/0x2/balance.mjs.map +1 -0
  23. package/dist/contracts/0x2/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs +16 -0
  24. package/dist/contracts/0x2/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs.map +1 -0
  25. package/dist/contracts/0x2/kiosk.mjs +244 -0
  26. package/dist/contracts/0x2/kiosk.mjs.map +1 -0
  27. package/dist/contracts/0x2/kiosk_extension.mjs +25 -0
  28. package/dist/contracts/0x2/kiosk_extension.mjs.map +1 -0
  29. package/dist/contracts/0x2/transfer_policy.mjs +99 -0
  30. package/dist/contracts/0x2/transfer_policy.mjs.map +1 -0
  31. package/dist/contracts/0x2/vec_set.mjs +18 -0
  32. package/dist/contracts/0x2/vec_set.mjs.map +1 -0
  33. package/dist/contracts/kiosk/deps/haneul/kiosk.mjs +98 -0
  34. package/dist/contracts/kiosk/deps/haneul/kiosk.mjs.map +1 -0
  35. package/dist/contracts/kiosk/floor_price_rule.mjs +70 -0
  36. package/dist/contracts/kiosk/floor_price_rule.mjs.map +1 -0
  37. package/dist/contracts/kiosk/kiosk_lock_rule.mjs +72 -0
  38. package/dist/contracts/kiosk/kiosk_lock_rule.mjs.map +1 -0
  39. package/dist/contracts/kiosk/personal_kiosk.mjs +102 -0
  40. package/dist/contracts/kiosk/personal_kiosk.mjs.map +1 -0
  41. package/dist/contracts/kiosk/personal_kiosk_rule.mjs +66 -0
  42. package/dist/contracts/kiosk/personal_kiosk_rule.mjs.map +1 -0
  43. package/dist/contracts/kiosk/royalty_rule.mjs +115 -0
  44. package/dist/contracts/kiosk/royalty_rule.mjs.map +1 -0
  45. package/dist/contracts/utils/index.mjs +118 -0
  46. package/dist/contracts/utils/index.mjs.map +1 -0
  47. package/dist/index.d.mts +9 -0
  48. package/dist/index.mjs +9 -0
  49. package/dist/query/client-utils.mjs +215 -0
  50. package/dist/query/client-utils.mjs.map +1 -0
  51. package/dist/query/kiosk.mjs +155 -0
  52. package/dist/query/kiosk.mjs.map +1 -0
  53. package/dist/query/transfer-policy.mjs +110 -0
  54. package/dist/query/transfer-policy.mjs.map +1 -0
  55. package/dist/tx/kiosk.mjs +20 -0
  56. package/dist/tx/kiosk.mjs.map +1 -0
  57. package/dist/tx/rules/resolve.mjs +114 -0
  58. package/dist/tx/rules/resolve.mjs.map +1 -0
  59. package/dist/tx/transfer-policy.mjs +38 -0
  60. package/dist/tx/transfer-policy.mjs.map +1 -0
  61. package/dist/types/index.d.mts +25 -0
  62. package/dist/types/index.d.mts.map +1 -0
  63. package/dist/types/kiosk.d.mts +161 -0
  64. package/dist/types/kiosk.d.mts.map +1 -0
  65. package/dist/types/kiosk.mjs +21 -0
  66. package/dist/types/kiosk.mjs.map +1 -0
  67. package/dist/types/transfer-policy.d.mts +56 -0
  68. package/dist/types/transfer-policy.d.mts.map +1 -0
  69. package/dist/types/transfer-policy.mjs +19 -0
  70. package/dist/types/transfer-policy.mjs.map +1 -0
  71. package/dist/utils.d.mts +39 -0
  72. package/dist/utils.d.mts.map +1 -0
  73. package/dist/utils.mjs +137 -0
  74. package/dist/utils.mjs.map +1 -0
  75. package/docs/advanced-examples.md +100 -0
  76. package/docs/from-v1.md +314 -0
  77. package/docs/index.md +22 -0
  78. package/docs/kiosk-client/introduction.md +50 -0
  79. package/docs/kiosk-client/kiosk-transaction/examples.md +119 -0
  80. package/docs/kiosk-client/kiosk-transaction/kiosk-transaction.md +103 -0
  81. package/docs/kiosk-client/kiosk-transaction/managing.md +235 -0
  82. package/docs/kiosk-client/kiosk-transaction/purchasing.md +110 -0
  83. package/docs/kiosk-client/querying.md +237 -0
  84. package/docs/kiosk-client/transfer-policy-transaction/introduction.md +79 -0
  85. package/docs/kiosk-client/transfer-policy-transaction/using-the-manager.md +115 -0
  86. package/docs/llms-index.md +10 -0
  87. package/package.json +27 -20
  88. package/src/client/kiosk-client.ts +43 -5
  89. package/src/client/kiosk-transaction.ts +144 -65
  90. package/src/client/tp-transaction.ts +149 -95
  91. package/src/constants.ts +19 -24
  92. package/src/contracts/0x2/bag.ts +13 -0
  93. package/src/contracts/0x2/balance.ts +12 -0
  94. package/src/contracts/0x2/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.ts +12 -0
  95. package/src/contracts/0x2/kiosk.ts +797 -0
  96. package/src/contracts/0x2/kiosk_extension.ts +270 -0
  97. package/src/contracts/0x2/transfer_policy.ts +400 -0
  98. package/src/contracts/0x2/vec_set.ts +14 -0
  99. package/src/contracts/kiosk/deps/haneul/kiosk.ts +94 -0
  100. package/src/contracts/kiosk/floor_price_rule.ts +92 -0
  101. package/src/contracts/kiosk/kiosk_lock_rule.ts +97 -0
  102. package/src/contracts/kiosk/personal_kiosk.ts +295 -0
  103. package/src/contracts/kiosk/personal_kiosk_rule.ts +89 -0
  104. package/src/contracts/kiosk/royalty_rule.ts +144 -0
  105. package/src/contracts/kiosk/witness_rule.ts +92 -0
  106. package/src/contracts/utils/index.ts +234 -0
  107. package/src/query/client-utils.ts +302 -0
  108. package/src/query/kiosk.ts +130 -101
  109. package/src/query/transfer-policy.ts +112 -79
  110. package/src/tx/kiosk.ts +7 -231
  111. package/src/tx/rules/resolve.ts +97 -48
  112. package/src/tx/transfer-policy.ts +25 -86
  113. package/src/types/index.ts +7 -14
  114. package/src/types/kiosk.ts +25 -12
  115. package/src/types/transfer-policy.ts +4 -4
  116. package/src/utils.ts +79 -147
  117. package/dist/cjs/bcs.d.ts +0 -23
  118. package/dist/cjs/bcs.js +0 -50
  119. package/dist/cjs/bcs.js.map +0 -7
  120. package/dist/cjs/client/kiosk-client.d.ts +0 -76
  121. package/dist/cjs/client/kiosk-client.js +0 -123
  122. package/dist/cjs/client/kiosk-client.js.map +0 -7
  123. package/dist/cjs/client/kiosk-transaction.d.ts +0 -186
  124. package/dist/cjs/client/kiosk-transaction.js +0 -462
  125. package/dist/cjs/client/kiosk-transaction.js.map +0 -7
  126. package/dist/cjs/client/tp-transaction.d.ts +0 -114
  127. package/dist/cjs/client/tp-transaction.js +0 -307
  128. package/dist/cjs/client/tp-transaction.js.map +0 -7
  129. package/dist/cjs/constants.d.ts +0 -31
  130. package/dist/cjs/constants.js +0 -102
  131. package/dist/cjs/constants.js.map +0 -7
  132. package/dist/cjs/index.d.ts +0 -6
  133. package/dist/cjs/index.js +0 -24
  134. package/dist/cjs/index.js.map +0 -7
  135. package/dist/cjs/package.json +0 -5
  136. package/dist/cjs/query/kiosk.d.ts +0 -8
  137. package/dist/cjs/query/kiosk.js +0 -181
  138. package/dist/cjs/query/kiosk.js.map +0 -7
  139. package/dist/cjs/query/transfer-policy.d.ts +0 -29
  140. package/dist/cjs/query/transfer-policy.js +0 -92
  141. package/dist/cjs/query/transfer-policy.js.map +0 -7
  142. package/dist/cjs/tx/kiosk.d.ts +0 -71
  143. package/dist/cjs/tx/kiosk.js +0 -130
  144. package/dist/cjs/tx/kiosk.js.map +0 -7
  145. package/dist/cjs/tx/personal-kiosk.d.ts +0 -7
  146. package/dist/cjs/tx/personal-kiosk.js +0 -38
  147. package/dist/cjs/tx/personal-kiosk.js.map +0 -7
  148. package/dist/cjs/tx/rules/attach.d.ts +0 -7
  149. package/dist/cjs/tx/rules/attach.js +0 -62
  150. package/dist/cjs/tx/rules/attach.js.map +0 -7
  151. package/dist/cjs/tx/rules/resolve.d.ts +0 -15
  152. package/dist/cjs/tx/rules/resolve.js +0 -109
  153. package/dist/cjs/tx/rules/resolve.js.map +0 -7
  154. package/dist/cjs/tx/transfer-policy.d.ts +0 -29
  155. package/dist/cjs/tx/transfer-policy.js +0 -78
  156. package/dist/cjs/tx/transfer-policy.js.map +0 -7
  157. package/dist/cjs/types/index.d.ts +0 -27
  158. package/dist/cjs/types/index.js +0 -33
  159. package/dist/cjs/types/index.js.map +0 -7
  160. package/dist/cjs/types/kiosk.d.ts +0 -160
  161. package/dist/cjs/types/kiosk.js +0 -37
  162. package/dist/cjs/types/kiosk.js.map +0 -7
  163. package/dist/cjs/types/transfer-policy.d.ts +0 -53
  164. package/dist/cjs/types/transfer-policy.js +0 -35
  165. package/dist/cjs/types/transfer-policy.js.map +0 -7
  166. package/dist/cjs/utils.d.ts +0 -51
  167. package/dist/cjs/utils.js +0 -198
  168. package/dist/cjs/utils.js.map +0 -7
  169. package/dist/esm/bcs.d.ts +0 -23
  170. package/dist/esm/bcs.js +0 -35
  171. package/dist/esm/bcs.js.map +0 -7
  172. package/dist/esm/client/kiosk-client.d.ts +0 -76
  173. package/dist/esm/client/kiosk-client.js +0 -114
  174. package/dist/esm/client/kiosk-client.js.map +0 -7
  175. package/dist/esm/client/kiosk-transaction.d.ts +0 -186
  176. package/dist/esm/client/kiosk-transaction.js +0 -432
  177. package/dist/esm/client/kiosk-transaction.js.map +0 -7
  178. package/dist/esm/client/tp-transaction.d.ts +0 -114
  179. package/dist/esm/client/tp-transaction.js +0 -298
  180. package/dist/esm/client/tp-transaction.js.map +0 -7
  181. package/dist/esm/constants.d.ts +0 -31
  182. package/dist/esm/constants.js +0 -87
  183. package/dist/esm/constants.js.map +0 -7
  184. package/dist/esm/index.d.ts +0 -6
  185. package/dist/esm/index.js +0 -7
  186. package/dist/esm/index.js.map +0 -7
  187. package/dist/esm/package.json +0 -5
  188. package/dist/esm/query/kiosk.d.ts +0 -8
  189. package/dist/esm/query/kiosk.js +0 -169
  190. package/dist/esm/query/kiosk.js.map +0 -7
  191. package/dist/esm/query/transfer-policy.d.ts +0 -29
  192. package/dist/esm/query/transfer-policy.js +0 -76
  193. package/dist/esm/query/transfer-policy.js.map +0 -7
  194. package/dist/esm/tx/kiosk.d.ts +0 -71
  195. package/dist/esm/tx/kiosk.js +0 -110
  196. package/dist/esm/tx/kiosk.js.map +0 -7
  197. package/dist/esm/tx/personal-kiosk.d.ts +0 -7
  198. package/dist/esm/tx/personal-kiosk.js +0 -18
  199. package/dist/esm/tx/personal-kiosk.js.map +0 -7
  200. package/dist/esm/tx/rules/attach.d.ts +0 -7
  201. package/dist/esm/tx/rules/attach.js +0 -42
  202. package/dist/esm/tx/rules/attach.js.map +0 -7
  203. package/dist/esm/tx/rules/resolve.d.ts +0 -15
  204. package/dist/esm/tx/rules/resolve.js +0 -89
  205. package/dist/esm/tx/rules/resolve.js.map +0 -7
  206. package/dist/esm/tx/transfer-policy.d.ts +0 -29
  207. package/dist/esm/tx/transfer-policy.js +0 -58
  208. package/dist/esm/tx/transfer-policy.js.map +0 -7
  209. package/dist/esm/types/index.d.ts +0 -27
  210. package/dist/esm/types/index.js +0 -12
  211. package/dist/esm/types/index.js.map +0 -7
  212. package/dist/esm/types/kiosk.d.ts +0 -160
  213. package/dist/esm/types/kiosk.js +0 -17
  214. package/dist/esm/types/kiosk.js.map +0 -7
  215. package/dist/esm/types/transfer-policy.d.ts +0 -53
  216. package/dist/esm/types/transfer-policy.js +0 -15
  217. package/dist/esm/types/transfer-policy.js.map +0 -7
  218. package/dist/esm/utils.d.ts +0 -51
  219. package/dist/esm/utils.js +0 -183
  220. package/dist/esm/utils.js.map +0 -7
  221. package/dist/tsconfig.esm.tsbuildinfo +0 -1
  222. package/dist/tsconfig.tsbuildinfo +0 -1
  223. package/src/bcs.ts +0 -39
  224. package/src/tx/personal-kiosk.ts +0 -34
  225. package/src/tx/rules/attach.ts +0 -73
package/README.md CHANGED
@@ -3,6 +3,6 @@
3
3
  This Kiosk SDK library provides different utilities to interact/create/manage a
4
4
  [Kiosk](https://github.com/GeunhwaJeong/haneul/tree/main/kiosk).
5
5
 
6
- [You can read the documentation and see examples by clicking here.](https://sdk.haneullabs.com/kiosk)
6
+ [You can read the documentation and see examples by clicking here.](https://sdk.haneul-labs.com/kiosk)
7
7
 
8
- [If you are migrating from `0.6.x`, you can follow these instructions](https://sdk.haneullabs.com/kiosk/from-v1)
8
+ [If you are migrating from `0.6.x`, you can follow these instructions](https://sdk.haneul-labs.com/kiosk/from-v1)
@@ -0,0 +1,126 @@
1
+ import { BaseRulePackageIds, TransferPolicyRule } from "../constants.mjs";
2
+ import { FetchKioskOptions, KioskData, KioskExtension, OwnedKiosks } from "../types/kiosk.mjs";
3
+ import { TransferPolicy, TransferPolicyCap } from "../types/transfer-policy.mjs";
4
+ import { KioskClientOptions, KioskCompatibleClient } from "../types/index.mjs";
5
+ import { PaginationArguments } from "@haneullabs/haneul/jsonRpc";
6
+ import { HaneulClientTypes } from "@haneullabs/haneul/client";
7
+
8
+ //#region src/client/kiosk-client.d.ts
9
+ type KioskExtensionOptions<Name extends string = 'kiosk'> = {
10
+ name?: Name;
11
+ packageIds?: BaseRulePackageIds;
12
+ };
13
+ /**
14
+ * Creates a kiosk client extension that can be used with `client.$extend()`.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import { HaneulJsonRpcClient } from '@haneullabs/haneul/jsonRpc';
19
+ * import { kiosk } from '@haneullabs/kiosk';
20
+ *
21
+ * const client = new HaneulJsonRpcClient({
22
+ * url: getJsonRpcFullnodeUrl('mainnet'),
23
+ * network: 'mainnet',
24
+ * }).$extend(kiosk());
25
+ *
26
+ * const ownedKiosks = await client.kiosk.getOwnedKiosks({ address: '0x...' });
27
+ * ```
28
+ */
29
+ declare function kiosk<const Name extends string = 'kiosk'>({
30
+ name,
31
+ packageIds
32
+ }?: KioskExtensionOptions<Name>): {
33
+ name: Name;
34
+ register: (client: KioskCompatibleClient) => KioskClient;
35
+ };
36
+ /**
37
+ * A Client that allows you to interact with kiosk.
38
+ * Offers utilities to query kiosk, craft transactions to edit your own kiosk,
39
+ * purchase, manage transfer policies, create new kiosks etc.
40
+ * If you pass packageIds, all functionality will be managed using these packages.
41
+ */
42
+ declare class KioskClient {
43
+ client: KioskCompatibleClient;
44
+ network: HaneulClientTypes.Network;
45
+ rules: TransferPolicyRule[];
46
+ packageIds?: BaseRulePackageIds;
47
+ constructor(options: KioskClientOptions);
48
+ /**
49
+ * Get an addresses's owned kiosks.
50
+ * @param address The address for which we want to retrieve the kiosks.
51
+ * @param pagination Optional pagination arguments.
52
+ * @returns An Object containing all the `kioskOwnerCap` objects as well as the kioskIds.
53
+ */
54
+ getOwnedKiosks({
55
+ address,
56
+ pagination
57
+ }: {
58
+ address: string;
59
+ pagination?: PaginationArguments<string>;
60
+ }): Promise<OwnedKiosks>;
61
+ /**
62
+ * Fetches the kiosk contents.
63
+ * @param id The ID of the kiosk to fetch.
64
+ * @param options Optional to control the fetch behavior.
65
+ * @returns
66
+ */
67
+ getKiosk({
68
+ id,
69
+ options
70
+ }: {
71
+ id: string;
72
+ options?: FetchKioskOptions;
73
+ }): Promise<KioskData>;
74
+ /**
75
+ * Fetch the extension data (if any) for a kiosk, by type
76
+ * @param kioskId The ID of the kiosk to lookup
77
+ * @param extensionType The Type of the extension (can be used from by using the type returned by `getKiosk()`)
78
+ */
79
+ getKioskExtension({
80
+ kioskId,
81
+ type
82
+ }: {
83
+ kioskId: string;
84
+ type: string;
85
+ }): Promise<KioskExtension | null>;
86
+ /**
87
+ * Query the Transfer Policy(ies) for type `T`.
88
+ * @param type The Type we're querying for (E.g `0xMyAddress::hero::Hero`)
89
+ */
90
+ getTransferPolicies({
91
+ type
92
+ }: {
93
+ type: string;
94
+ }): Promise<TransferPolicy[]>;
95
+ /**
96
+ * Query all the owned transfer policies for an address.
97
+ * Returns `TransferPolicyCap` which uncludes `policyId, policyCapId, type`.
98
+ * @param address The address we're searching the owned transfer policies for.
99
+ */
100
+ getOwnedTransferPolicies({
101
+ address
102
+ }: {
103
+ address: string;
104
+ }): Promise<TransferPolicyCap[] | undefined>;
105
+ /**
106
+ * Query the Transfer Policy Cap for type `T`, owned by `address`
107
+ * @param type The Type `T` for the object
108
+ * @param address The address that owns the cap.
109
+ */
110
+ getOwnedTransferPoliciesByType({
111
+ type,
112
+ address
113
+ }: {
114
+ type: string;
115
+ address: string;
116
+ }): Promise<TransferPolicyCap[]>;
117
+ addRuleResolver(rule: TransferPolicyRule): void;
118
+ /**
119
+ * A convenient helper to get the packageIds for our supported ruleset,
120
+ * based on `kioskClient` configuration.
121
+ */
122
+ getRulePackageId(rule: 'kioskLockRulePackageId' | 'royaltyRulePackageId' | 'personalKioskRulePackageId' | 'floorPriceRulePackageId'): string | undefined;
123
+ }
124
+ //#endregion
125
+ export { KioskClient, KioskExtensionOptions, kiosk };
126
+ //# sourceMappingURL=kiosk-client.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kiosk-client.d.mts","names":[],"sources":["../../src/client/kiosk-client.ts"],"mappings":";;;;;;;;KA6BY,qBAAA;EACX,IAAA,GAAO,IAAA;EACP,UAAA,GAAa,kBAAA;AAAA;AAFd;;;;;;;;;;;AAqBA;;;;;AArBA,iBAqBgB,KAAA,qCAAA,CAAA;EACf,IAAA;EACA;AAAA,IACE,qBAAA,CAAsB,IAAA;;qBAGJ,qBAAA,KAAqB,WAAA;AAAA;;;;;;;cAgB7B,WAAA;EACZ,MAAA,EAAQ,qBAAA;EACR,OAAA,EAAS,iBAAA,CAAkB,OAAA;EAC3B,KAAA,EAAO,kBAAA;EACP,UAAA,GAAa,kBAAA;cAED,OAAA,EAAS,kBAAA;;;;;;;EAmBf,cAAA,CAAA;IACL,OAAA;IACA;EAAA;IAEA,OAAA;IACA,UAAA,GAAa,mBAAA;EAAA,IACV,OAAA,CAAQ,WAAA;EA7BH;;;;;;EA+CH,QAAA,CAAA;IAAW,EAAA;IAAI;EAAA;IAAa,EAAA;IAAY,OAAA,GAAU,iBAAA;EAAA,IAAsB,OAAA,CAAQ,SAAA;EAAjE;;;;;EASf,iBAAA,CAAA;IAAoB,OAAA;IAAS;EAAA;IAAU,OAAA;IAAiB,IAAA;EAAA,IAAc,OAAA,CAArC,cAAA;EAQP;;;;EAA1B,mBAAA,CAAA;IAAsB;EAAA;IAAU,IAAA;EAAA,IAAc,OAAA,CAApB,cAAA;EAkBoB;;;;;EAT9C,wBAAA,CAAA;IAA2B;EAAA;IAAa,OAAA;EAAA,IAAiB,OAAA,CAAvB,iBAAA;EAzE/B;;;;;EAkFH,8BAAA,CAAA;IAAiC,IAAA;IAAM;EAAA;IAAa,IAAA;IAAc,OAAA;EAAA,IAAiB,OAAA,CAArC,iBAAA;EAOpD,eAAA,CAAgB,IAAA,EAAM,kBAAA;EAjErB;;;;EA2ED,gBAAA,CACC,IAAA;AAAA"}
@@ -0,0 +1,124 @@
1
+ import { FLOOR_PRICE_RULE_ADDRESS, KIOSK_LOCK_RULE_ADDRESS, PERSONAL_KIOSK_RULE_ADDRESS, ROYALTY_RULE_ADDRESS, getBaseRules, rules } from "../constants.mjs";
2
+ import { fetchKiosk, fetchKioskExtension, getOwnedKiosks } from "../query/kiosk.mjs";
3
+ import { queryOwnedTransferPolicies, queryTransferPolicy, queryTransferPolicyCapsByType } from "../query/transfer-policy.mjs";
4
+
5
+ //#region src/client/kiosk-client.ts
6
+ /**
7
+ * Creates a kiosk client extension that can be used with `client.$extend()`.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { HaneulJsonRpcClient } from '@haneullabs/haneul/jsonRpc';
12
+ * import { kiosk } from '@haneullabs/kiosk';
13
+ *
14
+ * const client = new HaneulJsonRpcClient({
15
+ * url: getJsonRpcFullnodeUrl('mainnet'),
16
+ * network: 'mainnet',
17
+ * }).$extend(kiosk());
18
+ *
19
+ * const ownedKiosks = await client.kiosk.getOwnedKiosks({ address: '0x...' });
20
+ * ```
21
+ */
22
+ function kiosk({ name = "kiosk", packageIds } = {}) {
23
+ return {
24
+ name,
25
+ register: (client) => {
26
+ return new KioskClient({
27
+ client,
28
+ network: client.network,
29
+ packageIds
30
+ });
31
+ }
32
+ };
33
+ }
34
+ /**
35
+ * A Client that allows you to interact with kiosk.
36
+ * Offers utilities to query kiosk, craft transactions to edit your own kiosk,
37
+ * purchase, manage transfer policies, create new kiosks etc.
38
+ * If you pass packageIds, all functionality will be managed using these packages.
39
+ */
40
+ var KioskClient = class {
41
+ constructor(options) {
42
+ this.client = options.client;
43
+ this.network = options.network;
44
+ this.rules = rules;
45
+ this.packageIds = options.packageIds;
46
+ if (options.packageIds) this.rules.push(...getBaseRules(options.packageIds));
47
+ }
48
+ /**
49
+ * Get an addresses's owned kiosks.
50
+ * @param address The address for which we want to retrieve the kiosks.
51
+ * @param pagination Optional pagination arguments.
52
+ * @returns An Object containing all the `kioskOwnerCap` objects as well as the kioskIds.
53
+ */
54
+ async getOwnedKiosks({ address, pagination }) {
55
+ const personalPackageId = this.packageIds?.personalKioskRulePackageId || PERSONAL_KIOSK_RULE_ADDRESS[this.network];
56
+ return getOwnedKiosks(this.client, address, {
57
+ pagination,
58
+ personalKioskType: personalPackageId ? `${personalPackageId}::personal_kiosk::PersonalKioskCap` : ""
59
+ });
60
+ }
61
+ /**
62
+ * Fetches the kiosk contents.
63
+ * @param id The ID of the kiosk to fetch.
64
+ * @param options Optional to control the fetch behavior.
65
+ * @returns
66
+ */
67
+ async getKiosk({ id, options }) {
68
+ return (await fetchKiosk(this.client, id, {}, options || {})).data;
69
+ }
70
+ /**
71
+ * Fetch the extension data (if any) for a kiosk, by type
72
+ * @param kioskId The ID of the kiosk to lookup
73
+ * @param extensionType The Type of the extension (can be used from by using the type returned by `getKiosk()`)
74
+ */
75
+ async getKioskExtension({ kioskId, type }) {
76
+ return fetchKioskExtension(this.client, kioskId, type);
77
+ }
78
+ /**
79
+ * Query the Transfer Policy(ies) for type `T`.
80
+ * @param type The Type we're querying for (E.g `0xMyAddress::hero::Hero`)
81
+ */
82
+ async getTransferPolicies({ type }) {
83
+ return queryTransferPolicy(this.client, type);
84
+ }
85
+ /**
86
+ * Query all the owned transfer policies for an address.
87
+ * Returns `TransferPolicyCap` which uncludes `policyId, policyCapId, type`.
88
+ * @param address The address we're searching the owned transfer policies for.
89
+ */
90
+ async getOwnedTransferPolicies({ address }) {
91
+ return queryOwnedTransferPolicies(this.client, address);
92
+ }
93
+ /**
94
+ * Query the Transfer Policy Cap for type `T`, owned by `address`
95
+ * @param type The Type `T` for the object
96
+ * @param address The address that owns the cap.
97
+ */
98
+ async getOwnedTransferPoliciesByType({ type, address }) {
99
+ return queryTransferPolicyCapsByType(this.client, address, type);
100
+ }
101
+ addRuleResolver(rule) {
102
+ if (this.rules.find((x) => x.rule === rule.rule)) throw new Error(`Rule ${rule.rule} resolver already exists.`);
103
+ this.rules.push(rule);
104
+ }
105
+ /**
106
+ * A convenient helper to get the packageIds for our supported ruleset,
107
+ * based on `kioskClient` configuration.
108
+ */
109
+ getRulePackageId(rule) {
110
+ const rules$1 = this.packageIds || {};
111
+ const network = this.network;
112
+ if (!rules$1[rule] && network !== "mainnet" && network !== "testnet") throw new Error(`Missing packageId for rule ${rule}`);
113
+ switch (rule) {
114
+ case "kioskLockRulePackageId": return rules$1[rule] || KIOSK_LOCK_RULE_ADDRESS[network];
115
+ case "royaltyRulePackageId": return rules$1[rule] || ROYALTY_RULE_ADDRESS[network];
116
+ case "personalKioskRulePackageId": return rules$1[rule] || PERSONAL_KIOSK_RULE_ADDRESS[network];
117
+ case "floorPriceRulePackageId": return rules$1[rule] || FLOOR_PRICE_RULE_ADDRESS[network];
118
+ }
119
+ }
120
+ };
121
+
122
+ //#endregion
123
+ export { KioskClient, kiosk };
124
+ //# sourceMappingURL=kiosk-client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kiosk-client.mjs","names":["rules"],"sources":["../../src/client/kiosk-client.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PaginationArguments } from '@haneullabs/haneul/jsonRpc';\nimport type { HaneulClientTypes } from '@haneullabs/haneul/client';\n\nimport {\n\tFLOOR_PRICE_RULE_ADDRESS,\n\tgetBaseRules,\n\tKIOSK_LOCK_RULE_ADDRESS,\n\tPERSONAL_KIOSK_RULE_ADDRESS,\n\tROYALTY_RULE_ADDRESS,\n\trules,\n} from '../constants.js';\nimport type { BaseRulePackageIds, TransferPolicyRule } from '../constants.js';\nimport { fetchKiosk, fetchKioskExtension, getOwnedKiosks } from '../query/kiosk.js';\nimport {\n\tqueryOwnedTransferPolicies,\n\tqueryTransferPolicy,\n\tqueryTransferPolicyCapsByType,\n} from '../query/transfer-policy.js';\nimport type {\n\tFetchKioskOptions,\n\tKioskClientOptions,\n\tKioskCompatibleClient,\n\tKioskData,\n\tOwnedKiosks,\n} from '../types/index.js';\n\nexport type KioskExtensionOptions<Name extends string = 'kiosk'> = {\n\tname?: Name;\n\tpackageIds?: BaseRulePackageIds;\n};\n\n/**\n * Creates a kiosk client extension that can be used with `client.$extend()`.\n *\n * @example\n * ```ts\n * import { HaneulJsonRpcClient } from '@haneullabs/haneul/jsonRpc';\n * import { kiosk } from '@haneullabs/kiosk';\n *\n * const client = new HaneulJsonRpcClient({\n * url: getJsonRpcFullnodeUrl('mainnet'),\n * network: 'mainnet',\n * }).$extend(kiosk());\n *\n * const ownedKiosks = await client.kiosk.getOwnedKiosks({ address: '0x...' });\n * ```\n */\nexport function kiosk<const Name extends string = 'kiosk'>({\n\tname = 'kiosk' as Name,\n\tpackageIds,\n}: KioskExtensionOptions<Name> = {}) {\n\treturn {\n\t\tname,\n\t\tregister: (client: KioskCompatibleClient) => {\n\t\t\treturn new KioskClient({\n\t\t\t\tclient,\n\t\t\t\tnetwork: client.network,\n\t\t\t\tpackageIds,\n\t\t\t});\n\t\t},\n\t};\n}\n\n/**\n * A Client that allows you to interact with kiosk.\n * Offers utilities to query kiosk, craft transactions to edit your own kiosk,\n * purchase, manage transfer policies, create new kiosks etc.\n * If you pass packageIds, all functionality will be managed using these packages.\n */\nexport class KioskClient {\n\tclient: KioskCompatibleClient;\n\tnetwork: HaneulClientTypes.Network;\n\trules: TransferPolicyRule[];\n\tpackageIds?: BaseRulePackageIds;\n\n\tconstructor(options: KioskClientOptions) {\n\t\tthis.client = options.client;\n\t\tthis.network = options.network;\n\t\tthis.rules = rules; // add all the default rules.\n\t\tthis.packageIds = options.packageIds;\n\n\t\t// Add the custom Package Ids too on the rule list.\n\t\t// Only adds the rules that are passed in the packageId object.\n\t\tif (options.packageIds) this.rules.push(...getBaseRules(options.packageIds));\n\t}\n\n\t/// Querying\n\n\t/**\n\t * Get an addresses's owned kiosks.\n\t * @param address The address for which we want to retrieve the kiosks.\n\t * @param pagination Optional pagination arguments.\n\t * @returns An Object containing all the `kioskOwnerCap` objects as well as the kioskIds.\n\t */\n\tasync getOwnedKiosks({\n\t\taddress,\n\t\tpagination,\n\t}: {\n\t\taddress: string;\n\t\tpagination?: PaginationArguments<string>;\n\t}): Promise<OwnedKiosks> {\n\t\tconst personalPackageId =\n\t\t\tthis.packageIds?.personalKioskRulePackageId || PERSONAL_KIOSK_RULE_ADDRESS[this.network];\n\n\t\treturn getOwnedKiosks(this.client, address, {\n\t\t\tpagination,\n\t\t\tpersonalKioskType: personalPackageId\n\t\t\t\t? `${personalPackageId}::personal_kiosk::PersonalKioskCap`\n\t\t\t\t: '',\n\t\t});\n\t}\n\n\t/**\n\t * Fetches the kiosk contents.\n\t * @param id The ID of the kiosk to fetch.\n\t * @param options Optional to control the fetch behavior.\n\t * @returns\n\t */\n\tasync getKiosk({ id, options }: { id: string; options?: FetchKioskOptions }): Promise<KioskData> {\n\t\treturn (await fetchKiosk(this.client, id, {}, options || {})).data;\n\t}\n\n\t/**\n\t * Fetch the extension data (if any) for a kiosk, by type\n\t * @param kioskId The ID of the kiosk to lookup\n\t * @param extensionType The Type of the extension (can be used from by using the type returned by `getKiosk()`)\n\t */\n\tasync getKioskExtension({ kioskId, type }: { kioskId: string; type: string }) {\n\t\treturn fetchKioskExtension(this.client, kioskId, type);\n\t}\n\n\t/**\n\t * Query the Transfer Policy(ies) for type `T`.\n\t * @param type The Type we're querying for (E.g `0xMyAddress::hero::Hero`)\n\t */\n\tasync getTransferPolicies({ type }: { type: string }) {\n\t\treturn queryTransferPolicy(this.client, type);\n\t}\n\n\t/**\n\t * Query all the owned transfer policies for an address.\n\t * Returns `TransferPolicyCap` which uncludes `policyId, policyCapId, type`.\n\t * @param address The address we're searching the owned transfer policies for.\n\t */\n\tasync getOwnedTransferPolicies({ address }: { address: string }) {\n\t\treturn queryOwnedTransferPolicies(this.client, address);\n\t}\n\n\t/**\n\t * Query the Transfer Policy Cap for type `T`, owned by `address`\n\t * @param type The Type `T` for the object\n\t * @param address The address that owns the cap.\n\t */\n\tasync getOwnedTransferPoliciesByType({ type, address }: { type: string; address: string }) {\n\t\treturn queryTransferPolicyCapsByType(this.client, address, type);\n\t}\n\n\t// Someone would just have to create a `kiosk-client.ts` file in their project, initialize a KioskClient\n\t// and call the `addRuleResolver` function. Each rule has a `resolve` function.\n\t// The resolve function is automatically called on `purchaseAndResolve` function call.\n\taddRuleResolver(rule: TransferPolicyRule) {\n\t\tif (this.rules.find((x) => x.rule === rule.rule))\n\t\t\tthrow new Error(`Rule ${rule.rule} resolver already exists.`);\n\t\tthis.rules.push(rule);\n\t}\n\n\t/**\n\t * A convenient helper to get the packageIds for our supported ruleset,\n\t * based on `kioskClient` configuration.\n\t */\n\tgetRulePackageId(\n\t\trule:\n\t\t\t| 'kioskLockRulePackageId'\n\t\t\t| 'royaltyRulePackageId'\n\t\t\t| 'personalKioskRulePackageId'\n\t\t\t| 'floorPriceRulePackageId',\n\t) {\n\t\tconst rules = this.packageIds || {};\n\t\tconst network = this.network;\n\n\t\t/// Check existence of rule based on network and throw an error if it's not found.\n\t\t/// We always have a fallback for testnet or mainnet.\n\t\tif (!rules[rule] && network !== 'mainnet' && network !== 'testnet') {\n\t\t\tthrow new Error(`Missing packageId for rule ${rule}`);\n\t\t}\n\n\t\tswitch (rule) {\n\t\t\tcase 'kioskLockRulePackageId':\n\t\t\t\treturn rules[rule] || KIOSK_LOCK_RULE_ADDRESS[network];\n\t\t\tcase 'royaltyRulePackageId':\n\t\t\t\treturn rules[rule] || ROYALTY_RULE_ADDRESS[network];\n\t\t\tcase 'personalKioskRulePackageId':\n\t\t\t\treturn rules[rule] || PERSONAL_KIOSK_RULE_ADDRESS[network];\n\t\t\tcase 'floorPriceRulePackageId':\n\t\t\t\treturn rules[rule] || FLOOR_PRICE_RULE_ADDRESS[network];\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,MAA2C,EAC1D,OAAO,SACP,eACgC,EAAE,EAAE;AACpC,QAAO;EACN;EACA,WAAW,WAAkC;AAC5C,UAAO,IAAI,YAAY;IACtB;IACA,SAAS,OAAO;IAChB;IACA,CAAC;;EAEH;;;;;;;;AASF,IAAa,cAAb,MAAyB;CAMxB,YAAY,SAA6B;AACxC,OAAK,SAAS,QAAQ;AACtB,OAAK,UAAU,QAAQ;AACvB,OAAK,QAAQ;AACb,OAAK,aAAa,QAAQ;AAI1B,MAAI,QAAQ,WAAY,MAAK,MAAM,KAAK,GAAG,aAAa,QAAQ,WAAW,CAAC;;;;;;;;CAW7E,MAAM,eAAe,EACpB,SACA,cAIwB;EACxB,MAAM,oBACL,KAAK,YAAY,8BAA8B,4BAA4B,KA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+ import { KioskClient } from "./kiosk-client.mjs";
3
+ import { ObjectArgument } from "../types/index.mjs";
4
+ import { Transaction, TransactionArgument, TransactionObjectArgument } from "@haneullabs/haneul/transactions";
5
+
6
+ //#region src/client/kiosk-transaction.d.ts
7
+ type KioskTransactionParams = {
8
+ /** The Transaction for this run */transaction: Transaction;
9
+ /**
10
+ * You can create a new KioskClient by calling `new KioskClient()`
11
+ */
12
+ kioskClient: KioskClient;
13
+ /**
14
+ * You can optionally pass in the `cap` as returned
15
+ * from `kioskClient.getOwnedKiosks` when initializing the client
16
+ * Otherwise, you can set it by calling `kioskTransaction.setCap()`
17
+ */
18
+ cap?: KioskOwnerCap;
19
+ };
20
+ /**
21
+ * A helper for building transactions that involve kiosk.
22
+ */
23
+ declare class KioskTransaction {
24
+ #private;
25
+ transaction: Transaction;
26
+ kioskClient: KioskClient;
27
+ kiosk?: TransactionObjectArgument;
28
+ kioskCap?: TransactionObjectArgument;
29
+ constructor({
30
+ transaction,
31
+ kioskClient,
32
+ cap
33
+ }: KioskTransactionParams);
34
+ /**
35
+ * Creates a kiosk and saves `kiosk` and `kioskOwnerCap` in state.
36
+ * Helpful if we want to chain some actions before sharing + transferring the cap to the specified address.
37
+ * @param borrow If true, the `kioskOwnerCap` is borrowed from the `PersonalKioskCap` to be used in next transactions.
38
+ */
39
+ create(): this;
40
+ /**
41
+ * Creates a personal kiosk & shares it.
42
+ * The `PersonalKioskCap` is transferred to the signer.
43
+ * @param borrow If true, the `kioskOwnerCap` is borrowed from the `PersonalKioskCap` to be used in next transactions.
44
+ */
45
+ createPersonal(borrow?: boolean): this;
46
+ /**
47
+ * Converts a kiosk to a Personal (Soulbound) Kiosk.
48
+ * Requires initialization by either calling `ktxb.create()` or `ktxb.setCap()`.
49
+ */
50
+ convertToPersonal(borrow?: boolean): this;
51
+ /**
52
+ * Single function way to create a kiosk, share it and transfer the cap to the specified address.
53
+ */
54
+ createAndShare(address: string): this;
55
+ /**
56
+ * Shares the kiosk.
57
+ */
58
+ share(): this;
59
+ /**
60
+ * Should be called only after `create` is called.
61
+ * It shares the kiosk & transfers the cap to the specified address.
62
+ */
63
+ shareAndTransferCap(address: string): this;
64
+ /**
65
+ * A function to borrow an item from a kiosk & execute any function with it.
66
+ * Example: You could borrow a Fren out of a kiosk, attach an accessory (or mix), and return it.
67
+ */
68
+ borrowTx({
69
+ itemType,
70
+ itemId
71
+ }: ItemId, callback: (item: TransactionArgument) => void): this;
72
+ /**
73
+ * Borrows an item from the kiosk.
74
+ * This will fail if the item is listed for sale.
75
+ *
76
+ * Requires calling `return`.
77
+ */
78
+ borrow({
79
+ itemType,
80
+ itemId
81
+ }: ItemId): [TransactionArgument, TransactionArgument];
82
+ /**
83
+ * Returns the item back to the kiosk.
84
+ * Accepts the parameters returned from the `borrow` function.
85
+ */
86
+ return({
87
+ itemType,
88
+ item,
89
+ promise
90
+ }: ItemValue & {
91
+ promise: TransactionArgument;
92
+ }): this;
93
+ /**
94
+ * A function to withdraw from kiosk
95
+ * @param address Where to transfer the coin.
96
+ * @param amount The amount we aim to withdraw.
97
+ */
98
+ withdraw(address: string, amount?: string | bigint | number): this;
99
+ /**
100
+ * A function to place an item in the kiosk.
101
+ * @param itemType The type `T` of the item
102
+ * @param item The ID or Transaction Argument of the item
103
+ */
104
+ place({
105
+ itemType,
106
+ item
107
+ }: ItemReference): this;
108
+ /**
109
+ * A function to place an item in the kiosk and list it for sale in one transaction.
110
+ * @param itemType The type `T` of the item
111
+ * @param item The ID or Transaction Argument of the item
112
+ * @param price The price in GEUNHWA
113
+ */
114
+ placeAndList({
115
+ itemType,
116
+ item,
117
+ price
118
+ }: ItemReference & Price): this;
119
+ /**
120
+ * A function to list an item in the kiosk.
121
+ * @param itemType The type `T` of the item
122
+ * @param itemId The ID of the item
123
+ * @param price The price in GEUNHWA
124
+ */
125
+ list({
126
+ itemType,
127
+ itemId,
128
+ price
129
+ }: ItemId & {
130
+ price: string | bigint;
131
+ }): this;
132
+ /**
133
+ * A function to delist an item from the kiosk.
134
+ * @param itemType The type `T` of the item
135
+ * @param itemId The ID of the item
136
+ */
137
+ delist({
138
+ itemType,
139
+ itemId
140
+ }: ItemId): this;
141
+ /**
142
+ * A function to take an item from the kiosk. The transaction won't succeed if the item is listed or locked.
143
+ * @param itemType The type `T` of the item
144
+ * @param itemId The ID of the item
145
+ */
146
+ take({
147
+ itemType,
148
+ itemId
149
+ }: ItemId): TransactionObjectArgument;
150
+ /**
151
+ * Transfer a non-locked/non-listed item to an address.
152
+ *
153
+ * @param itemType The type `T` of the item
154
+ * @param itemId The ID of the item
155
+ * @param address The destination address
156
+ */
157
+ transfer({
158
+ itemType,
159
+ itemId,
160
+ address
161
+ }: ItemId & {
162
+ address: string;
163
+ }): this;
164
+ /**
165
+ * A function to take lock an item in the kiosk.
166
+ * @param itemType The type `T` of the item
167
+ * @param item The ID or Transaction Argument of the item
168
+ * @param itemId The ID of the item - Deprecated: Use `item` instead.
169
+ * @param policy The Policy ID or Transaction Argument for item T
170
+ */
171
+ lock({
172
+ itemType,
173
+ item,
174
+ itemId,
175
+ policy
176
+ }: ItemReference & {
177
+ policy: ObjectArgument;
178
+ itemId?: string;
179
+ }): this;
180
+ /**
181
+ * Purchase an item from a seller's kiosk.
182
+ * Returns [item, transferRequest]
183
+ * Can be called like: `const [item, transferRequest] = kioskTx.purchase({...})`
184
+ * @param itemType The type `T` of the item
185
+ * @param itemId The ID of the item
186
+ * @param price The price in GEUNHWA
187
+ * @param sellerKiosk The kiosk which is selling the item. Can be an id or an object argument.
188
+ */
189
+ purchase({
190
+ itemType,
191
+ itemId,
192
+ price,
193
+ sellerKiosk
194
+ }: ItemId & Price & {
195
+ sellerKiosk: ObjectArgument;
196
+ }): [TransactionObjectArgument, TransactionObjectArgument];
197
+ /**
198
+ * A function to purchase and resolve a transfer policy.
199
+ * If the transfer policy has the `lock` rule, the item is locked in the kiosk.
200
+ * Otherwise, the item is placed in the kiosk.
201
+ * @param itemType The type of the item
202
+ * @param itemId The id of the item
203
+ * @param price The price of the specified item
204
+ * @param sellerKiosk The kiosk which is selling the item. Can be an id or an object argument.
205
+ * @param extraArgs Used to pass arguments for custom rule resolvers.
206
+ */
207
+ purchaseAndResolve({
208
+ itemType,
209
+ itemId,
210
+ price,
211
+ sellerKiosk,
212
+ extraArgs
213
+ }: ItemId & Price & {
214
+ sellerKiosk: ObjectArgument;
215
+ } & PurchaseOptions): Promise<this>;
216
+ /**
217
+ * A function to setup the client using an existing `ownerCap`,
218
+ * as return from the `kioskClient.getOwnedKiosks` function.
219
+ * @param cap `KioskOwnerCap` object as returned from `getOwnedKiosks` SDK call.
220
+ */
221
+ setCap(cap: KioskOwnerCap): this | undefined;
222
+ /**
223
+ * A function that ends up the kiosk building tx & returns the `kioskOwnerCap` back to the
224
+ * `PersonalKioskCap`, in case we are operating on a personal kiosk.
225
+ * It will also share the `kiosk` if it's not shared, and finalize the transfer of the personal cap if it's pending.
226
+ */
227
+ finalize(): void;
228
+ setKioskCap(cap: TransactionObjectArgument): this;
229
+ setKiosk(kiosk: TransactionObjectArgument): this;
230
+ getKiosk(): TransactionObjectArgument;
231
+ getKioskCap(): TransactionObjectArgument;
232
+ }
233
+ //#endregion
234
+ export { KioskTransaction, KioskTransactionParams };
235
+ //# sourceMappingURL=kiosk-transaction.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kiosk-transaction.d.mts","names":[],"sources":["../../src/client/kiosk-transaction.ts"],"mappings":";;;;;;KAyBY,sBAAA;qCAEX,WAAA,EAAa,WAAA;EAFF;;;EAOX,WAAA,EAAa,WAAA;EAAA;;;;;EAMb,GAAA,GAAM,aAAA;AAAA;;;;cAMM,gBAAA;EAAA;EACZ,WAAA,EAAa,WAAA;EACb,WAAA,EAAa,WAAA;EACb,KAAA,GAAQ,yBAAA;EACR,QAAA,GAAW,yBAAA;;IAYG,WAAA;IAAa,WAAA;IAAa;EAAA,GAAO,sBAAA;EAbvC;;;;;EAyBR,MAAA,CAAA;EA0FW;;;;;EAzEX,cAAA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