@waterx/sdk 2.1.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 (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -0
  3. package/dist/src/client.d.ts +109 -0
  4. package/dist/src/client.js +197 -0
  5. package/dist/src/config.d.ts +229 -0
  6. package/dist/src/config.js +107 -0
  7. package/dist/src/constants.d.ts +64 -0
  8. package/dist/src/constants.js +71 -0
  9. package/dist/src/fetch.d.ts +144 -0
  10. package/dist/src/fetch.js +419 -0
  11. package/dist/src/generated/bucket_v2_framework/account.d.ts +107 -0
  12. package/dist/src/generated/bucket_v2_framework/account.js +129 -0
  13. package/dist/src/generated/bucket_v2_framework/deps/std/type_name.d.ts +17 -0
  14. package/dist/src/generated/bucket_v2_framework/deps/std/type_name.js +19 -0
  15. package/dist/src/generated/bucket_v2_framework/deps/sui/balance.d.ts +12 -0
  16. package/dist/src/generated/bucket_v2_framework/deps/sui/balance.js +14 -0
  17. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
  18. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.js +27 -0
  19. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
  20. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.js +19 -0
  21. package/dist/src/generated/bucket_v2_framework/double.d.ts +384 -0
  22. package/dist/src/generated/bucket_v2_framework/double.js +466 -0
  23. package/dist/src/generated/bucket_v2_framework/float.d.ts +364 -0
  24. package/dist/src/generated/bucket_v2_framework/float.js +440 -0
  25. package/dist/src/generated/bucket_v2_framework/liability.d.ts +197 -0
  26. package/dist/src/generated/bucket_v2_framework/liability.js +205 -0
  27. package/dist/src/generated/bucket_v2_framework/linked_table.d.ts +384 -0
  28. package/dist/src/generated/bucket_v2_framework/linked_table.js +382 -0
  29. package/dist/src/generated/bucket_v2_framework/sheet.d.ts +424 -0
  30. package/dist/src/generated/bucket_v2_framework/sheet.js +344 -0
  31. package/dist/src/generated/native_custody/custody_vault.d.ts +572 -0
  32. package/dist/src/generated/native_custody/custody_vault.js +483 -0
  33. package/dist/src/generated/native_custody/deps/bucket_v2_framework/float.d.ts +8 -0
  34. package/dist/src/generated/native_custody/deps/bucket_v2_framework/float.js +10 -0
  35. package/dist/src/generated/native_custody/deps/bucket_v2_framework/liability.d.ts +11 -0
  36. package/dist/src/generated/native_custody/deps/bucket_v2_framework/liability.js +13 -0
  37. package/dist/src/generated/native_custody/deps/bucket_v2_framework/sheet.d.ts +49 -0
  38. package/dist/src/generated/native_custody/deps/bucket_v2_framework/sheet.js +18 -0
  39. package/dist/src/generated/native_custody/deps/std/type_name.d.ts +17 -0
  40. package/dist/src/generated/native_custody/deps/std/type_name.js +19 -0
  41. package/dist/src/generated/native_custody/deps/sui/balance.d.ts +12 -0
  42. package/dist/src/generated/native_custody/deps/sui/balance.js +14 -0
  43. package/dist/src/generated/native_custody/deps/sui/vec_map.d.ts +36 -0
  44. package/dist/src/generated/native_custody/deps/sui/vec_map.js +27 -0
  45. package/dist/src/generated/native_custody/deps/sui/vec_set.d.ts +16 -0
  46. package/dist/src/generated/native_custody/deps/sui/vec_set.js +19 -0
  47. package/dist/src/generated/native_custody/events.d.ts +36 -0
  48. package/dist/src/generated/native_custody/events.js +36 -0
  49. package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.d.ts +12 -0
  50. package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.js +14 -0
  51. package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +68 -0
  52. package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +74 -0
  53. package/dist/src/generated/utils/index.d.ts +30 -0
  54. package/dist/src/generated/utils/index.js +157 -0
  55. package/dist/src/generated/waterx_account/account.d.ts +1818 -0
  56. package/dist/src/generated/waterx_account/account.js +1723 -0
  57. package/dist/src/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +11 -0
  58. package/dist/src/generated/waterx_account/deps/bucket_v2_framework/liability.js +13 -0
  59. package/dist/src/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +49 -0
  60. package/dist/src/generated/waterx_account/deps/bucket_v2_framework/sheet.js +18 -0
  61. package/dist/src/generated/waterx_account/deps/std/type_name.d.ts +17 -0
  62. package/dist/src/generated/waterx_account/deps/std/type_name.js +19 -0
  63. package/dist/src/generated/waterx_account/deps/sui/balance.d.ts +12 -0
  64. package/dist/src/generated/waterx_account/deps/sui/balance.js +14 -0
  65. package/dist/src/generated/waterx_account/deps/sui/object_table.d.ts +17 -0
  66. package/dist/src/generated/waterx_account/deps/sui/object_table.js +19 -0
  67. package/dist/src/generated/waterx_account/deps/sui/table.d.ts +29 -0
  68. package/dist/src/generated/waterx_account/deps/sui/table.js +31 -0
  69. package/dist/src/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
  70. package/dist/src/generated/waterx_account/deps/sui/vec_map.js +27 -0
  71. package/dist/src/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
  72. package/dist/src/generated/waterx_account/deps/sui/vec_set.js +19 -0
  73. package/dist/src/generated/waterx_account/direct_rule.d.ts +77 -0
  74. package/dist/src/generated/waterx_account/direct_rule.js +78 -0
  75. package/dist/src/generated/waterx_account/events.d.ts +180 -0
  76. package/dist/src/generated/waterx_account/events.js +156 -0
  77. package/dist/src/generated/waterx_account/version.d.ts +10 -0
  78. package/dist/src/generated/waterx_account/version.js +8 -0
  79. package/dist/src/generated/waterx_credit/credit_registry.d.ts +708 -0
  80. package/dist/src/generated/waterx_credit/credit_registry.js +658 -0
  81. package/dist/src/generated/waterx_credit/deps/std/type_name.d.ts +17 -0
  82. package/dist/src/generated/waterx_credit/deps/std/type_name.js +19 -0
  83. package/dist/src/generated/waterx_credit/deps/sui/table.d.ts +29 -0
  84. package/dist/src/generated/waterx_credit/deps/sui/table.js +31 -0
  85. package/dist/src/generated/waterx_credit/deps/sui/vec_map.d.ts +36 -0
  86. package/dist/src/generated/waterx_credit/deps/sui/vec_map.js +27 -0
  87. package/dist/src/generated/waterx_credit/deps/sui/vec_set.d.ts +16 -0
  88. package/dist/src/generated/waterx_credit/deps/sui/vec_set.js +19 -0
  89. package/dist/src/generated/waterx_credit/limited_supply.d.ts +107 -0
  90. package/dist/src/generated/waterx_credit/limited_supply.js +131 -0
  91. package/dist/src/generated/waterx_oracle/aggregator.d.ts +211 -0
  92. package/dist/src/generated/waterx_oracle/aggregator.js +213 -0
  93. package/dist/src/generated/waterx_oracle/collector.d.ts +119 -0
  94. package/dist/src/generated/waterx_oracle/collector.js +105 -0
  95. package/dist/src/generated/waterx_oracle/deps/bucket_v2_framework/float.d.ts +8 -0
  96. package/dist/src/generated/waterx_oracle/deps/bucket_v2_framework/float.js +10 -0
  97. package/dist/src/generated/waterx_oracle/deps/std/type_name.d.ts +17 -0
  98. package/dist/src/generated/waterx_oracle/deps/std/type_name.js +19 -0
  99. package/dist/src/generated/waterx_oracle/deps/sui/vec_map.d.ts +36 -0
  100. package/dist/src/generated/waterx_oracle/deps/sui/vec_map.js +27 -0
  101. package/dist/src/generated/waterx_oracle/deps/sui/vec_set.d.ts +16 -0
  102. package/dist/src/generated/waterx_oracle/deps/sui/vec_set.js +19 -0
  103. package/dist/src/generated/waterx_oracle/oracle.d.ts +298 -0
  104. package/dist/src/generated/waterx_oracle/oracle.js +323 -0
  105. package/dist/src/generated/waterx_oracle/version.d.ts +10 -0
  106. package/dist/src/generated/waterx_oracle/version.js +8 -0
  107. package/dist/src/generated/waterx_perp/account_data.d.ts +269 -0
  108. package/dist/src/generated/waterx_perp/account_data.js +284 -0
  109. package/dist/src/generated/waterx_perp/admin.d.ts +19 -0
  110. package/dist/src/generated/waterx_perp/admin.js +22 -0
  111. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/double.d.ts +8 -0
  112. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/double.js +10 -0
  113. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/float.d.ts +8 -0
  114. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/float.js +10 -0
  115. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/liability.d.ts +11 -0
  116. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/liability.js +13 -0
  117. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.d.ts +8 -0
  118. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.js +18 -0
  119. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.d.ts +49 -0
  120. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.js +18 -0
  121. package/dist/src/generated/waterx_perp/deps/std/type_name.d.ts +17 -0
  122. package/dist/src/generated/waterx_perp/deps/std/type_name.js +19 -0
  123. package/dist/src/generated/waterx_perp/deps/sui/balance.d.ts +15 -0
  124. package/dist/src/generated/waterx_perp/deps/sui/balance.js +17 -0
  125. package/dist/src/generated/waterx_perp/deps/sui/coin.d.ts +14 -0
  126. package/dist/src/generated/waterx_perp/deps/sui/coin.js +15 -0
  127. package/dist/src/generated/waterx_perp/deps/sui/vec_map.d.ts +36 -0
  128. package/dist/src/generated/waterx_perp/deps/sui/vec_map.js +27 -0
  129. package/dist/src/generated/waterx_perp/deps/sui/vec_set.d.ts +16 -0
  130. package/dist/src/generated/waterx_perp/deps/sui/vec_set.js +19 -0
  131. package/dist/src/generated/waterx_perp/events.d.ts +1283 -0
  132. package/dist/src/generated/waterx_perp/events.js +1018 -0
  133. package/dist/src/generated/waterx_perp/global_config.d.ts +775 -0
  134. package/dist/src/generated/waterx_perp/global_config.js +836 -0
  135. package/dist/src/generated/waterx_perp/keyed_big_vector.d.ts +553 -0
  136. package/dist/src/generated/waterx_perp/keyed_big_vector.js +554 -0
  137. package/dist/src/generated/waterx_perp/lp_pool.d.ts +1648 -0
  138. package/dist/src/generated/waterx_perp/lp_pool.js +1521 -0
  139. package/dist/src/generated/waterx_perp/market_config.d.ts +715 -0
  140. package/dist/src/generated/waterx_perp/market_config.js +780 -0
  141. package/dist/src/generated/waterx_perp/math.d.ts +63 -0
  142. package/dist/src/generated/waterx_perp/math.js +64 -0
  143. package/dist/src/generated/waterx_perp/memo.d.ts +251 -0
  144. package/dist/src/generated/waterx_perp/memo.js +323 -0
  145. package/dist/src/generated/waterx_perp/order_book.d.ts +290 -0
  146. package/dist/src/generated/waterx_perp/order_book.js +329 -0
  147. package/dist/src/generated/waterx_perp/position.d.ts +1005 -0
  148. package/dist/src/generated/waterx_perp/position.js +1103 -0
  149. package/dist/src/generated/waterx_perp/request.d.ts +544 -0
  150. package/dist/src/generated/waterx_perp/request.js +541 -0
  151. package/dist/src/generated/waterx_perp/response.d.ts +247 -0
  152. package/dist/src/generated/waterx_perp/response.js +280 -0
  153. package/dist/src/generated/waterx_perp/trading.d.ts +2821 -0
  154. package/dist/src/generated/waterx_perp/trading.js +2372 -0
  155. package/dist/src/generated/waterx_perp/version.d.ts +10 -0
  156. package/dist/src/generated/waterx_perp/version.js +8 -0
  157. package/dist/src/generated/waterx_perp/witness.d.ts +18 -0
  158. package/dist/src/generated/waterx_perp/witness.js +21 -0
  159. package/dist/src/generated/waterx_perp_view/deps/std/type_name.d.ts +17 -0
  160. package/dist/src/generated/waterx_perp_view/deps/std/type_name.js +19 -0
  161. package/dist/src/generated/waterx_perp_view/view.d.ts +447 -0
  162. package/dist/src/generated/waterx_perp_view/view.js +414 -0
  163. package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.d.ts +36 -0
  164. package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.js +27 -0
  165. package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +90 -0
  166. package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +72 -0
  167. package/dist/src/generated/waterx_referral/deps/sui/table.d.ts +29 -0
  168. package/dist/src/generated/waterx_referral/deps/sui/table.js +31 -0
  169. package/dist/src/generated/waterx_referral/deps/sui/vec_set.d.ts +16 -0
  170. package/dist/src/generated/waterx_referral/deps/sui/vec_set.js +19 -0
  171. package/dist/src/generated/waterx_referral/referral_table.d.ts +171 -0
  172. package/dist/src/generated/waterx_referral/referral_table.js +192 -0
  173. package/dist/src/generated/waterx_staking/deps/bucket_v2_framework/double.d.ts +8 -0
  174. package/dist/src/generated/waterx_staking/deps/bucket_v2_framework/double.js +10 -0
  175. package/dist/src/generated/waterx_staking/deps/sui/balance.d.ts +12 -0
  176. package/dist/src/generated/waterx_staking/deps/sui/balance.js +14 -0
  177. package/dist/src/generated/waterx_staking/deps/sui/table.d.ts +29 -0
  178. package/dist/src/generated/waterx_staking/deps/sui/table.js +31 -0
  179. package/dist/src/generated/waterx_staking/deps/sui/vec_set.d.ts +16 -0
  180. package/dist/src/generated/waterx_staking/deps/sui/vec_set.js +19 -0
  181. package/dist/src/generated/waterx_staking/waterx_staking.d.ts +746 -0
  182. package/dist/src/generated/waterx_staking/waterx_staking.js +731 -0
  183. package/dist/src/generated/waterx_staking/witness.d.ts +16 -0
  184. package/dist/src/generated/waterx_staking/witness.js +18 -0
  185. package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.d.ts +8 -0
  186. package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.js +18 -0
  187. package/dist/src/generated/withdrawal_queue/deps/std/type_name.d.ts +17 -0
  188. package/dist/src/generated/withdrawal_queue/deps/std/type_name.js +19 -0
  189. package/dist/src/generated/withdrawal_queue/deps/sui/balance.d.ts +12 -0
  190. package/dist/src/generated/withdrawal_queue/deps/sui/balance.js +14 -0
  191. package/dist/src/generated/withdrawal_queue/deps/sui/vec_set.d.ts +16 -0
  192. package/dist/src/generated/withdrawal_queue/deps/sui/vec_set.js +19 -0
  193. package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +483 -0
  194. package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +480 -0
  195. package/dist/src/generated/wlp/wlp.d.ts +28 -0
  196. package/dist/src/generated/wlp/wlp.js +32 -0
  197. package/dist/src/generated/wormhole_bridge/deps/sui/table.d.ts +29 -0
  198. package/dist/src/generated/wormhole_bridge/deps/sui/table.js +31 -0
  199. package/dist/src/generated/wormhole_bridge/deps/sui/vec_map.d.ts +36 -0
  200. package/dist/src/generated/wormhole_bridge/deps/sui/vec_map.js +27 -0
  201. package/dist/src/generated/wormhole_bridge/deps/sui/vec_set.d.ts +16 -0
  202. package/dist/src/generated/wormhole_bridge/deps/sui/vec_set.js +19 -0
  203. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.d.ts +12 -0
  204. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.js +9 -0
  205. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.d.ts +14 -0
  206. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.js +16 -0
  207. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/set.d.ts +16 -0
  208. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/set.js +15 -0
  209. package/dist/src/generated/wormhole_bridge/events.d.ts +32 -0
  210. package/dist/src/generated/wormhole_bridge/events.js +28 -0
  211. package/dist/src/generated/wormhole_bridge/wormhole_bridge.d.ts +498 -0
  212. package/dist/src/generated/wormhole_bridge/wormhole_bridge.js +494 -0
  213. package/dist/src/index.d.ts +28 -0
  214. package/dist/src/index.js +34 -0
  215. package/dist/src/tx-builders.d.ts +242 -0
  216. package/dist/src/tx-builders.js +320 -0
  217. package/dist/src/user/account.d.ts +129 -0
  218. package/dist/src/user/account.js +166 -0
  219. package/dist/src/user/credit.d.ts +135 -0
  220. package/dist/src/user/credit.js +255 -0
  221. package/dist/src/user/custody.d.ts +71 -0
  222. package/dist/src/user/custody.js +112 -0
  223. package/dist/src/user/index.d.ts +8 -0
  224. package/dist/src/user/index.js +8 -0
  225. package/dist/src/user/order.d.ts +89 -0
  226. package/dist/src/user/order.js +134 -0
  227. package/dist/src/user/referral.d.ts +21 -0
  228. package/dist/src/user/referral.js +41 -0
  229. package/dist/src/user/staking.d.ts +54 -0
  230. package/dist/src/user/staking.js +109 -0
  231. package/dist/src/user/trading.d.ts +119 -0
  232. package/dist/src/user/trading.js +262 -0
  233. package/dist/src/user/wlp.d.ts +58 -0
  234. package/dist/src/user/wlp.js +99 -0
  235. package/dist/src/utils/account-request.d.ts +9 -0
  236. package/dist/src/utils/account-request.js +17 -0
  237. package/dist/src/utils/config.d.ts +11 -0
  238. package/dist/src/utils/config.js +15 -0
  239. package/dist/src/utils/math.d.ts +201 -0
  240. package/dist/src/utils/math.js +343 -0
  241. package/dist/src/utils/pyth.d.ts +89 -0
  242. package/dist/src/utils/pyth.js +316 -0
  243. package/dist/src/utils/wormhole.d.ts +86 -0
  244. package/dist/src/utils/wormhole.js +154 -0
  245. package/package.json +66 -0
@@ -0,0 +1,1723 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * Generalized multi-account framework for the WaterX ecosystem.
6
+ *
7
+ * Pure custody layer. Accounts hold per-T `Balance<T>` as dynamic fields keyed by
8
+ * `BalanceKey<T>()`, with a `VecMap<TypeName, u64>` mirror on each `Account` for
9
+ * fast enumeration. External flow in/out is mediated by hot-potato
10
+ * `DepositRequest<T>` / `WithdrawRequest<T>` that the framework issues; a
11
+ * registered policy module destroys the potato with its own witness and decides
12
+ * what final asset to put back into the account (e.g. a PSM policy turns
13
+ * `Coin<USDC>` into `Balance<USD>` and credits the account via `put<USD, P>`).
14
+ *
15
+ * Internal protocol ↔ account flow stays witness-gated via `take<T, P>` /
16
+ * `put<T, P>` with no policy registration involved — the protocol module's witness
17
+ * is the only authority needed, since only that module can construct a value of
18
+ * its witness type.
19
+ *
20
+ * Types of T:
21
+ *
22
+ * - Has registered deposit policy → `request_deposit<T>` works.
23
+ * - Has registered withdraw policy → `request_withdraw<T>` works.
24
+ * - Neither → "Parkable". Coins can sit on the account address via
25
+ * `transfer_coin<T>` or external `transfer::public_transfer`, but nothing the
26
+ * framework does will fold them into the account until a policy is registered
27
+ * (or owner drains via `receive_coin`).
28
+ */
29
+ import { MoveStruct, MoveTuple, normalizeMoveArguments } from "../utils/index.js";
30
+ import { bcs } from '@mysten/sui/bcs';
31
+ import * as object_table from "./deps/sui/object_table.js";
32
+ import * as table from "./deps/sui/table.js";
33
+ import * as vec_map from "./deps/sui/vec_map.js";
34
+ import * as type_name from "./deps/std/type_name.js";
35
+ import * as vec_set from "./deps/sui/vec_set.js";
36
+ import * as type_name_1 from "./deps/std/type_name.js";
37
+ import * as vec_map_1 from "./deps/sui/vec_map.js";
38
+ import * as type_name_2 from "./deps/std/type_name.js";
39
+ import * as vec_set_1 from "./deps/sui/vec_set.js";
40
+ import * as type_name_3 from "./deps/std/type_name.js";
41
+ import * as vec_map_2 from "./deps/sui/vec_map.js";
42
+ import * as type_name_4 from "./deps/std/type_name.js";
43
+ import * as vec_set_2 from "./deps/sui/vec_set.js";
44
+ import * as type_name_5 from "./deps/std/type_name.js";
45
+ import * as vec_map_3 from "./deps/sui/vec_map.js";
46
+ import * as type_name_6 from "./deps/std/type_name.js";
47
+ import * as vec_set_3 from "./deps/sui/vec_set.js";
48
+ import * as vec_set_4 from "./deps/sui/vec_set.js";
49
+ import * as balance_1 from "./deps/sui/balance.js";
50
+ import * as sheet from "./deps/bucket_v2_framework/sheet.js";
51
+ import * as vec_map_4 from "./deps/sui/vec_map.js";
52
+ import * as type_name_7 from "./deps/std/type_name.js";
53
+ import * as vec_map_5 from "./deps/sui/vec_map.js";
54
+ import * as type_name_8 from "./deps/std/type_name.js";
55
+ import * as balance_2 from "./deps/sui/balance.js";
56
+ import * as balance_3 from "./deps/sui/balance.js";
57
+ const $moduleName = '@waterx/account::account';
58
+ export const ACCOUNT = new MoveStruct({ name: `${$moduleName}::ACCOUNT`, fields: {
59
+ dummy_field: bcs.bool()
60
+ } });
61
+ export const AdminCap = new MoveStruct({ name: `${$moduleName}::AdminCap`, fields: {
62
+ id: bcs.Address
63
+ } });
64
+ export const WaterXAccount = new MoveStruct({ name: `${$moduleName}::WaterXAccount`, fields: {
65
+ dummy_field: bcs.bool()
66
+ } });
67
+ export const AccountRegistry = new MoveStruct({ name: `${$moduleName}::AccountRegistry`, fields: {
68
+ id: bcs.Address,
69
+ /**
70
+ * `ObjectTable` (not plain `Table`) so each `Account` retains a distinct on-chain
71
+ * address that off-chain callers can query directly via `getObject(account_id)`
72
+ * instead of walking dynamic-field handles on the registry UID.
73
+ */
74
+ accounts: object_table.ObjectTable,
75
+ owner_index: table.Table,
76
+ /**
77
+ * Admin-managed whitelist of protocol witness types allowed to move funds
78
+ * (`take<T, P>` / `put<T, P>`) and mutate per-account protocol data
79
+ * (`new_data<P, D>` / `borrow_data_mut<P, D>` / `remove_data<P, D>`). For each
80
+ * whitelisted `P`, the value is the set of asset types `T` that protocol is
81
+ * allowed to draw via `take<T, P>` — admin opts each pair in via two phases:
82
+ * `whitelist_protocol<P>(registry, &AdminCap)` registers `P` with an empty asset
83
+ * set, then `allow_protocol_asset<P, T>(registry, &AdminCap)` adds each T.
84
+ *
85
+ * Gates:
86
+ *
87
+ * - `take<T, P>` requires both `P` whitelisted AND `T` in `protocol_whitelist[P]`
88
+ * (plus per-account auth on the caller).
89
+ * - `put<T, P>` requires only `P` whitelisted. The T-gate stays open even after
90
+ * `disallow_protocol_asset<P, T>`, so existing positions can always close.
91
+ * - `new_data<P, _>` / `borrow_data_mut<P, _>` / `remove_data<P, _>` require only
92
+ * `P` whitelisted.
93
+ */
94
+ protocol_whitelist: vec_map.VecMap(type_name.TypeName, vec_set.VecSet(type_name_1.TypeName)),
95
+ /**
96
+ * `T → registered DepositPolicy witness TypeName`. Presence means
97
+ * `request_deposit<T>` / `request_deposit_from_receivings<T>` are permitted; only
98
+ * the module that defines the registered witness type can call
99
+ * `consume_deposit<T, P>` to unwrap the resulting `DepositRequest<T>`. Deposit
100
+ * policy registration is independent of `protocol_whitelist` — a policy can be the
101
+ * _consumer_ of a request without being allowed to `take`/`put`.
102
+ * `T → set of DepositPolicy witness TypeNames`. Multiple policies can be
103
+ * registered per T to support extension (a new policy added alongside the old) and
104
+ * migration (both coexist while consumers switch). `request_deposit<T>` requires
105
+ * the set to be non-empty; `consume_deposit<T, P>` requires P to be in the set.
106
+ */
107
+ deposit_policies: vec_map_1.VecMap(type_name_2.TypeName, vec_set_1.VecSet(type_name_3.TypeName)),
108
+ /**
109
+ * `T → set of WithdrawPolicy witness TypeNames`. Symmetric to `deposit_policies`
110
+ * for `request_withdraw<T>` / `consume_withdraw`.
111
+ */
112
+ withdraw_policies: vec_map_2.VecMap(type_name_4.TypeName, vec_set_2.VecSet(type_name_5.TypeName)),
113
+ /**
114
+ * Per-T aggregate of `Balance<T>` currently held inside accounts. Incremented in
115
+ * `put<T, P>`, decremented in `take<T, P>` and `request_withdraw<T>`. Does _not_
116
+ * include balance held by protocols (after `take`) or sitting in flight inside a
117
+ * `DepositRequest` / `WithdrawRequest` hot potato.
118
+ */
119
+ balances: vec_map_3.VecMap(type_name_6.TypeName, bcs.u64()),
120
+ allowed_versions: vec_set_3.VecSet(bcs.u16()),
121
+ managers: vec_set_4.VecSet(bcs.Address),
122
+ paused: bcs.bool()
123
+ } });
124
+ export const VaultKey = new MoveTuple({ name: `${$moduleName}::VaultKey<phantom T>`, fields: [bcs.bool()] });
125
+ export const Vault = new MoveStruct({ name: `${$moduleName}::Vault<phantom T>`, fields: {
126
+ balance: balance_1.Balance,
127
+ sheet: sheet.Sheet
128
+ } });
129
+ export const ProtocolDataKey = new MoveTuple({ name: `${$moduleName}::ProtocolDataKey<phantom PROTOCOL>`, fields: [bcs.bool()] });
130
+ export const Delegate = new MoveStruct({ name: `${$moduleName}::Delegate`, fields: {
131
+ delegate_address: bcs.Address,
132
+ alias: bcs.string(),
133
+ /** Framework-level action bitmap (PERM_WITHDRAW etc). */
134
+ permissions: bcs.u32(),
135
+ /**
136
+ * Per-protocol bitmap. Missing key → delegate cannot drive that protocol. Each
137
+ * protocol's module interprets its own bits. Owner always has `PERM_ALL` per
138
+ * protocol regardless of this field.
139
+ */
140
+ protocol_permissions: vec_map_4.VecMap(type_name_7.TypeName, bcs.u32()),
141
+ expires_at_ms: bcs.option(bcs.u64())
142
+ } });
143
+ export const Account = new MoveStruct({ name: `${$moduleName}::Account`, fields: {
144
+ id: bcs.Address,
145
+ owner_address: bcs.Address,
146
+ alias: bcs.string(),
147
+ delegates: bcs.vector(Delegate),
148
+ /**
149
+ * Mirror of the per-T `Balance<T>` values stored as dynamic fields under
150
+ * `BalanceKey<T>()` on this UID. Always equals the matching stored balance's
151
+ * `value()`.
152
+ */
153
+ balances: vec_map_5.VecMap(type_name_8.TypeName, bcs.u64())
154
+ } });
155
+ export const DepositRequest = new MoveStruct({ name: `${$moduleName}::DepositRequest<phantom T>`, fields: {
156
+ account_id: bcs.Address,
157
+ balance: balance_2.Balance,
158
+ extra_data: bcs.vector(bcs.u8())
159
+ } });
160
+ export const WithdrawRequest = new MoveStruct({ name: `${$moduleName}::WithdrawRequest<phantom T>`, fields: {
161
+ account_id: bcs.Address,
162
+ balance: balance_3.Balance,
163
+ recipient: bcs.Address,
164
+ extra_data: bcs.vector(bcs.u8())
165
+ } });
166
+ export const AccountKey = new MoveStruct({ name: `${$moduleName}::AccountKey`, fields: {
167
+ owner: bcs.Address,
168
+ index: bcs.u64()
169
+ } });
170
+ export function permNone(options = {}) {
171
+ const packageAddress = options.package ?? '@waterx/account';
172
+ return (tx) => tx.moveCall({
173
+ package: packageAddress,
174
+ module: 'account',
175
+ function: 'perm_none',
176
+ });
177
+ }
178
+ export function permWithdraw(options = {}) {
179
+ const packageAddress = options.package ?? '@waterx/account';
180
+ return (tx) => tx.moveCall({
181
+ package: packageAddress,
182
+ module: 'account',
183
+ function: 'perm_withdraw',
184
+ });
185
+ }
186
+ export function permManageDelegates(options = {}) {
187
+ const packageAddress = options.package ?? '@waterx/account';
188
+ return (tx) => tx.moveCall({
189
+ package: packageAddress,
190
+ module: 'account',
191
+ function: 'perm_manage_delegates',
192
+ });
193
+ }
194
+ export function permReceive(options = {}) {
195
+ const packageAddress = options.package ?? '@waterx/account';
196
+ return (tx) => tx.moveCall({
197
+ package: packageAddress,
198
+ module: 'account',
199
+ function: 'perm_receive',
200
+ });
201
+ }
202
+ export function permAll(options = {}) {
203
+ const packageAddress = options.package ?? '@waterx/account';
204
+ return (tx) => tx.moveCall({
205
+ package: packageAddress,
206
+ module: 'account',
207
+ function: 'perm_all',
208
+ });
209
+ }
210
+ export function aliasMaxLength(options = {}) {
211
+ const packageAddress = options.package ?? '@waterx/account';
212
+ return (tx) => tx.moveCall({
213
+ package: packageAddress,
214
+ module: 'account',
215
+ function: 'alias_max_length',
216
+ });
217
+ }
218
+ export function maxAccountsPerOwner(options = {}) {
219
+ const packageAddress = options.package ?? '@waterx/account';
220
+ return (tx) => tx.moveCall({
221
+ package: packageAddress,
222
+ module: 'account',
223
+ function: 'max_accounts_per_owner',
224
+ });
225
+ }
226
+ export function maxDelegatesPerAccount(options = {}) {
227
+ const packageAddress = options.package ?? '@waterx/account';
228
+ return (tx) => tx.moveCall({
229
+ package: packageAddress,
230
+ module: 'account',
231
+ function: 'max_delegates_per_account',
232
+ });
233
+ }
234
+ export function maxProtocolPermsPerDelegate(options = {}) {
235
+ const packageAddress = options.package ?? '@waterx/account';
236
+ return (tx) => tx.moveCall({
237
+ package: packageAddress,
238
+ module: 'account',
239
+ function: 'max_protocol_perms_per_delegate',
240
+ });
241
+ }
242
+ export function assertVersion(options) {
243
+ const packageAddress = options.package ?? '@waterx/account';
244
+ const argumentsTypes = [
245
+ null
246
+ ];
247
+ const parameterNames = ["registry"];
248
+ return (tx) => tx.moveCall({
249
+ package: packageAddress,
250
+ module: 'account',
251
+ function: 'assert_version',
252
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
253
+ });
254
+ }
255
+ export function isVersionAllowed(options) {
256
+ const packageAddress = options.package ?? '@waterx/account';
257
+ const argumentsTypes = [
258
+ null,
259
+ 'u16'
260
+ ];
261
+ const parameterNames = ["registry", "v"];
262
+ return (tx) => tx.moveCall({
263
+ package: packageAddress,
264
+ module: 'account',
265
+ function: 'is_version_allowed',
266
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
267
+ });
268
+ }
269
+ export function allowVersion(options) {
270
+ const packageAddress = options.package ?? '@waterx/account';
271
+ const argumentsTypes = [
272
+ null,
273
+ null,
274
+ 'u16'
275
+ ];
276
+ const parameterNames = ["registry", "_", "v"];
277
+ return (tx) => tx.moveCall({
278
+ package: packageAddress,
279
+ module: 'account',
280
+ function: 'allow_version',
281
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
282
+ });
283
+ }
284
+ export function disallowVersion(options) {
285
+ const packageAddress = options.package ?? '@waterx/account';
286
+ const argumentsTypes = [
287
+ null,
288
+ null,
289
+ 'u16'
290
+ ];
291
+ const parameterNames = ["registry", "_", "v"];
292
+ return (tx) => tx.moveCall({
293
+ package: packageAddress,
294
+ module: 'account',
295
+ function: 'disallow_version',
296
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
297
+ });
298
+ }
299
+ export function isPaused(options) {
300
+ const packageAddress = options.package ?? '@waterx/account';
301
+ const argumentsTypes = [
302
+ null
303
+ ];
304
+ const parameterNames = ["registry"];
305
+ return (tx) => tx.moveCall({
306
+ package: packageAddress,
307
+ module: 'account',
308
+ function: 'is_paused',
309
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
310
+ });
311
+ }
312
+ export function assertNotPaused(options) {
313
+ const packageAddress = options.package ?? '@waterx/account';
314
+ const argumentsTypes = [
315
+ null
316
+ ];
317
+ const parameterNames = ["registry"];
318
+ return (tx) => tx.moveCall({
319
+ package: packageAddress,
320
+ module: 'account',
321
+ function: 'assert_not_paused',
322
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
323
+ });
324
+ }
325
+ export function pause(options) {
326
+ const packageAddress = options.package ?? '@waterx/account';
327
+ const argumentsTypes = [
328
+ null,
329
+ null
330
+ ];
331
+ const parameterNames = ["registry", "managerRequest"];
332
+ return (tx) => tx.moveCall({
333
+ package: packageAddress,
334
+ module: 'account',
335
+ function: 'pause',
336
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
337
+ });
338
+ }
339
+ export function unpause(options) {
340
+ const packageAddress = options.package ?? '@waterx/account';
341
+ const argumentsTypes = [
342
+ null,
343
+ null
344
+ ];
345
+ const parameterNames = ["registry", "_"];
346
+ return (tx) => tx.moveCall({
347
+ package: packageAddress,
348
+ module: 'account',
349
+ function: 'unpause',
350
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
351
+ });
352
+ }
353
+ export function isManager(options) {
354
+ const packageAddress = options.package ?? '@waterx/account';
355
+ const argumentsTypes = [
356
+ null,
357
+ 'address'
358
+ ];
359
+ const parameterNames = ["registry", "addr"];
360
+ return (tx) => tx.moveCall({
361
+ package: packageAddress,
362
+ module: 'account',
363
+ function: 'is_manager',
364
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
365
+ });
366
+ }
367
+ export function managers(options) {
368
+ const packageAddress = options.package ?? '@waterx/account';
369
+ const argumentsTypes = [
370
+ null
371
+ ];
372
+ const parameterNames = ["registry"];
373
+ return (tx) => tx.moveCall({
374
+ package: packageAddress,
375
+ module: 'account',
376
+ function: 'managers',
377
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
378
+ });
379
+ }
380
+ export function addManager(options) {
381
+ const packageAddress = options.package ?? '@waterx/account';
382
+ const argumentsTypes = [
383
+ null,
384
+ null,
385
+ 'address'
386
+ ];
387
+ const parameterNames = ["registry", "_", "manager"];
388
+ return (tx) => tx.moveCall({
389
+ package: packageAddress,
390
+ module: 'account',
391
+ function: 'add_manager',
392
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
393
+ });
394
+ }
395
+ export function removeManager(options) {
396
+ const packageAddress = options.package ?? '@waterx/account';
397
+ const argumentsTypes = [
398
+ null,
399
+ null,
400
+ 'address'
401
+ ];
402
+ const parameterNames = ["registry", "_", "manager"];
403
+ return (tx) => tx.moveCall({
404
+ package: packageAddress,
405
+ module: 'account',
406
+ function: 'remove_manager',
407
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
408
+ });
409
+ }
410
+ export function isProtocolWhitelisted(options) {
411
+ const packageAddress = options.package ?? '@waterx/account';
412
+ const argumentsTypes = [
413
+ null
414
+ ];
415
+ const parameterNames = ["registry"];
416
+ return (tx) => tx.moveCall({
417
+ package: packageAddress,
418
+ module: 'account',
419
+ function: 'is_protocol_whitelisted',
420
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
421
+ typeArguments: options.typeArguments
422
+ });
423
+ }
424
+ export function isProtocolAssetAllowed(options) {
425
+ const packageAddress = options.package ?? '@waterx/account';
426
+ const argumentsTypes = [
427
+ null
428
+ ];
429
+ const parameterNames = ["registry"];
430
+ return (tx) => tx.moveCall({
431
+ package: packageAddress,
432
+ module: 'account',
433
+ function: 'is_protocol_asset_allowed',
434
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
435
+ typeArguments: options.typeArguments
436
+ });
437
+ }
438
+ export function protocolWhitelist(options) {
439
+ const packageAddress = options.package ?? '@waterx/account';
440
+ const argumentsTypes = [
441
+ null
442
+ ];
443
+ const parameterNames = ["registry"];
444
+ return (tx) => tx.moveCall({
445
+ package: packageAddress,
446
+ module: 'account',
447
+ function: 'protocol_whitelist',
448
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
449
+ });
450
+ }
451
+ /**
452
+ * Admin: register witness type `P` with an empty asset set. After this, admin must
453
+ * call `allow_protocol_asset<P, T>` for each T the protocol may draw. Strict —
454
+ * aborts if `P` is already listed.
455
+ */
456
+ export function whitelistProtocol(options) {
457
+ const packageAddress = options.package ?? '@waterx/account';
458
+ const argumentsTypes = [
459
+ null,
460
+ null
461
+ ];
462
+ const parameterNames = ["registry", "_"];
463
+ return (tx) => tx.moveCall({
464
+ package: packageAddress,
465
+ module: 'account',
466
+ function: 'whitelist_protocol',
467
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
468
+ typeArguments: options.typeArguments
469
+ });
470
+ }
471
+ /**
472
+ * Admin: remove witness type `P` (and its entire asset set) from the protocol
473
+ * whitelist. After this, every `take<T, P>` / `put<T, P>` and witness-gated
474
+ * data-slot call aborts. Existing data slots and protocol-held balances are
475
+ * untouched — only future calls are blocked, so admin can pause a misbehaving
476
+ * protocol without stranding state on accounts.
477
+ */
478
+ export function delistProtocol(options) {
479
+ const packageAddress = options.package ?? '@waterx/account';
480
+ const argumentsTypes = [
481
+ null,
482
+ null
483
+ ];
484
+ const parameterNames = ["registry", "_"];
485
+ return (tx) => tx.moveCall({
486
+ package: packageAddress,
487
+ module: 'account',
488
+ function: 'delist_protocol',
489
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
490
+ typeArguments: options.typeArguments
491
+ });
492
+ }
493
+ /**
494
+ * Admin: add asset type `T` to protocol `P`'s allowed-asset set. After this,
495
+ * `take<T, P>` is permitted (subject to per-account auth). Aborts if `P` is not
496
+ * whitelisted or if `T` is already in the set.
497
+ */
498
+ export function allowProtocolAsset(options) {
499
+ const packageAddress = options.package ?? '@waterx/account';
500
+ const argumentsTypes = [
501
+ null,
502
+ null
503
+ ];
504
+ const parameterNames = ["registry", "_"];
505
+ return (tx) => tx.moveCall({
506
+ package: packageAddress,
507
+ module: 'account',
508
+ function: 'allow_protocol_asset',
509
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
510
+ typeArguments: options.typeArguments
511
+ });
512
+ }
513
+ /**
514
+ * Admin: remove asset type `T` from protocol `P`'s allowed-asset set. Blocks
515
+ * future `take<T, P>` calls but `put<T, P>` on `T` stays open so existing
516
+ * positions can always close. Aborts if `P` is not whitelisted or if `T` is not in
517
+ * the set.
518
+ */
519
+ export function disallowProtocolAsset(options) {
520
+ const packageAddress = options.package ?? '@waterx/account';
521
+ const argumentsTypes = [
522
+ null,
523
+ null
524
+ ];
525
+ const parameterNames = ["registry", "_"];
526
+ return (tx) => tx.moveCall({
527
+ package: packageAddress,
528
+ module: 'account',
529
+ function: 'disallow_protocol_asset',
530
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
531
+ typeArguments: options.typeArguments
532
+ });
533
+ }
534
+ /**
535
+ * Returns true if `T` has at least one deposit policy registered. Used by
536
+ * `request_deposit<T>` to gate inflow and by `withdraw_from_funds<T>` to refuse
537
+ * policy-managed types.
538
+ */
539
+ export function isDepositPolicyRegistered(options) {
540
+ const packageAddress = options.package ?? '@waterx/account';
541
+ const argumentsTypes = [
542
+ null
543
+ ];
544
+ const parameterNames = ["registry"];
545
+ return (tx) => tx.moveCall({
546
+ package: packageAddress,
547
+ module: 'account',
548
+ function: 'is_deposit_policy_registered',
549
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
550
+ typeArguments: options.typeArguments
551
+ });
552
+ }
553
+ /** Returns true if `T` has at least one withdraw policy registered. */
554
+ export function isWithdrawPolicyRegistered(options) {
555
+ const packageAddress = options.package ?? '@waterx/account';
556
+ const argumentsTypes = [
557
+ null
558
+ ];
559
+ const parameterNames = ["registry"];
560
+ return (tx) => tx.moveCall({
561
+ package: packageAddress,
562
+ module: 'account',
563
+ function: 'is_withdraw_policy_registered',
564
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
565
+ typeArguments: options.typeArguments
566
+ });
567
+ }
568
+ /**
569
+ * Returns true if the specific witness `P` is one of T's registered deposit
570
+ * policies. `consume_deposit<T, P>` aborts `EPolicyMismatch` when this would
571
+ * return false.
572
+ */
573
+ export function isDepositPolicyRegisteredFor(options) {
574
+ const packageAddress = options.package ?? '@waterx/account';
575
+ const argumentsTypes = [
576
+ null
577
+ ];
578
+ const parameterNames = ["registry"];
579
+ return (tx) => tx.moveCall({
580
+ package: packageAddress,
581
+ module: 'account',
582
+ function: 'is_deposit_policy_registered_for',
583
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
584
+ typeArguments: options.typeArguments
585
+ });
586
+ }
587
+ export function isWithdrawPolicyRegisteredFor(options) {
588
+ const packageAddress = options.package ?? '@waterx/account';
589
+ const argumentsTypes = [
590
+ null
591
+ ];
592
+ const parameterNames = ["registry"];
593
+ return (tx) => tx.moveCall({
594
+ package: packageAddress,
595
+ module: 'account',
596
+ function: 'is_withdraw_policy_registered_for',
597
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
598
+ typeArguments: options.typeArguments
599
+ });
600
+ }
601
+ /**
602
+ * Returns the full set of deposit-policy witness typenames registered for `T`, as
603
+ * a `vector<TypeName>` copy (TypeName is `copy + drop + store`, so this is
604
+ * cheap). Aborts if T has no policies. Off-chain consumers wanting iteration
605
+ * without the copy should walk the full `deposit_policies()` map instead.
606
+ */
607
+ export function depositPoliciesFor(options) {
608
+ const packageAddress = options.package ?? '@waterx/account';
609
+ const argumentsTypes = [
610
+ null
611
+ ];
612
+ const parameterNames = ["registry"];
613
+ return (tx) => tx.moveCall({
614
+ package: packageAddress,
615
+ module: 'account',
616
+ function: 'deposit_policies_for',
617
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
618
+ typeArguments: options.typeArguments
619
+ });
620
+ }
621
+ export function withdrawPoliciesFor(options) {
622
+ const packageAddress = options.package ?? '@waterx/account';
623
+ const argumentsTypes = [
624
+ null
625
+ ];
626
+ const parameterNames = ["registry"];
627
+ return (tx) => tx.moveCall({
628
+ package: packageAddress,
629
+ module: 'account',
630
+ function: 'withdraw_policies_for',
631
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
632
+ typeArguments: options.typeArguments
633
+ });
634
+ }
635
+ export function depositPolicies(options) {
636
+ const packageAddress = options.package ?? '@waterx/account';
637
+ const argumentsTypes = [
638
+ null
639
+ ];
640
+ const parameterNames = ["registry"];
641
+ return (tx) => tx.moveCall({
642
+ package: packageAddress,
643
+ module: 'account',
644
+ function: 'deposit_policies',
645
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
646
+ });
647
+ }
648
+ export function withdrawPolicies(options) {
649
+ const packageAddress = options.package ?? '@waterx/account';
650
+ const argumentsTypes = [
651
+ null
652
+ ];
653
+ const parameterNames = ["registry"];
654
+ return (tx) => tx.moveCall({
655
+ package: packageAddress,
656
+ module: 'account',
657
+ function: 'withdraw_policies',
658
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
659
+ });
660
+ }
661
+ /**
662
+ * Admin: register witness type `P` as a deposit policy for `T`. Multiple policies
663
+ * can coexist per T to support extension (a new module added alongside the old)
664
+ * and migration (consumers switch one at a time). Idempotent — adding an
665
+ * already-registered `(T, P)` pair is a silent no-op so admin can re-run deploy
666
+ * scripts safely.
667
+ */
668
+ export function registerDepositPolicy(options) {
669
+ const packageAddress = options.package ?? '@waterx/account';
670
+ const argumentsTypes = [
671
+ null,
672
+ null
673
+ ];
674
+ const parameterNames = ["registry", "_"];
675
+ return (tx) => tx.moveCall({
676
+ package: packageAddress,
677
+ module: 'account',
678
+ function: 'register_deposit_policy',
679
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
680
+ typeArguments: options.typeArguments
681
+ });
682
+ }
683
+ export function registerWithdrawPolicy(options) {
684
+ const packageAddress = options.package ?? '@waterx/account';
685
+ const argumentsTypes = [
686
+ null,
687
+ null
688
+ ];
689
+ const parameterNames = ["registry", "_"];
690
+ return (tx) => tx.moveCall({
691
+ package: packageAddress,
692
+ module: 'account',
693
+ function: 'register_withdraw_policy',
694
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
695
+ typeArguments: options.typeArguments
696
+ });
697
+ }
698
+ /**
699
+ * Admin: remove `P` from T's deposit-policy set. Other registered policies for `T`
700
+ * keep working. If `P` is the last entry, the `T` key is cleaned up so
701
+ * `is_deposit_policy_registered<T>` returns false. Aborts if `(T, P)` isn't
702
+ * registered.
703
+ */
704
+ export function unregisterDepositPolicy(options) {
705
+ const packageAddress = options.package ?? '@waterx/account';
706
+ const argumentsTypes = [
707
+ null,
708
+ null
709
+ ];
710
+ const parameterNames = ["registry", "_"];
711
+ return (tx) => tx.moveCall({
712
+ package: packageAddress,
713
+ module: 'account',
714
+ function: 'unregister_deposit_policy',
715
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
716
+ typeArguments: options.typeArguments
717
+ });
718
+ }
719
+ export function unregisterWithdrawPolicy(options) {
720
+ const packageAddress = options.package ?? '@waterx/account';
721
+ const argumentsTypes = [
722
+ null,
723
+ null
724
+ ];
725
+ const parameterNames = ["registry", "_"];
726
+ return (tx) => tx.moveCall({
727
+ package: packageAddress,
728
+ module: 'account',
729
+ function: 'unregister_withdraw_policy',
730
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
731
+ typeArguments: options.typeArguments
732
+ });
733
+ }
734
+ export function createAccount(options) {
735
+ const packageAddress = options.package ?? '@waterx/account';
736
+ const argumentsTypes = [
737
+ null,
738
+ null,
739
+ '0x1::string::String'
740
+ ];
741
+ const parameterNames = ["registry", "senderRequest", "alias"];
742
+ return (tx) => tx.moveCall({
743
+ package: packageAddress,
744
+ module: 'account',
745
+ function: 'create_account',
746
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
747
+ });
748
+ }
749
+ /**
750
+ * Off-chain view: compute the address a future `create_account` call will produce
751
+ * for `(owner, index)`. Mirrors `derived_object::derive_address` keyed on
752
+ * `AccountKey`. Useful for SDKs that want to address an account before it exists,
753
+ * or to discover all of an owner's accounts by iterating index from 0 up to
754
+ * `MAX_ACCOUNTS_PER_OWNER` and checking `has_account` against each derived
755
+ * address.
756
+ */
757
+ export function deriveAccountAddress(options) {
758
+ const packageAddress = options.package ?? '@waterx/account';
759
+ const argumentsTypes = [
760
+ null,
761
+ 'address',
762
+ 'u64'
763
+ ];
764
+ const parameterNames = ["registry", "owner", "index"];
765
+ return (tx) => tx.moveCall({
766
+ package: packageAddress,
767
+ module: 'account',
768
+ function: 'derive_account_address',
769
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
770
+ });
771
+ }
772
+ export function setAlias(options) {
773
+ const packageAddress = options.package ?? '@waterx/account';
774
+ const argumentsTypes = [
775
+ null,
776
+ null,
777
+ '0x2::object::ID',
778
+ '0x1::string::String'
779
+ ];
780
+ const parameterNames = ["registry", "senderRequest", "accountId", "alias"];
781
+ return (tx) => tx.moveCall({
782
+ package: packageAddress,
783
+ module: 'account',
784
+ function: 'set_alias',
785
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
786
+ });
787
+ }
788
+ export function addDelegate(options) {
789
+ const packageAddress = options.package ?? '@waterx/account';
790
+ const argumentsTypes = [
791
+ null,
792
+ null,
793
+ '0x2::object::ID',
794
+ 'address',
795
+ '0x1::string::String',
796
+ 'u32',
797
+ '0x1::option::Option<u64>',
798
+ '0x2::clock::Clock'
799
+ ];
800
+ const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress", "alias", "permissions", "expiresAtMs"];
801
+ return (tx) => tx.moveCall({
802
+ package: packageAddress,
803
+ module: 'account',
804
+ function: 'add_delegate',
805
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
806
+ });
807
+ }
808
+ /**
809
+ * Owner-only for live delegates; permissionless once the delegate has passed its
810
+ * `expires_at_ms`. Lets a keeper / bot prune dead entries without bothering the
811
+ * owner — an expired delegate carries no authority, so removing it is purely
812
+ * janitorial.
813
+ */
814
+ export function removeDelegate(options) {
815
+ const packageAddress = options.package ?? '@waterx/account';
816
+ const argumentsTypes = [
817
+ null,
818
+ null,
819
+ '0x2::object::ID',
820
+ 'address',
821
+ '0x2::clock::Clock'
822
+ ];
823
+ const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress"];
824
+ return (tx) => tx.moveCall({
825
+ package: packageAddress,
826
+ module: 'account',
827
+ function: 'remove_delegate',
828
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
829
+ });
830
+ }
831
+ export function updateDelegate(options) {
832
+ const packageAddress = options.package ?? '@waterx/account';
833
+ const argumentsTypes = [
834
+ null,
835
+ null,
836
+ '0x2::object::ID',
837
+ 'address',
838
+ '0x1::string::String',
839
+ 'u32',
840
+ '0x1::option::Option<u64>',
841
+ '0x2::clock::Clock'
842
+ ];
843
+ const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress", "alias", "permissions", "expiresAtMs"];
844
+ return (tx) => tx.moveCall({
845
+ package: packageAddress,
846
+ module: 'account',
847
+ function: 'update_delegate',
848
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
849
+ });
850
+ }
851
+ export function setDelegateProtocolPermission(options) {
852
+ const packageAddress = options.package ?? '@waterx/account';
853
+ const argumentsTypes = [
854
+ null,
855
+ null,
856
+ '0x2::object::ID',
857
+ 'address',
858
+ 'u32',
859
+ '0x2::clock::Clock'
860
+ ];
861
+ const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress", "permissions"];
862
+ return (tx) => tx.moveCall({
863
+ package: packageAddress,
864
+ module: 'account',
865
+ function: 'set_delegate_protocol_permission',
866
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
867
+ typeArguments: options.typeArguments
868
+ });
869
+ }
870
+ export function unsetDelegateProtocolPermission(options) {
871
+ const packageAddress = options.package ?? '@waterx/account';
872
+ const argumentsTypes = [
873
+ null,
874
+ null,
875
+ '0x2::object::ID',
876
+ 'address',
877
+ '0x2::clock::Clock'
878
+ ];
879
+ const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress"];
880
+ return (tx) => tx.moveCall({
881
+ package: packageAddress,
882
+ module: 'account',
883
+ function: 'unset_delegate_protocol_permission',
884
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
885
+ typeArguments: options.typeArguments
886
+ });
887
+ }
888
+ /**
889
+ * Wraps an in-PTB `Coin<T>` into a `DepositRequest<T>` for the account.
890
+ * Permissionless — anyone can pay into any account, since the policy (not the
891
+ * framework) decides what the eventual credited asset is. `T` must have a
892
+ * registered deposit policy; aborts otherwise.
893
+ */
894
+ export function requestDeposit(options) {
895
+ const packageAddress = options.package ?? '@waterx/account';
896
+ const argumentsTypes = [
897
+ null,
898
+ '0x2::object::ID',
899
+ null,
900
+ 'vector<u8>'
901
+ ];
902
+ const parameterNames = ["registry", "accountId", "coin", "extraData"];
903
+ return (tx) => tx.moveCall({
904
+ package: packageAddress,
905
+ module: 'account',
906
+ function: 'request_deposit',
907
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
908
+ typeArguments: options.typeArguments
909
+ });
910
+ }
911
+ /**
912
+ * Drains `Receiving<Coin<T>>` entries addressed to the account's UID into a single
913
+ * merged `Coin<T>` and wraps it as a `DepositRequest<T>`. Used when a user (or
914
+ * anyone) previously `transfer_coin`-ed a `Coin<T>` onto the account address and
915
+ * now wants to fold it into custody. Permissionless for the same reason as
916
+ * `request_deposit<T>`.
917
+ */
918
+ export function requestDepositFromReceivings(options) {
919
+ const packageAddress = options.package ?? '@waterx/account';
920
+ const argumentsTypes = [
921
+ null,
922
+ '0x2::object::ID',
923
+ 'vector<null>',
924
+ 'vector<u8>'
925
+ ];
926
+ const parameterNames = ["registry", "accountId", "receivings", "extraData"];
927
+ return (tx) => tx.moveCall({
928
+ package: packageAddress,
929
+ module: 'account',
930
+ function: 'request_deposit_from_receivings',
931
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
932
+ typeArguments: options.typeArguments
933
+ });
934
+ }
935
+ /**
936
+ * Drains every `Balance<T>` sitting at the account's UID-derived address in Sui's
937
+ * native funds accumulator and wraps the total into a single `DepositRequest<T>`.
938
+ * Useful for accounts that receive `Coin<T>` via `0x2::balance::send_funds<T>` (or
939
+ * any path that lands T at `account_id.to_address()` directly) and want it folded
940
+ * into framework custody through the deposit-policy pipeline.
941
+ *
942
+ * The total drained equals `settled_funds_value<T>(root, addr)` as of the last
943
+ * consensus commit — within the writing PTB itself, that read returns the pre-tx
944
+ * value, so SDKs should treat this as a between-tx drain. Permissionless
945
+ * (crediting an account is always allowed), pause-free, requires `T` to have a
946
+ * registered deposit policy. Returns a deposit request even when the address holds
947
+ * zero T (the carried balance is `Balance::zero()` in that case) — callers can
948
+ * short-circuit off-chain by checking `settled_funds_value` first.
949
+ */
950
+ export function requestDepositFromFunds(options) {
951
+ const packageAddress = options.package ?? '@waterx/account';
952
+ const argumentsTypes = [
953
+ null,
954
+ '0x2::object::ID',
955
+ null,
956
+ 'vector<u8>'
957
+ ];
958
+ const parameterNames = ["registry", "accountId", "accumulatorRoot", "extraData"];
959
+ return (tx) => tx.moveCall({
960
+ package: packageAddress,
961
+ module: 'account',
962
+ function: 'request_deposit_from_funds',
963
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
964
+ typeArguments: options.typeArguments
965
+ });
966
+ }
967
+ /**
968
+ * Policy-side unwrap. Verifies that `P` is the registered deposit policy for `T`,
969
+ * then destructures the hot potato. The policy module is responsible for what
970
+ * happens next — typically swap / convert `Balance<T>` to some `Balance<T_OUT>`
971
+ * and call `put<T_OUT, P>` to credit the account.
972
+ */
973
+ export function consumeDeposit(options) {
974
+ const packageAddress = options.package ?? '@waterx/account';
975
+ const argumentsTypes = [
976
+ null,
977
+ null,
978
+ `${options.typeArguments[1]}`
979
+ ];
980
+ const parameterNames = ["registry", "req", "Witness"];
981
+ return (tx) => tx.moveCall({
982
+ package: packageAddress,
983
+ module: 'account',
984
+ function: 'consume_deposit',
985
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
986
+ typeArguments: options.typeArguments
987
+ });
988
+ }
989
+ /**
990
+ * Debits `amount` of the account's stored `Balance<T>` and packages it into a
991
+ * `WithdrawRequest<T>` for the registered withdraw policy. Auth (`PERM_WITHDRAW`
992
+ * on `T`'s account) and pause are checked here, not in `consume_withdraw`.
993
+ */
994
+ export function requestWithdraw(options) {
995
+ const packageAddress = options.package ?? '@waterx/account';
996
+ const argumentsTypes = [
997
+ null,
998
+ null,
999
+ '0x2::object::ID',
1000
+ 'u64',
1001
+ 'address',
1002
+ 'vector<u8>',
1003
+ '0x2::clock::Clock'
1004
+ ];
1005
+ const parameterNames = ["registry", "senderRequest", "accountId", "amount", "recipient", "extraData"];
1006
+ return (tx) => tx.moveCall({
1007
+ package: packageAddress,
1008
+ module: 'account',
1009
+ function: 'request_withdraw',
1010
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1011
+ typeArguments: options.typeArguments
1012
+ });
1013
+ }
1014
+ /**
1015
+ * Policy-side unwrap. Verifies that `P` is the registered withdraw policy for `T`,
1016
+ * then destructures the hot potato. The policy module decides what to do with the
1017
+ * `Balance<T>` (transfer to `recipient` as `Coin<T>`, swap to another asset and
1018
+ * transfer, queue for later settlement, etc.).
1019
+ */
1020
+ export function consumeWithdraw(options) {
1021
+ const packageAddress = options.package ?? '@waterx/account';
1022
+ const argumentsTypes = [
1023
+ null,
1024
+ null,
1025
+ `${options.typeArguments[1]}`
1026
+ ];
1027
+ const parameterNames = ["registry", "req", "Witness"];
1028
+ return (tx) => tx.moveCall({
1029
+ package: packageAddress,
1030
+ module: 'account',
1031
+ function: 'consume_withdraw',
1032
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1033
+ typeArguments: options.typeArguments
1034
+ });
1035
+ }
1036
+ /**
1037
+ * TTOs a `Coin<T>` to the account's UID address. The coin sits there until someone
1038
+ * calls `request_deposit_from_receivings<T>` (which requires a registered deposit
1039
+ * policy that then folds the coin into the account's stored balance) or
1040
+ * `receive<Coin<T>>` (owner / `PERM_RECEIVE` delegate, no policy needed). Useful
1041
+ * for async / cross-PTB deposits and for routing protocol payouts (e.g. reward
1042
+ * claims) into an account when `T` has no deposit policy.
1043
+ */
1044
+ export function transferCoin(options) {
1045
+ const packageAddress = options.package ?? '@waterx/account';
1046
+ const argumentsTypes = [
1047
+ null,
1048
+ '0x2::object::ID',
1049
+ null
1050
+ ];
1051
+ const parameterNames = ["registry", "accountId", "coin"];
1052
+ return (tx) => tx.moveCall({
1053
+ package: packageAddress,
1054
+ module: 'account',
1055
+ function: 'transfer_coin',
1056
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1057
+ typeArguments: options.typeArguments
1058
+ });
1059
+ }
1060
+ /**
1061
+ * Account-owner drain of a TTO'd object on the account's UID. Generic over
1062
+ * `T: key + store` — works for NFTs, reward objects, or `Coin<X>` where `X` has no
1063
+ * registered deposit policy.
1064
+ *
1065
+ * **Policy-managed Coin<X> is rejected.** If `T == Coin<X>` and `X` has a deposit
1066
+ * policy registered, this aborts `EUseRequestDepositInstead` to keep policy-routed
1067
+ * inflow on the deposit-policy pipeline — bypassing via `receive` would skip the
1068
+ * conversion / authorization the policy is supposed to enforce. Use
1069
+ * `request_deposit_from_receivings<X>` or `request_deposit_from_funds<X>` for
1070
+ * inflow when X has a deposit policy.
1071
+ *
1072
+ * Auth: account owner or a `PERM_RECEIVE` delegate (kept separate from
1073
+ * `PERM_WITHDRAW` so reward-collection rights don't imply balance-drain rights).
1074
+ * Returns the received object to the caller's PTB.
1075
+ */
1076
+ export function receive(options) {
1077
+ const packageAddress = options.package ?? '@waterx/account';
1078
+ const argumentsTypes = [
1079
+ null,
1080
+ null,
1081
+ '0x2::object::ID',
1082
+ null,
1083
+ '0x2::clock::Clock'
1084
+ ];
1085
+ const parameterNames = ["registry", "senderRequest", "accountId", "receiving"];
1086
+ return (tx) => tx.moveCall({
1087
+ package: packageAddress,
1088
+ module: 'account',
1089
+ function: 'receive',
1090
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1091
+ typeArguments: options.typeArguments
1092
+ });
1093
+ }
1094
+ /**
1095
+ * Drains every `Balance<T>` sitting at the account's UID-derived address in Sui's
1096
+ * native funds accumulator and returns it directly as a `Balance<T>`. Symmetric to
1097
+ * `request_deposit_from_funds<T>`, but explicitly for `T` that has **no**
1098
+ * registered deposit policy — policy-managed inflow must route through the
1099
+ * deposit-policy pipeline instead. The intent is to let owners (or `PERM_WITHDRAW`
1100
+ * delegates) pull policy-less inflow (reward tokens TTO'd via `send_funds`,
1101
+ * miscellaneous `Balance<T>` the SDK parked at the address) straight out.
1102
+ *
1103
+ * Auth: same as `request_withdraw<T>` — `PERM_WITHDRAW` or owner. Aborts
1104
+ * `EUseRequestDepositInstead` if `T` has a deposit policy registered. Pause-gated.
1105
+ * Returns `Balance::zero<T>()` when the address holds no T.
1106
+ */
1107
+ export function withdrawFromFunds(options) {
1108
+ const packageAddress = options.package ?? '@waterx/account';
1109
+ const argumentsTypes = [
1110
+ null,
1111
+ null,
1112
+ '0x2::object::ID',
1113
+ null,
1114
+ '0x2::clock::Clock'
1115
+ ];
1116
+ const parameterNames = ["registry", "senderRequest", "accountId", "accumulatorRoot"];
1117
+ return (tx) => tx.moveCall({
1118
+ package: packageAddress,
1119
+ module: 'account',
1120
+ function: 'withdraw_from_funds',
1121
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1122
+ typeArguments: options.typeArguments
1123
+ });
1124
+ }
1125
+ /**
1126
+ * Splits `amount` of `Balance<T>` off `account_id` for protocol `P` to use. Three
1127
+ * gates compose:
1128
+ *
1129
+ * 1. **Witness privacy.** Only the module that defines `P` can produce a value of
1130
+ * `P`, so only that module can call `take<T, P>`.
1131
+ * 2. **Protocol whitelist.** `P` must be in `protocol_whitelist` (admin-managed).
1132
+ * Stops any deployed module that happens to own a `drop` witness from draining
1133
+ * accounts.
1134
+ * 3. **Per-account auth.** `sender_request.address()` must be the account's owner
1135
+ * OR a non-expired delegate — even a legitimate whitelisted protocol cannot
1136
+ * move funds out of an account that doesn't know the caller. This mirrors EOA
1137
+ * semantics: the account never pays out without the owner (or a delegated key)
1138
+ * signing. Per-action bit semantics on `protocol_permissions[P]` remain the
1139
+ * protocol's responsibility on top of this.
1140
+ *
1141
+ * No deposit/withdraw policy is consulted — `take` / `put` are the
1142
+ * protocol↔account flow and orthogonal to the external deposit/withdraw path that
1143
+ * policies own.
1144
+ */
1145
+ export function take(options) {
1146
+ const packageAddress = options.package ?? '@waterx/account';
1147
+ const argumentsTypes = [
1148
+ null,
1149
+ null,
1150
+ '0x2::object::ID',
1151
+ 'u64',
1152
+ `${options.typeArguments[1]}`,
1153
+ '0x2::clock::Clock'
1154
+ ];
1155
+ const parameterNames = ["registry", "senderRequest", "accountId", "amount", "Witness"];
1156
+ return (tx) => tx.moveCall({
1157
+ package: packageAddress,
1158
+ module: 'account',
1159
+ function: 'take',
1160
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1161
+ typeArguments: options.typeArguments
1162
+ });
1163
+ }
1164
+ /**
1165
+ * Joins `bal` into `account_id`'s stored `Balance<T>`. Symmetric to `take<T, P>`.
1166
+ * Zero-value balances are silently destroyed.
1167
+ */
1168
+ export function put(options) {
1169
+ const packageAddress = options.package ?? '@waterx/account';
1170
+ const argumentsTypes = [
1171
+ null,
1172
+ '0x2::object::ID',
1173
+ null,
1174
+ `${options.typeArguments[1]}`
1175
+ ];
1176
+ const parameterNames = ["registry", "accountId", "bal", "Witness"];
1177
+ return (tx) => tx.moveCall({
1178
+ package: packageAddress,
1179
+ module: 'account',
1180
+ function: 'put',
1181
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1182
+ typeArguments: options.typeArguments
1183
+ });
1184
+ }
1185
+ export function hasAccount(options) {
1186
+ const packageAddress = options.package ?? '@waterx/account';
1187
+ const argumentsTypes = [
1188
+ null,
1189
+ '0x2::object::ID'
1190
+ ];
1191
+ const parameterNames = ["registry", "accountId"];
1192
+ return (tx) => tx.moveCall({
1193
+ package: packageAddress,
1194
+ module: 'account',
1195
+ function: 'has_account',
1196
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1197
+ });
1198
+ }
1199
+ /**
1200
+ * Returns `true` when `addr` is the account's owner or a non-expired delegate,
1201
+ * regardless of permission bits. The framework's "is this address known to the
1202
+ * account?" gate — per-action bit semantics are the protocol's responsibility on
1203
+ * top of this.
1204
+ */
1205
+ export function isAccountAuthorized(options) {
1206
+ const packageAddress = options.package ?? '@waterx/account';
1207
+ const argumentsTypes = [
1208
+ null,
1209
+ '0x2::object::ID',
1210
+ 'address',
1211
+ 'u64'
1212
+ ];
1213
+ const parameterNames = ["registry", "accountId", "addr", "nowMs"];
1214
+ return (tx) => tx.moveCall({
1215
+ package: packageAddress,
1216
+ module: 'account',
1217
+ function: 'is_account_authorized',
1218
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1219
+ });
1220
+ }
1221
+ export function accountCount(options) {
1222
+ const packageAddress = options.package ?? '@waterx/account';
1223
+ const argumentsTypes = [
1224
+ null,
1225
+ 'address'
1226
+ ];
1227
+ const parameterNames = ["registry", "owner"];
1228
+ return (tx) => tx.moveCall({
1229
+ package: packageAddress,
1230
+ module: 'account',
1231
+ function: 'account_count',
1232
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1233
+ });
1234
+ }
1235
+ export function accountIds(options) {
1236
+ const packageAddress = options.package ?? '@waterx/account';
1237
+ const argumentsTypes = [
1238
+ null,
1239
+ 'address'
1240
+ ];
1241
+ const parameterNames = ["registry", "owner"];
1242
+ return (tx) => tx.moveCall({
1243
+ package: packageAddress,
1244
+ module: 'account',
1245
+ function: 'account_ids',
1246
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1247
+ });
1248
+ }
1249
+ /**
1250
+ * Framework-level effective permissions (used by `request_withdraw`). Owner →
1251
+ * `PERM_ALL`. Delegate → its `permissions` bitmap unless expired. Stranger →
1252
+ * `PERM_NONE`.
1253
+ */
1254
+ export function effectivePermissions(options) {
1255
+ const packageAddress = options.package ?? '@waterx/account';
1256
+ const argumentsTypes = [
1257
+ null,
1258
+ '0x2::object::ID',
1259
+ 'address',
1260
+ 'u64'
1261
+ ];
1262
+ const parameterNames = ["registry", "accountId", "addr", "nowMs"];
1263
+ return (tx) => tx.moveCall({
1264
+ package: packageAddress,
1265
+ module: 'account',
1266
+ function: 'effective_permissions',
1267
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1268
+ });
1269
+ }
1270
+ export function hasPermission(options) {
1271
+ const packageAddress = options.package ?? '@waterx/account';
1272
+ const argumentsTypes = [
1273
+ null,
1274
+ '0x2::object::ID',
1275
+ 'address',
1276
+ 'u32',
1277
+ 'u64'
1278
+ ];
1279
+ const parameterNames = ["registry", "accountId", "addr", "permission", "nowMs"];
1280
+ return (tx) => tx.moveCall({
1281
+ package: packageAddress,
1282
+ module: 'account',
1283
+ function: 'has_permission',
1284
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1285
+ });
1286
+ }
1287
+ /**
1288
+ * Per-protocol effective permissions (used by protocol modules). Owner →
1289
+ * `PERM_ALL` for any protocol. Delegate → the bitmap stored at
1290
+ * `protocol_permissions[TypeName(PROTOCOL)]`, or `PERM_NONE` if absent or expired.
1291
+ * Stranger → `PERM_NONE`.
1292
+ */
1293
+ export function effectiveProtocolPermissions(options) {
1294
+ const packageAddress = options.package ?? '@waterx/account';
1295
+ const argumentsTypes = [
1296
+ null,
1297
+ '0x2::object::ID',
1298
+ 'address',
1299
+ 'u64'
1300
+ ];
1301
+ const parameterNames = ["registry", "accountId", "addr", "nowMs"];
1302
+ return (tx) => tx.moveCall({
1303
+ package: packageAddress,
1304
+ module: 'account',
1305
+ function: 'effective_protocol_permissions',
1306
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1307
+ typeArguments: options.typeArguments
1308
+ });
1309
+ }
1310
+ export function hasProtocolPermission(options) {
1311
+ const packageAddress = options.package ?? '@waterx/account';
1312
+ const argumentsTypes = [
1313
+ null,
1314
+ '0x2::object::ID',
1315
+ 'address',
1316
+ 'u32',
1317
+ 'u64'
1318
+ ];
1319
+ const parameterNames = ["registry", "accountId", "addr", "permission", "nowMs"];
1320
+ return (tx) => tx.moveCall({
1321
+ package: packageAddress,
1322
+ module: 'account',
1323
+ function: 'has_protocol_permission',
1324
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1325
+ typeArguments: options.typeArguments
1326
+ });
1327
+ }
1328
+ export function accountBalance(options) {
1329
+ const packageAddress = options.package ?? '@waterx/account';
1330
+ const argumentsTypes = [
1331
+ null,
1332
+ '0x2::object::ID'
1333
+ ];
1334
+ const parameterNames = ["registry", "accountId"];
1335
+ return (tx) => tx.moveCall({
1336
+ package: packageAddress,
1337
+ module: 'account',
1338
+ function: 'account_balance',
1339
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1340
+ typeArguments: options.typeArguments
1341
+ });
1342
+ }
1343
+ export function accountBalances(options) {
1344
+ const packageAddress = options.package ?? '@waterx/account';
1345
+ const argumentsTypes = [
1346
+ null,
1347
+ '0x2::object::ID'
1348
+ ];
1349
+ const parameterNames = ["registry", "accountId"];
1350
+ return (tx) => tx.moveCall({
1351
+ package: packageAddress,
1352
+ module: 'account',
1353
+ function: 'account_balances',
1354
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1355
+ });
1356
+ }
1357
+ /**
1358
+ * Total `Balance<T>` currently held across all accounts. Counter; not derived from
1359
+ * iterating accounts. Excludes balance held by protocols (after `take`) and
1360
+ * balance sitting in hot-potato requests in flight.
1361
+ */
1362
+ export function balance(options) {
1363
+ const packageAddress = options.package ?? '@waterx/account';
1364
+ const argumentsTypes = [
1365
+ null
1366
+ ];
1367
+ const parameterNames = ["registry"];
1368
+ return (tx) => tx.moveCall({
1369
+ package: packageAddress,
1370
+ module: 'account',
1371
+ function: 'balance',
1372
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1373
+ typeArguments: options.typeArguments
1374
+ });
1375
+ }
1376
+ export function accountOwner(options) {
1377
+ const packageAddress = options.package ?? '@waterx/account';
1378
+ const argumentsTypes = [
1379
+ null
1380
+ ];
1381
+ const parameterNames = ["account"];
1382
+ return (tx) => tx.moveCall({
1383
+ package: packageAddress,
1384
+ module: 'account',
1385
+ function: 'account_owner',
1386
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1387
+ });
1388
+ }
1389
+ export function accountAlias(options) {
1390
+ const packageAddress = options.package ?? '@waterx/account';
1391
+ const argumentsTypes = [
1392
+ null
1393
+ ];
1394
+ const parameterNames = ["account"];
1395
+ return (tx) => tx.moveCall({
1396
+ package: packageAddress,
1397
+ module: 'account',
1398
+ function: 'account_alias',
1399
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1400
+ });
1401
+ }
1402
+ export function accountId(options) {
1403
+ const packageAddress = options.package ?? '@waterx/account';
1404
+ const argumentsTypes = [
1405
+ null
1406
+ ];
1407
+ const parameterNames = ["account"];
1408
+ return (tx) => tx.moveCall({
1409
+ package: packageAddress,
1410
+ module: 'account',
1411
+ function: 'account_id',
1412
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1413
+ });
1414
+ }
1415
+ export function accountAddress(options) {
1416
+ const packageAddress = options.package ?? '@waterx/account';
1417
+ const argumentsTypes = [
1418
+ null
1419
+ ];
1420
+ const parameterNames = ["account"];
1421
+ return (tx) => tx.moveCall({
1422
+ package: packageAddress,
1423
+ module: 'account',
1424
+ function: 'account_address',
1425
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1426
+ });
1427
+ }
1428
+ export function accountDelegates(options) {
1429
+ const packageAddress = options.package ?? '@waterx/account';
1430
+ const argumentsTypes = [
1431
+ null
1432
+ ];
1433
+ const parameterNames = ["account"];
1434
+ return (tx) => tx.moveCall({
1435
+ package: packageAddress,
1436
+ module: 'account',
1437
+ function: 'account_delegates',
1438
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1439
+ });
1440
+ }
1441
+ export function accountBalancesField(options) {
1442
+ const packageAddress = options.package ?? '@waterx/account';
1443
+ const argumentsTypes = [
1444
+ null
1445
+ ];
1446
+ const parameterNames = ["account"];
1447
+ return (tx) => tx.moveCall({
1448
+ package: packageAddress,
1449
+ module: 'account',
1450
+ function: 'account_balances_field',
1451
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1452
+ });
1453
+ }
1454
+ export function delegateAddress(options) {
1455
+ const packageAddress = options.package ?? '@waterx/account';
1456
+ const argumentsTypes = [
1457
+ null
1458
+ ];
1459
+ const parameterNames = ["delegate"];
1460
+ return (tx) => tx.moveCall({
1461
+ package: packageAddress,
1462
+ module: 'account',
1463
+ function: 'delegate_address',
1464
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1465
+ });
1466
+ }
1467
+ export function delegateAlias(options) {
1468
+ const packageAddress = options.package ?? '@waterx/account';
1469
+ const argumentsTypes = [
1470
+ null
1471
+ ];
1472
+ const parameterNames = ["delegate"];
1473
+ return (tx) => tx.moveCall({
1474
+ package: packageAddress,
1475
+ module: 'account',
1476
+ function: 'delegate_alias',
1477
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1478
+ });
1479
+ }
1480
+ export function delegatePermissions(options) {
1481
+ const packageAddress = options.package ?? '@waterx/account';
1482
+ const argumentsTypes = [
1483
+ null
1484
+ ];
1485
+ const parameterNames = ["delegate"];
1486
+ return (tx) => tx.moveCall({
1487
+ package: packageAddress,
1488
+ module: 'account',
1489
+ function: 'delegate_permissions',
1490
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1491
+ });
1492
+ }
1493
+ export function delegateProtocolPermissions(options) {
1494
+ const packageAddress = options.package ?? '@waterx/account';
1495
+ const argumentsTypes = [
1496
+ null
1497
+ ];
1498
+ const parameterNames = ["delegate"];
1499
+ return (tx) => tx.moveCall({
1500
+ package: packageAddress,
1501
+ module: 'account',
1502
+ function: 'delegate_protocol_permissions',
1503
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1504
+ });
1505
+ }
1506
+ export function delegateExpiresAtMs(options) {
1507
+ const packageAddress = options.package ?? '@waterx/account';
1508
+ const argumentsTypes = [
1509
+ null
1510
+ ];
1511
+ const parameterNames = ["delegate"];
1512
+ return (tx) => tx.moveCall({
1513
+ package: packageAddress,
1514
+ module: 'account',
1515
+ function: 'delegate_expires_at_ms',
1516
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1517
+ });
1518
+ }
1519
+ export function depositRequestAccountId(options) {
1520
+ const packageAddress = options.package ?? '@waterx/account';
1521
+ const argumentsTypes = [
1522
+ null
1523
+ ];
1524
+ const parameterNames = ["r"];
1525
+ return (tx) => tx.moveCall({
1526
+ package: packageAddress,
1527
+ module: 'account',
1528
+ function: 'deposit_request_account_id',
1529
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1530
+ typeArguments: options.typeArguments
1531
+ });
1532
+ }
1533
+ export function depositRequestBalance(options) {
1534
+ const packageAddress = options.package ?? '@waterx/account';
1535
+ const argumentsTypes = [
1536
+ null
1537
+ ];
1538
+ const parameterNames = ["r"];
1539
+ return (tx) => tx.moveCall({
1540
+ package: packageAddress,
1541
+ module: 'account',
1542
+ function: 'deposit_request_balance',
1543
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1544
+ typeArguments: options.typeArguments
1545
+ });
1546
+ }
1547
+ export function depositRequestAmount(options) {
1548
+ const packageAddress = options.package ?? '@waterx/account';
1549
+ const argumentsTypes = [
1550
+ null
1551
+ ];
1552
+ const parameterNames = ["r"];
1553
+ return (tx) => tx.moveCall({
1554
+ package: packageAddress,
1555
+ module: 'account',
1556
+ function: 'deposit_request_amount',
1557
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1558
+ typeArguments: options.typeArguments
1559
+ });
1560
+ }
1561
+ export function depositRequestExtraData(options) {
1562
+ const packageAddress = options.package ?? '@waterx/account';
1563
+ const argumentsTypes = [
1564
+ null
1565
+ ];
1566
+ const parameterNames = ["r"];
1567
+ return (tx) => tx.moveCall({
1568
+ package: packageAddress,
1569
+ module: 'account',
1570
+ function: 'deposit_request_extra_data',
1571
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1572
+ typeArguments: options.typeArguments
1573
+ });
1574
+ }
1575
+ export function withdrawRequestAccountId(options) {
1576
+ const packageAddress = options.package ?? '@waterx/account';
1577
+ const argumentsTypes = [
1578
+ null
1579
+ ];
1580
+ const parameterNames = ["r"];
1581
+ return (tx) => tx.moveCall({
1582
+ package: packageAddress,
1583
+ module: 'account',
1584
+ function: 'withdraw_request_account_id',
1585
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1586
+ typeArguments: options.typeArguments
1587
+ });
1588
+ }
1589
+ export function withdrawRequestBalance(options) {
1590
+ const packageAddress = options.package ?? '@waterx/account';
1591
+ const argumentsTypes = [
1592
+ null
1593
+ ];
1594
+ const parameterNames = ["r"];
1595
+ return (tx) => tx.moveCall({
1596
+ package: packageAddress,
1597
+ module: 'account',
1598
+ function: 'withdraw_request_balance',
1599
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1600
+ typeArguments: options.typeArguments
1601
+ });
1602
+ }
1603
+ export function withdrawRequestAmount(options) {
1604
+ const packageAddress = options.package ?? '@waterx/account';
1605
+ const argumentsTypes = [
1606
+ null
1607
+ ];
1608
+ const parameterNames = ["r"];
1609
+ return (tx) => tx.moveCall({
1610
+ package: packageAddress,
1611
+ module: 'account',
1612
+ function: 'withdraw_request_amount',
1613
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1614
+ typeArguments: options.typeArguments
1615
+ });
1616
+ }
1617
+ export function withdrawRequestRecipient(options) {
1618
+ const packageAddress = options.package ?? '@waterx/account';
1619
+ const argumentsTypes = [
1620
+ null
1621
+ ];
1622
+ const parameterNames = ["r"];
1623
+ return (tx) => tx.moveCall({
1624
+ package: packageAddress,
1625
+ module: 'account',
1626
+ function: 'withdraw_request_recipient',
1627
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1628
+ typeArguments: options.typeArguments
1629
+ });
1630
+ }
1631
+ export function withdrawRequestExtraData(options) {
1632
+ const packageAddress = options.package ?? '@waterx/account';
1633
+ const argumentsTypes = [
1634
+ null
1635
+ ];
1636
+ const parameterNames = ["r"];
1637
+ return (tx) => tx.moveCall({
1638
+ package: packageAddress,
1639
+ module: 'account',
1640
+ function: 'withdraw_request_extra_data',
1641
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1642
+ typeArguments: options.typeArguments
1643
+ });
1644
+ }
1645
+ export function newData(options) {
1646
+ const packageAddress = options.package ?? '@waterx/account';
1647
+ const argumentsTypes = [
1648
+ null,
1649
+ '0x2::object::ID',
1650
+ `${options.typeArguments[0]}`,
1651
+ `${options.typeArguments[1]}`
1652
+ ];
1653
+ const parameterNames = ["registry", "accountId", "Witness", "data"];
1654
+ return (tx) => tx.moveCall({
1655
+ package: packageAddress,
1656
+ module: 'account',
1657
+ function: 'new_data',
1658
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1659
+ typeArguments: options.typeArguments
1660
+ });
1661
+ }
1662
+ export function borrowData(options) {
1663
+ const packageAddress = options.package ?? '@waterx/account';
1664
+ const argumentsTypes = [
1665
+ null,
1666
+ '0x2::object::ID'
1667
+ ];
1668
+ const parameterNames = ["registry", "accountId"];
1669
+ return (tx) => tx.moveCall({
1670
+ package: packageAddress,
1671
+ module: 'account',
1672
+ function: 'borrow_data',
1673
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1674
+ typeArguments: options.typeArguments
1675
+ });
1676
+ }
1677
+ export function borrowDataMut(options) {
1678
+ const packageAddress = options.package ?? '@waterx/account';
1679
+ const argumentsTypes = [
1680
+ null,
1681
+ '0x2::object::ID',
1682
+ `${options.typeArguments[0]}`
1683
+ ];
1684
+ const parameterNames = ["registry", "accountId", "Witness"];
1685
+ return (tx) => tx.moveCall({
1686
+ package: packageAddress,
1687
+ module: 'account',
1688
+ function: 'borrow_data_mut',
1689
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1690
+ typeArguments: options.typeArguments
1691
+ });
1692
+ }
1693
+ export function hasData(options) {
1694
+ const packageAddress = options.package ?? '@waterx/account';
1695
+ const argumentsTypes = [
1696
+ null,
1697
+ '0x2::object::ID'
1698
+ ];
1699
+ const parameterNames = ["registry", "accountId"];
1700
+ return (tx) => tx.moveCall({
1701
+ package: packageAddress,
1702
+ module: 'account',
1703
+ function: 'has_data',
1704
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1705
+ typeArguments: options.typeArguments
1706
+ });
1707
+ }
1708
+ export function removeData(options) {
1709
+ const packageAddress = options.package ?? '@waterx/account';
1710
+ const argumentsTypes = [
1711
+ null,
1712
+ '0x2::object::ID',
1713
+ `${options.typeArguments[0]}`
1714
+ ];
1715
+ const parameterNames = ["registry", "accountId", "Witness"];
1716
+ return (tx) => tx.moveCall({
1717
+ package: packageAddress,
1718
+ module: 'account',
1719
+ function: 'remove_data',
1720
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1721
+ typeArguments: options.typeArguments
1722
+ });
1723
+ }