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