@haneullabs/haneulns 0.1.0 → 1.0.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 (222) hide show
  1. package/CHANGELOG.md +125 -53
  2. package/README.md +3 -3
  3. package/dist/constants.d.mts +15 -0
  4. package/dist/constants.d.mts.map +1 -0
  5. package/dist/constants.mjs +90 -0
  6. package/dist/constants.mjs.map +1 -0
  7. package/dist/contracts/haneulns/controller.mjs +62 -0
  8. package/dist/contracts/haneulns/controller.mjs.map +1 -0
  9. package/dist/contracts/haneulns/deps/haneul/balance.mjs +21 -0
  10. package/dist/contracts/haneulns/deps/haneul/balance.mjs.map +1 -0
  11. package/dist/contracts/haneulns/deps/haneul/vec_map.mjs +37 -0
  12. package/dist/contracts/haneulns/deps/haneul/vec_map.mjs.map +1 -0
  13. package/dist/contracts/haneulns/deps/std/type_name.mjs +17 -0
  14. package/dist/contracts/haneulns/deps/std/type_name.mjs.map +1 -0
  15. package/dist/contracts/haneulns/domain.mjs +23 -0
  16. package/dist/contracts/haneulns/domain.mjs.map +1 -0
  17. package/dist/contracts/haneulns/haneulns.mjs +68 -0
  18. package/dist/contracts/haneulns/haneulns.mjs.map +1 -0
  19. package/dist/contracts/haneulns/name_record.mjs +27 -0
  20. package/dist/contracts/haneulns/name_record.mjs.map +1 -0
  21. package/dist/contracts/haneulns/payment.mjs +162 -0
  22. package/dist/contracts/haneulns/payment.mjs.map +1 -0
  23. package/dist/contracts/haneulns/pricing_config.mjs +25 -0
  24. package/dist/contracts/haneulns/pricing_config.mjs.map +1 -0
  25. package/dist/contracts/haneulns_coupons/coupon_house.mjs +59 -0
  26. package/dist/contracts/haneulns_coupons/coupon_house.mjs.map +1 -0
  27. package/dist/contracts/haneulns_coupons/data.mjs +16 -0
  28. package/dist/contracts/haneulns_coupons/data.mjs.map +1 -0
  29. package/dist/contracts/haneulns_coupons/deps/haneul/bag.mjs +43 -0
  30. package/dist/contracts/haneulns_coupons/deps/haneul/bag.mjs.map +1 -0
  31. package/dist/contracts/haneulns_discounts/deps/haneul/linked_table.mjs +27 -0
  32. package/dist/contracts/haneulns_discounts/deps/haneul/linked_table.mjs.map +1 -0
  33. package/dist/contracts/haneulns_discounts/deps/haneulns/pricing_config.mjs +16 -0
  34. package/dist/contracts/haneulns_discounts/deps/haneulns/pricing_config.mjs.map +1 -0
  35. package/dist/contracts/haneulns_discounts/discounts.mjs +51 -0
  36. package/dist/contracts/haneulns_discounts/discounts.mjs.map +1 -0
  37. package/dist/contracts/haneulns_discounts/free_claims.mjs +60 -0
  38. package/dist/contracts/haneulns_discounts/free_claims.mjs.map +1 -0
  39. package/dist/contracts/haneulns_payments/deps/haneul/vec_map.mjs +37 -0
  40. package/dist/contracts/haneulns_payments/deps/haneul/vec_map.mjs.map +1 -0
  41. package/dist/contracts/haneulns_payments/deps/std/type_name.mjs +17 -0
  42. package/dist/contracts/haneulns_payments/deps/std/type_name.mjs.map +1 -0
  43. package/dist/contracts/haneulns_payments/payments.mjs +145 -0
  44. package/dist/contracts/haneulns_payments/payments.mjs.map +1 -0
  45. package/dist/contracts/pyth/data_source.mjs +20 -0
  46. package/dist/contracts/pyth/data_source.mjs.map +1 -0
  47. package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +21 -0
  48. package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -0
  49. package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +19 -0
  50. package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -0
  51. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs +16 -0
  52. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs.map +1 -0
  53. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs +16 -0
  54. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs.map +1 -0
  55. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs +16 -0
  56. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs.map +1 -0
  57. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs +16 -0
  58. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs.map +1 -0
  59. package/dist/contracts/pyth/state.mjs +28 -0
  60. package/dist/contracts/pyth/state.mjs.map +1 -0
  61. package/dist/contracts/utils/index.mjs +120 -0
  62. package/dist/contracts/utils/index.mjs.map +1 -0
  63. package/dist/contracts/wormhole/bytes32.mjs +16 -0
  64. package/dist/contracts/wormhole/bytes32.mjs.map +1 -0
  65. package/dist/contracts/wormhole/consumed_vaas.mjs +16 -0
  66. package/dist/contracts/wormhole/consumed_vaas.mjs.map +1 -0
  67. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs +16 -0
  68. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs.map +1 -0
  69. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +21 -0
  70. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -0
  71. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +19 -0
  72. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -0
  73. package/dist/contracts/wormhole/external_address.mjs +16 -0
  74. package/dist/contracts/wormhole/external_address.mjs.map +1 -0
  75. package/dist/contracts/wormhole/fee_collector.mjs +20 -0
  76. package/dist/contracts/wormhole/fee_collector.mjs.map +1 -0
  77. package/dist/contracts/wormhole/set.mjs +16 -0
  78. package/dist/contracts/wormhole/set.mjs.map +1 -0
  79. package/dist/contracts/wormhole/state.mjs +31 -0
  80. package/dist/contracts/wormhole/state.mjs.map +1 -0
  81. package/dist/haneulns-client.d.mts +76 -0
  82. package/dist/haneulns-client.d.mts.map +1 -0
  83. package/dist/haneulns-client.mjs +205 -0
  84. package/dist/haneulns-client.mjs.map +1 -0
  85. package/dist/haneulns-transaction.d.mts +144 -0
  86. package/dist/haneulns-transaction.d.mts.map +1 -0
  87. package/dist/haneulns-transaction.mjs +384 -0
  88. package/dist/haneulns-transaction.mjs.map +1 -0
  89. package/dist/helpers.d.mts +22 -0
  90. package/dist/helpers.d.mts.map +1 -0
  91. package/dist/helpers.mjs +45 -0
  92. package/dist/helpers.mjs.map +1 -0
  93. package/dist/index.d.mts +6 -0
  94. package/dist/index.mjs +6 -0
  95. package/dist/pyth/PriceServiceConnection.mjs +35 -0
  96. package/dist/pyth/PriceServiceConnection.mjs.map +1 -0
  97. package/dist/pyth/pyth-helpers.mjs +18 -0
  98. package/dist/pyth/pyth-helpers.mjs.map +1 -0
  99. package/dist/pyth/pyth.mjs +219 -0
  100. package/dist/pyth/pyth.mjs.map +1 -0
  101. package/dist/types.d.mts +88 -0
  102. package/dist/types.d.mts.map +1 -0
  103. package/package.json +24 -20
  104. package/src/contracts/haneulns/admin.ts +114 -0
  105. package/src/contracts/haneulns/auction.ts +341 -0
  106. package/src/contracts/haneulns/config.ts +225 -0
  107. package/src/contracts/haneulns/constants.ts +167 -0
  108. package/src/contracts/haneulns/controller.ts +269 -0
  109. package/src/contracts/haneulns/core_config.ts +208 -0
  110. package/src/contracts/haneulns/deps/haneul/balance.ts +19 -0
  111. package/src/contracts/haneulns/deps/haneul/coin.ts +20 -0
  112. package/src/contracts/haneulns/deps/haneul/linked_table.ts +27 -0
  113. package/src/contracts/haneulns/deps/haneul/table.ts +36 -0
  114. package/src/contracts/haneulns/deps/haneul/vec_map.ts +33 -0
  115. package/src/contracts/haneulns/deps/haneul/vec_set.ts +22 -0
  116. package/src/contracts/haneulns/deps/std/type_name.ts +24 -0
  117. package/src/contracts/haneulns/domain.ts +230 -0
  118. package/src/contracts/haneulns/haneulns.ts +456 -0
  119. package/src/contracts/haneulns/haneulns_registration.ts +200 -0
  120. package/src/contracts/haneulns/name_record.ts +315 -0
  121. package/src/contracts/haneulns/payment.ts +444 -0
  122. package/src/contracts/haneulns/pricing_config.ts +190 -0
  123. package/src/contracts/haneulns/registry.ts +514 -0
  124. package/src/contracts/haneulns/subdomain_registration.ts +63 -0
  125. package/src/contracts/haneulns/update_image.ts +15 -0
  126. package/src/contracts/haneulns_coupons/constants.ts +45 -0
  127. package/src/contracts/haneulns_coupons/coupon.ts +15 -0
  128. package/src/contracts/haneulns_coupons/coupon_house.ts +412 -0
  129. package/src/contracts/haneulns_coupons/data.ts +12 -0
  130. package/src/contracts/haneulns_coupons/deps/haneul/bag.ts +41 -0
  131. package/src/contracts/haneulns_coupons/range.ts +101 -0
  132. package/src/contracts/haneulns_coupons/rules.ts +342 -0
  133. package/src/contracts/haneulns_discounts/deps/haneul/linked_table.ts +27 -0
  134. package/src/contracts/haneulns_discounts/deps/haneulns/pricing_config.ts +10 -0
  135. package/src/contracts/haneulns_discounts/discounts.ts +156 -0
  136. package/src/contracts/haneulns_discounts/free_claims.ts +161 -0
  137. package/src/contracts/haneulns_discounts/house.ts +47 -0
  138. package/src/contracts/haneulns_payments/deps/haneul/vec_map.ts +33 -0
  139. package/src/contracts/haneulns_payments/deps/std/type_name.ts +24 -0
  140. package/src/contracts/haneulns_payments/payments.ts +257 -0
  141. package/src/contracts/haneulns_temp_subdomain_proxy/subdomain_proxy.ts +343 -0
  142. package/src/contracts/pyth/data_source.ts +15 -0
  143. package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.ts +15 -0
  144. package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.ts +13 -0
  145. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.ts +12 -0
  146. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.ts +13 -0
  147. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.ts +13 -0
  148. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.ts +12 -0
  149. package/src/contracts/pyth/state.ts +22 -0
  150. package/src/contracts/utils/index.ts +234 -0
  151. package/src/contracts/wormhole/bytes32.ts +12 -0
  152. package/src/contracts/wormhole/consumed_vaas.ts +13 -0
  153. package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.ts +12 -0
  154. package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.ts +15 -0
  155. package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.ts +13 -0
  156. package/src/contracts/wormhole/external_address.ts +13 -0
  157. package/src/contracts/wormhole/fee_collector.ts +15 -0
  158. package/src/contracts/wormhole/set.ts +12 -0
  159. package/src/contracts/wormhole/state.ts +25 -0
  160. package/src/haneulns-client.ts +120 -165
  161. package/src/haneulns-transaction.ts +137 -111
  162. package/src/index.ts +2 -2
  163. package/src/pyth/pyth.ts +55 -71
  164. package/src/types.ts +5 -7
  165. package/dist/cjs/constants.d.ts +0 -11
  166. package/dist/cjs/constants.js +0 -120
  167. package/dist/cjs/constants.js.map +0 -7
  168. package/dist/cjs/haneulns-client.d.ts +0 -40
  169. package/dist/cjs/haneulns-client.js +0 -261
  170. package/dist/cjs/haneulns-client.js.map +0 -7
  171. package/dist/cjs/haneulns-transaction.d.ts +0 -105
  172. package/dist/cjs/haneulns-transaction.js +0 -465
  173. package/dist/cjs/haneulns-transaction.js.map +0 -7
  174. package/dist/cjs/helpers.d.ts +0 -18
  175. package/dist/cjs/helpers.js +0 -63
  176. package/dist/cjs/helpers.js.map +0 -7
  177. package/dist/cjs/index.d.ts +0 -5
  178. package/dist/cjs/index.js +0 -39
  179. package/dist/cjs/index.js.map +0 -7
  180. package/dist/cjs/package.json +0 -5
  181. package/dist/cjs/pyth/PriceServiceConnection.d.ts +0 -26
  182. package/dist/cjs/pyth/PriceServiceConnection.js +0 -68
  183. package/dist/cjs/pyth/PriceServiceConnection.js.map +0 -7
  184. package/dist/cjs/pyth/pyth-helpers.d.ts +0 -7
  185. package/dist/cjs/pyth/pyth-helpers.js +0 -36
  186. package/dist/cjs/pyth/pyth-helpers.js.map +0 -7
  187. package/dist/cjs/pyth/pyth.d.ts +0 -66
  188. package/dist/cjs/pyth/pyth.js +0 -270
  189. package/dist/cjs/pyth/pyth.js.map +0 -7
  190. package/dist/cjs/types.d.ts +0 -89
  191. package/dist/cjs/types.js +0 -17
  192. package/dist/cjs/types.js.map +0 -7
  193. package/dist/esm/constants.d.ts +0 -11
  194. package/dist/esm/constants.js +0 -100
  195. package/dist/esm/constants.js.map +0 -7
  196. package/dist/esm/haneulns-client.d.ts +0 -40
  197. package/dist/esm/haneulns-client.js +0 -249
  198. package/dist/esm/haneulns-client.js.map +0 -7
  199. package/dist/esm/haneulns-transaction.d.ts +0 -105
  200. package/dist/esm/haneulns-transaction.js +0 -445
  201. package/dist/esm/haneulns-transaction.js.map +0 -7
  202. package/dist/esm/helpers.d.ts +0 -18
  203. package/dist/esm/helpers.js +0 -43
  204. package/dist/esm/helpers.js.map +0 -7
  205. package/dist/esm/index.d.ts +0 -5
  206. package/dist/esm/index.js +0 -28
  207. package/dist/esm/index.js.map +0 -7
  208. package/dist/esm/package.json +0 -5
  209. package/dist/esm/pyth/PriceServiceConnection.d.ts +0 -26
  210. package/dist/esm/pyth/PriceServiceConnection.js +0 -38
  211. package/dist/esm/pyth/PriceServiceConnection.js.map +0 -7
  212. package/dist/esm/pyth/pyth-helpers.d.ts +0 -7
  213. package/dist/esm/pyth/pyth-helpers.js +0 -16
  214. package/dist/esm/pyth/pyth-helpers.js.map +0 -7
  215. package/dist/esm/pyth/pyth.d.ts +0 -66
  216. package/dist/esm/pyth/pyth.js +0 -250
  217. package/dist/esm/pyth/pyth.js.map +0 -7
  218. package/dist/esm/types.d.ts +0 -89
  219. package/dist/esm/types.js +0 -1
  220. package/dist/esm/types.js.map +0 -7
  221. package/dist/tsconfig.esm.tsbuildinfo +0 -1
  222. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,456 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * The main module of the HaneulNS application, defines the `HaneulNS` object and the
7
+ * authorization mechanism for interacting with the main data storage.
8
+ *
9
+ * Authorization mechanic: The Admin can authorize applications to access protected
10
+ * features of the HaneulNS, they're named with a prefix `app_*`. Once authorized,
11
+ * application can get mutable access to the `Registry` and add to the application
12
+ * `Balance`.
13
+ *
14
+ * At any moment any of the applications can be deathorized by the Admin making it
15
+ * impossible for the deauthorized module to access the registry.
16
+ *
17
+ * ---
18
+ *
19
+ * Package Upgrades in mind:
20
+ *
21
+ * - None of the public functions of the HaneulNS feature any specific types - instead
22
+ * we use generics to define the actual types in arbitrary modules.
23
+ * - The `Registry` itself (the main feature of the application) is stored as a
24
+ * dynamic field so that we can change the type and the module that serves the
25
+ * registry without breaking the HaneulNS compatibility.
26
+ * - Any of the old modules can be deauthorized hence disabling its access to the
27
+ * registry and the balance.
28
+ */
29
+
30
+ import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
31
+ import { bcs, type BcsType } from '@haneullabs/haneul/bcs';
32
+ import { type Transaction } from '@haneullabs/haneul/transactions';
33
+ import * as balance from './deps/haneul/balance.js';
34
+ const $moduleName = '@haneulns/core::haneulns';
35
+ export const AdminCap = new MoveStruct({
36
+ name: `${$moduleName}::AdminCap`,
37
+ fields: {
38
+ id: bcs.Address,
39
+ },
40
+ });
41
+ export const HaneulNS = new MoveStruct({
42
+ name: `${$moduleName}::HaneulNS`,
43
+ fields: {
44
+ id: bcs.Address,
45
+ /**
46
+ * The total balance of the HaneulNS. Can be added to by authorized apps. Can be
47
+ * withdrawn only by the application Admin.
48
+ */
49
+ balance: balance.Balance,
50
+ },
51
+ });
52
+ export const HANEULNS = new MoveStruct({
53
+ name: `${$moduleName}::HANEULNS`,
54
+ fields: {
55
+ dummy_field: bcs.bool(),
56
+ },
57
+ });
58
+ export const ConfigKey = new MoveStruct({
59
+ name: `${$moduleName}::ConfigKey<phantom Config>`,
60
+ fields: {
61
+ dummy_field: bcs.bool(),
62
+ },
63
+ });
64
+ export const RegistryKey = new MoveStruct({
65
+ name: `${$moduleName}::RegistryKey<phantom Config>`,
66
+ fields: {
67
+ dummy_field: bcs.bool(),
68
+ },
69
+ });
70
+ export const BalanceKey = new MoveStruct({
71
+ name: `${$moduleName}::BalanceKey<phantom T>`,
72
+ fields: {
73
+ dummy_field: bcs.bool(),
74
+ },
75
+ });
76
+ export const AppKey = new MoveStruct({
77
+ name: `${$moduleName}::AppKey<phantom App>`,
78
+ fields: {
79
+ dummy_field: bcs.bool(),
80
+ },
81
+ });
82
+ export interface WithdrawArguments {
83
+ _: RawTransactionArgument<string>;
84
+ self: RawTransactionArgument<string>;
85
+ }
86
+ export interface WithdrawOptions {
87
+ package?: string;
88
+ arguments:
89
+ | WithdrawArguments
90
+ | [_: RawTransactionArgument<string>, self: RawTransactionArgument<string>];
91
+ }
92
+ /**
93
+ * Withdraw from the HaneulNS balance directly and access the Coins within the same
94
+ * transaction. This is useful for the admin to withdraw funds from the HaneulNS and
95
+ * then send them somewhere specific or keep at the address.
96
+ */
97
+ export function withdraw(options: WithdrawOptions) {
98
+ const packageAddress = options.package ?? '@haneulns/core';
99
+ const argumentsTypes = [null, null] satisfies (string | null)[];
100
+ const parameterNames = ['_', 'self'];
101
+ return (tx: Transaction) =>
102
+ tx.moveCall({
103
+ package: packageAddress,
104
+ module: 'haneulns',
105
+ function: 'withdraw',
106
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
107
+ });
108
+ }
109
+ export interface WithdrawCustomArguments {
110
+ self: RawTransactionArgument<string>;
111
+ _: RawTransactionArgument<string>;
112
+ }
113
+ export interface WithdrawCustomOptions {
114
+ package?: string;
115
+ arguments:
116
+ | WithdrawCustomArguments
117
+ | [self: RawTransactionArgument<string>, _: RawTransactionArgument<string>];
118
+ typeArguments: [string];
119
+ }
120
+ /** Withdraw from the HaneulNS balance of a custom coin type. */
121
+ export function withdrawCustom(options: WithdrawCustomOptions) {
122
+ const packageAddress = options.package ?? '@haneulns/core';
123
+ const argumentsTypes = [null, null] satisfies (string | null)[];
124
+ const parameterNames = ['self', '_'];
125
+ return (tx: Transaction) =>
126
+ tx.moveCall({
127
+ package: packageAddress,
128
+ module: 'haneulns',
129
+ function: 'withdraw_custom',
130
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
131
+ typeArguments: options.typeArguments,
132
+ });
133
+ }
134
+ export interface AuthorizeAppArguments {
135
+ _: RawTransactionArgument<string>;
136
+ self: RawTransactionArgument<string>;
137
+ }
138
+ export interface AuthorizeAppOptions {
139
+ package?: string;
140
+ arguments:
141
+ | AuthorizeAppArguments
142
+ | [_: RawTransactionArgument<string>, self: RawTransactionArgument<string>];
143
+ typeArguments: [string];
144
+ }
145
+ /** Authorize an application to access protected features of the HaneulNS. */
146
+ export function authorizeApp(options: AuthorizeAppOptions) {
147
+ const packageAddress = options.package ?? '@haneulns/core';
148
+ const argumentsTypes = [null, null] satisfies (string | null)[];
149
+ const parameterNames = ['_', 'self'];
150
+ return (tx: Transaction) =>
151
+ tx.moveCall({
152
+ package: packageAddress,
153
+ module: 'haneulns',
154
+ function: 'authorize_app',
155
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
156
+ typeArguments: options.typeArguments,
157
+ });
158
+ }
159
+ export interface DeauthorizeAppArguments {
160
+ _: RawTransactionArgument<string>;
161
+ self: RawTransactionArgument<string>;
162
+ }
163
+ export interface DeauthorizeAppOptions {
164
+ package?: string;
165
+ arguments:
166
+ | DeauthorizeAppArguments
167
+ | [_: RawTransactionArgument<string>, self: RawTransactionArgument<string>];
168
+ typeArguments: [string];
169
+ }
170
+ /** Deauthorize an application by removing its authorization key. */
171
+ export function deauthorizeApp(options: DeauthorizeAppOptions) {
172
+ const packageAddress = options.package ?? '@haneulns/core';
173
+ const argumentsTypes = [null, null] satisfies (string | null)[];
174
+ const parameterNames = ['_', 'self'];
175
+ return (tx: Transaction) =>
176
+ tx.moveCall({
177
+ package: packageAddress,
178
+ module: 'haneulns',
179
+ function: 'deauthorize_app',
180
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
181
+ typeArguments: options.typeArguments,
182
+ });
183
+ }
184
+ export interface IsAppAuthorizedArguments {
185
+ self: RawTransactionArgument<string>;
186
+ }
187
+ export interface IsAppAuthorizedOptions {
188
+ package?: string;
189
+ arguments: IsAppAuthorizedArguments | [self: RawTransactionArgument<string>];
190
+ typeArguments: [string];
191
+ }
192
+ /** Check if an application is authorized to access protected features of the HaneulNS. */
193
+ export function isAppAuthorized(options: IsAppAuthorizedOptions) {
194
+ const packageAddress = options.package ?? '@haneulns/core';
195
+ const argumentsTypes = [null] satisfies (string | null)[];
196
+ const parameterNames = ['self'];
197
+ return (tx: Transaction) =>
198
+ tx.moveCall({
199
+ package: packageAddress,
200
+ module: 'haneulns',
201
+ function: 'is_app_authorized',
202
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
203
+ typeArguments: options.typeArguments,
204
+ });
205
+ }
206
+ export interface AssertAppIsAuthorizedArguments {
207
+ self: RawTransactionArgument<string>;
208
+ }
209
+ export interface AssertAppIsAuthorizedOptions {
210
+ package?: string;
211
+ arguments: AssertAppIsAuthorizedArguments | [self: RawTransactionArgument<string>];
212
+ typeArguments: [string];
213
+ }
214
+ /**
215
+ * Assert that an application is authorized to access protected features of the
216
+ * HaneulNS. Aborts with `EAppNotAuthorized` if not.
217
+ */
218
+ export function assertAppIsAuthorized(options: AssertAppIsAuthorizedOptions) {
219
+ const packageAddress = options.package ?? '@haneulns/core';
220
+ const argumentsTypes = [null] satisfies (string | null)[];
221
+ const parameterNames = ['self'];
222
+ return (tx: Transaction) =>
223
+ tx.moveCall({
224
+ package: packageAddress,
225
+ module: 'haneulns',
226
+ function: 'assert_app_is_authorized',
227
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
228
+ typeArguments: options.typeArguments,
229
+ });
230
+ }
231
+ export interface AppAddBalanceArguments<App extends BcsType<any>> {
232
+ _: RawTransactionArgument<App>;
233
+ self: RawTransactionArgument<string>;
234
+ balance: RawTransactionArgument<string>;
235
+ }
236
+ export interface AppAddBalanceOptions<App extends BcsType<any>> {
237
+ package?: string;
238
+ arguments:
239
+ | AppAddBalanceArguments<App>
240
+ | [
241
+ _: RawTransactionArgument<App>,
242
+ self: RawTransactionArgument<string>,
243
+ balance: RawTransactionArgument<string>,
244
+ ];
245
+ typeArguments: [string];
246
+ }
247
+ /** Adds balance to the HaneulNS. */
248
+ export function appAddBalance<App extends BcsType<any>>(options: AppAddBalanceOptions<App>) {
249
+ const packageAddress = options.package ?? '@haneulns/core';
250
+ const argumentsTypes = [`${options.typeArguments[0]}`, null, null] satisfies (string | null)[];
251
+ const parameterNames = ['_', 'self', 'balance'];
252
+ return (tx: Transaction) =>
253
+ tx.moveCall({
254
+ package: packageAddress,
255
+ module: 'haneulns',
256
+ function: 'app_add_balance',
257
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
258
+ typeArguments: options.typeArguments,
259
+ });
260
+ }
261
+ export interface AppAddCustomBalanceArguments<App extends BcsType<any>> {
262
+ self: RawTransactionArgument<string>;
263
+ _: RawTransactionArgument<App>;
264
+ balance: RawTransactionArgument<string>;
265
+ }
266
+ export interface AppAddCustomBalanceOptions<App extends BcsType<any>> {
267
+ package?: string;
268
+ arguments:
269
+ | AppAddCustomBalanceArguments<App>
270
+ | [
271
+ self: RawTransactionArgument<string>,
272
+ _: RawTransactionArgument<App>,
273
+ balance: RawTransactionArgument<string>,
274
+ ];
275
+ typeArguments: [string, string];
276
+ }
277
+ /** Adds a balance of type `T` to the HaneulNS protocol as an authorized app. */
278
+ export function appAddCustomBalance<App extends BcsType<any>>(
279
+ options: AppAddCustomBalanceOptions<App>,
280
+ ) {
281
+ const packageAddress = options.package ?? '@haneulns/core';
282
+ const argumentsTypes = [null, `${options.typeArguments[0]}`, null] satisfies (string | null)[];
283
+ const parameterNames = ['self', '_', 'balance'];
284
+ return (tx: Transaction) =>
285
+ tx.moveCall({
286
+ package: packageAddress,
287
+ module: 'haneulns',
288
+ function: 'app_add_custom_balance',
289
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
290
+ typeArguments: options.typeArguments,
291
+ });
292
+ }
293
+ export interface AppRegistryMutArguments<App extends BcsType<any>> {
294
+ _: RawTransactionArgument<App>;
295
+ self: RawTransactionArgument<string>;
296
+ }
297
+ export interface AppRegistryMutOptions<App extends BcsType<any>> {
298
+ package?: string;
299
+ arguments:
300
+ | AppRegistryMutArguments<App>
301
+ | [_: RawTransactionArgument<App>, self: RawTransactionArgument<string>];
302
+ typeArguments: [string, string];
303
+ }
304
+ /**
305
+ * Get a mutable access to the `Registry` object. Can only be performed by
306
+ * authorized applications.
307
+ */
308
+ export function appRegistryMut<App extends BcsType<any>>(options: AppRegistryMutOptions<App>) {
309
+ const packageAddress = options.package ?? '@haneulns/core';
310
+ const argumentsTypes = [`${options.typeArguments[0]}`, null] satisfies (string | null)[];
311
+ const parameterNames = ['_', 'self'];
312
+ return (tx: Transaction) =>
313
+ tx.moveCall({
314
+ package: packageAddress,
315
+ module: 'haneulns',
316
+ function: 'app_registry_mut',
317
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
318
+ typeArguments: options.typeArguments,
319
+ });
320
+ }
321
+ export interface AddConfigArguments<Config extends BcsType<any>> {
322
+ _: RawTransactionArgument<string>;
323
+ self: RawTransactionArgument<string>;
324
+ config: RawTransactionArgument<Config>;
325
+ }
326
+ export interface AddConfigOptions<Config extends BcsType<any>> {
327
+ package?: string;
328
+ arguments:
329
+ | AddConfigArguments<Config>
330
+ | [
331
+ _: RawTransactionArgument<string>,
332
+ self: RawTransactionArgument<string>,
333
+ config: RawTransactionArgument<Config>,
334
+ ];
335
+ typeArguments: [string];
336
+ }
337
+ /** Attach dynamic configuration object to the application. */
338
+ export function addConfig<Config extends BcsType<any>>(options: AddConfigOptions<Config>) {
339
+ const packageAddress = options.package ?? '@haneulns/core';
340
+ const argumentsTypes = [null, null, `${options.typeArguments[0]}`] satisfies (string | null)[];
341
+ const parameterNames = ['_', 'self', 'config'];
342
+ return (tx: Transaction) =>
343
+ tx.moveCall({
344
+ package: packageAddress,
345
+ module: 'haneulns',
346
+ function: 'add_config',
347
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
348
+ typeArguments: options.typeArguments,
349
+ });
350
+ }
351
+ export interface GetConfigArguments {
352
+ self: RawTransactionArgument<string>;
353
+ }
354
+ export interface GetConfigOptions {
355
+ package?: string;
356
+ arguments: GetConfigArguments | [self: RawTransactionArgument<string>];
357
+ typeArguments: [string];
358
+ }
359
+ /** Borrow configuration object. Read-only mode for applications. */
360
+ export function getConfig(options: GetConfigOptions) {
361
+ const packageAddress = options.package ?? '@haneulns/core';
362
+ const argumentsTypes = [null] satisfies (string | null)[];
363
+ const parameterNames = ['self'];
364
+ return (tx: Transaction) =>
365
+ tx.moveCall({
366
+ package: packageAddress,
367
+ module: 'haneulns',
368
+ function: 'get_config',
369
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
370
+ typeArguments: options.typeArguments,
371
+ });
372
+ }
373
+ export interface RemoveConfigArguments {
374
+ _: RawTransactionArgument<string>;
375
+ self: RawTransactionArgument<string>;
376
+ }
377
+ export interface RemoveConfigOptions {
378
+ package?: string;
379
+ arguments:
380
+ | RemoveConfigArguments
381
+ | [_: RawTransactionArgument<string>, self: RawTransactionArgument<string>];
382
+ typeArguments: [string];
383
+ }
384
+ /**
385
+ * Get the configuration object for editing. The admin should put it back after
386
+ * editing (no extra check performed). Can be used to swap configuration since the
387
+ * `T` has `drop`. Eg nothing is stopping the admin from removing the configuration
388
+ * object and adding a new one.
389
+ *
390
+ * Fully taking the config also allows for edits within a transaction.
391
+ */
392
+ export function removeConfig(options: RemoveConfigOptions) {
393
+ const packageAddress = options.package ?? '@haneulns/core';
394
+ const argumentsTypes = [null, null] satisfies (string | null)[];
395
+ const parameterNames = ['_', 'self'];
396
+ return (tx: Transaction) =>
397
+ tx.moveCall({
398
+ package: packageAddress,
399
+ module: 'haneulns',
400
+ function: 'remove_config',
401
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
402
+ typeArguments: options.typeArguments,
403
+ });
404
+ }
405
+ export interface RegistryArguments {
406
+ self: RawTransactionArgument<string>;
407
+ }
408
+ export interface RegistryOptions {
409
+ package?: string;
410
+ arguments: RegistryArguments | [self: RawTransactionArgument<string>];
411
+ typeArguments: [string];
412
+ }
413
+ /** Get a read-only access to the `Registry` object. */
414
+ export function registry(options: RegistryOptions) {
415
+ const packageAddress = options.package ?? '@haneulns/core';
416
+ const argumentsTypes = [null] satisfies (string | null)[];
417
+ const parameterNames = ['self'];
418
+ return (tx: Transaction) =>
419
+ tx.moveCall({
420
+ package: packageAddress,
421
+ module: 'haneulns',
422
+ function: 'registry',
423
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
424
+ typeArguments: options.typeArguments,
425
+ });
426
+ }
427
+ export interface AddRegistryArguments<R extends BcsType<any>> {
428
+ _: RawTransactionArgument<string>;
429
+ self: RawTransactionArgument<string>;
430
+ registry: RawTransactionArgument<R>;
431
+ }
432
+ export interface AddRegistryOptions<R extends BcsType<any>> {
433
+ package?: string;
434
+ arguments:
435
+ | AddRegistryArguments<R>
436
+ | [
437
+ _: RawTransactionArgument<string>,
438
+ self: RawTransactionArgument<string>,
439
+ registry: RawTransactionArgument<R>,
440
+ ];
441
+ typeArguments: [string];
442
+ }
443
+ /** Add a registry to the HaneulNS. Can only be performed by the admin. */
444
+ export function addRegistry<R extends BcsType<any>>(options: AddRegistryOptions<R>) {
445
+ const packageAddress = options.package ?? '@haneulns/core';
446
+ const argumentsTypes = [null, null, `${options.typeArguments[0]}`] satisfies (string | null)[];
447
+ const parameterNames = ['_', 'self', 'registry'];
448
+ return (tx: Transaction) =>
449
+ tx.moveCall({
450
+ package: packageAddress,
451
+ module: 'haneulns',
452
+ function: 'add_registry',
453
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
454
+ typeArguments: options.typeArguments,
455
+ });
456
+ }
@@ -0,0 +1,200 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * Handles creation of the `HaneulnsRegistration`s. Separates the logic of creating a
7
+ * `HaneulnsRegistration`. New `HaneulnsRegistration`s can be created only by the
8
+ * `registry` and this module is tightly coupled with it.
9
+ *
10
+ * When reviewing the module, make sure that:
11
+ *
12
+ * - mutable functions can't be called directly by the owner
13
+ * - all getters are public and take an immutable reference
14
+ */
15
+
16
+ import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
17
+ import { bcs } from '@haneullabs/haneul/bcs';
18
+ import { type Transaction } from '@haneullabs/haneul/transactions';
19
+ import * as domain_1 from './domain.js';
20
+ const $moduleName = '@haneulns/core::haneulns_registration';
21
+ export const HaneulnsRegistration = new MoveStruct({
22
+ name: `${$moduleName}::HaneulnsRegistration`,
23
+ fields: {
24
+ id: bcs.Address,
25
+ /** The parsed domain. */
26
+ domain: domain_1.Domain,
27
+ /** The domain name that the NFT is for. */
28
+ domain_name: bcs.string(),
29
+ /** Timestamp in milliseconds when this NFT expires. */
30
+ expiration_timestamp_ms: bcs.u64(),
31
+ /** Short IPFS hash of the image to be displayed for the NFT. */
32
+ image_url: bcs.string(),
33
+ },
34
+ });
35
+ export interface HasExpiredArguments {
36
+ self: RawTransactionArgument<string>;
37
+ }
38
+ export interface HasExpiredOptions {
39
+ package?: string;
40
+ arguments: HasExpiredArguments | [self: RawTransactionArgument<string>];
41
+ }
42
+ /**
43
+ * Check whether the `HaneulnsRegistration` has expired by comparing the expiration
44
+ * timeout with the current time.
45
+ */
46
+ export function hasExpired(options: HasExpiredOptions) {
47
+ const packageAddress = options.package ?? '@haneulns/core';
48
+ const argumentsTypes = [null, '0x2::clock::Clock'] satisfies (string | null)[];
49
+ const parameterNames = ['self'];
50
+ return (tx: Transaction) =>
51
+ tx.moveCall({
52
+ package: packageAddress,
53
+ module: 'haneulns_registration',
54
+ function: 'has_expired',
55
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
56
+ });
57
+ }
58
+ export interface HasExpiredPastGracePeriodArguments {
59
+ self: RawTransactionArgument<string>;
60
+ }
61
+ export interface HasExpiredPastGracePeriodOptions {
62
+ package?: string;
63
+ arguments: HasExpiredPastGracePeriodArguments | [self: RawTransactionArgument<string>];
64
+ }
65
+ /**
66
+ * Check whether the `HaneulnsRegistration` has expired by comparing the expiration
67
+ * timeout with the current time. This function also takes into account the grace
68
+ * period.
69
+ */
70
+ export function hasExpiredPastGracePeriod(options: HasExpiredPastGracePeriodOptions) {
71
+ const packageAddress = options.package ?? '@haneulns/core';
72
+ const argumentsTypes = [null, '0x2::clock::Clock'] satisfies (string | null)[];
73
+ const parameterNames = ['self'];
74
+ return (tx: Transaction) =>
75
+ tx.moveCall({
76
+ package: packageAddress,
77
+ module: 'haneulns_registration',
78
+ function: 'has_expired_past_grace_period',
79
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
80
+ });
81
+ }
82
+ export interface DomainArguments {
83
+ self: RawTransactionArgument<string>;
84
+ }
85
+ export interface DomainOptions {
86
+ package?: string;
87
+ arguments: DomainArguments | [self: RawTransactionArgument<string>];
88
+ }
89
+ /** Get the `domain` field of the `HaneulnsRegistration`. */
90
+ export function domain(options: DomainOptions) {
91
+ const packageAddress = options.package ?? '@haneulns/core';
92
+ const argumentsTypes = [null] satisfies (string | null)[];
93
+ const parameterNames = ['self'];
94
+ return (tx: Transaction) =>
95
+ tx.moveCall({
96
+ package: packageAddress,
97
+ module: 'haneulns_registration',
98
+ function: 'domain',
99
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
100
+ });
101
+ }
102
+ export interface DomainNameArguments {
103
+ self: RawTransactionArgument<string>;
104
+ }
105
+ export interface DomainNameOptions {
106
+ package?: string;
107
+ arguments: DomainNameArguments | [self: RawTransactionArgument<string>];
108
+ }
109
+ /** Get the `domain_name` field of the `HaneulnsRegistration`. */
110
+ export function domainName(options: DomainNameOptions) {
111
+ const packageAddress = options.package ?? '@haneulns/core';
112
+ const argumentsTypes = [null] satisfies (string | null)[];
113
+ const parameterNames = ['self'];
114
+ return (tx: Transaction) =>
115
+ tx.moveCall({
116
+ package: packageAddress,
117
+ module: 'haneulns_registration',
118
+ function: 'domain_name',
119
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
120
+ });
121
+ }
122
+ export interface ExpirationTimestampMsArguments {
123
+ self: RawTransactionArgument<string>;
124
+ }
125
+ export interface ExpirationTimestampMsOptions {
126
+ package?: string;
127
+ arguments: ExpirationTimestampMsArguments | [self: RawTransactionArgument<string>];
128
+ }
129
+ /** Get the `expiration_timestamp_ms` field of the `HaneulnsRegistration`. */
130
+ export function expirationTimestampMs(options: ExpirationTimestampMsOptions) {
131
+ const packageAddress = options.package ?? '@haneulns/core';
132
+ const argumentsTypes = [null] satisfies (string | null)[];
133
+ const parameterNames = ['self'];
134
+ return (tx: Transaction) =>
135
+ tx.moveCall({
136
+ package: packageAddress,
137
+ module: 'haneulns_registration',
138
+ function: 'expiration_timestamp_ms',
139
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
140
+ });
141
+ }
142
+ export interface ImageUrlArguments {
143
+ self: RawTransactionArgument<string>;
144
+ }
145
+ export interface ImageUrlOptions {
146
+ package?: string;
147
+ arguments: ImageUrlArguments | [self: RawTransactionArgument<string>];
148
+ }
149
+ /** Get the `image_url` field of the `HaneulnsRegistration`. */
150
+ export function imageUrl(options: ImageUrlOptions) {
151
+ const packageAddress = options.package ?? '@haneulns/core';
152
+ const argumentsTypes = [null] satisfies (string | null)[];
153
+ const parameterNames = ['self'];
154
+ return (tx: Transaction) =>
155
+ tx.moveCall({
156
+ package: packageAddress,
157
+ module: 'haneulns_registration',
158
+ function: 'image_url',
159
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
160
+ });
161
+ }
162
+ export interface UidArguments {
163
+ self: RawTransactionArgument<string>;
164
+ }
165
+ export interface UidOptions {
166
+ package?: string;
167
+ arguments: UidArguments | [self: RawTransactionArgument<string>];
168
+ }
169
+ export function uid(options: UidOptions) {
170
+ const packageAddress = options.package ?? '@haneulns/core';
171
+ const argumentsTypes = [null] satisfies (string | null)[];
172
+ const parameterNames = ['self'];
173
+ return (tx: Transaction) =>
174
+ tx.moveCall({
175
+ package: packageAddress,
176
+ module: 'haneulns_registration',
177
+ function: 'uid',
178
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
179
+ });
180
+ }
181
+ export interface UidMutArguments {
182
+ self: RawTransactionArgument<string>;
183
+ }
184
+ export interface UidMutOptions {
185
+ package?: string;
186
+ arguments: UidMutArguments | [self: RawTransactionArgument<string>];
187
+ }
188
+ /** Get the mutable `id` field of the `HaneulnsRegistration`. */
189
+ export function uidMut(options: UidMutOptions) {
190
+ const packageAddress = options.package ?? '@haneulns/core';
191
+ const argumentsTypes = [null] satisfies (string | null)[];
192
+ const parameterNames = ['self'];
193
+ return (tx: Transaction) =>
194
+ tx.moveCall({
195
+ package: packageAddress,
196
+ module: 'haneulns_registration',
197
+ function: 'uid_mut',
198
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
199
+ });
200
+ }