@waterx/sdk 2.4.1 → 3.0.1

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 (226) hide show
  1. package/README.md +25 -21
  2. package/dist/src/{utils → account}/account-request.d.ts +2 -2
  3. package/dist/src/{user → account}/account.d.ts +23 -21
  4. package/dist/src/{user → account}/account.js +5 -5
  5. package/dist/src/account/client.d.ts +42 -0
  6. package/dist/src/account/client.js +17 -0
  7. package/dist/src/account/config.d.ts +151 -0
  8. package/dist/src/account/config.js +8 -0
  9. package/dist/src/account/constants.d.ts +5 -0
  10. package/dist/src/account/constants.js +5 -0
  11. package/dist/src/account/fetch/referral.d.ts +15 -0
  12. package/dist/src/account/fetch/referral.js +51 -0
  13. package/dist/src/account/fetch/simulate.d.ts +34 -0
  14. package/dist/src/account/fetch/simulate.js +43 -0
  15. package/dist/src/{utils/consolidate-balance.d.ts → account/funding/balance.d.ts} +3 -8
  16. package/dist/src/{utils/consolidate-balance.js → account/funding/balance.js} +6 -1
  17. package/dist/src/account/funding/consolidate.d.ts +46 -0
  18. package/dist/src/account/funding/consolidate.js +137 -0
  19. package/dist/src/{user → account/funding}/credit.d.ts +10 -10
  20. package/dist/src/{user → account/funding}/credit.js +6 -6
  21. package/dist/src/{user → account/funding}/custody.d.ts +4 -4
  22. package/dist/src/{user → account/funding}/custody.js +2 -2
  23. package/dist/src/{utils → account/funding}/wormhole.d.ts +4 -4
  24. package/dist/src/{utils → account/funding}/wormhole.js +1 -1
  25. package/dist/src/account/index.d.ts +29 -0
  26. package/dist/src/account/index.js +29 -0
  27. package/dist/src/{user → account}/referral.d.ts +3 -3
  28. package/dist/src/{user → account}/referral.js +1 -1
  29. package/dist/src/base-client.d.ts +74 -0
  30. package/dist/src/base-client.js +97 -0
  31. package/dist/src/constants.d.ts +4 -46
  32. package/dist/src/constants.js +8 -52
  33. package/dist/src/generated/bucket_v2_framework/liability.d.ts +0 -26
  34. package/dist/src/generated/bucket_v2_framework/liability.js +0 -28
  35. package/dist/src/generated/waterx_account/account.d.ts +50 -15
  36. package/dist/src/generated/waterx_account/account.js +51 -15
  37. package/dist/src/generated/waterx_oracle/oracle.d.ts +7 -1
  38. package/dist/src/generated/waterx_oracle/oracle.js +7 -2
  39. package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.d.ts +19 -2
  40. package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.d.ts +3 -1
  41. package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/sui/balance.d.ts +3 -1
  42. package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.d.ts +6 -1
  43. package/dist/src/generated/waterx_prediction/events.d.ts +288 -0
  44. package/dist/src/{prediction/generated → generated}/waterx_prediction/events.js +39 -0
  45. package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.d.ts +6 -1
  46. package/dist/src/{prediction/generated → generated}/waterx_prediction/order.d.ts +34 -1
  47. package/dist/src/{prediction/generated → generated}/waterx_prediction/position.d.ts +16 -1
  48. package/dist/src/{prediction/generated → generated}/waterx_prediction/view.d.ts +69 -4
  49. package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.d.ts +162 -2
  50. package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.js +99 -0
  51. package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +102 -0
  52. package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +99 -0
  53. package/dist/src/generated/waterx_supra_rule/supra_rule.d.ts +5 -5
  54. package/dist/src/generated/waterx_supra_rule/supra_rule.js +1 -2
  55. package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +23 -23
  56. package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +3 -6
  57. package/dist/src/oracle/aggregate.d.ts +74 -0
  58. package/dist/src/oracle/aggregate.js +112 -0
  59. package/dist/src/oracle/config.d.ts +99 -0
  60. package/dist/src/oracle/config.js +23 -0
  61. package/dist/src/oracle/host.d.ts +32 -0
  62. package/dist/src/oracle/host.js +10 -0
  63. package/dist/src/oracle/index.d.ts +16 -0
  64. package/dist/src/oracle/index.js +18 -0
  65. package/dist/src/oracle/pyth.d.ts +52 -0
  66. package/dist/src/oracle/pyth.js +220 -0
  67. package/dist/src/oracle/rules/constant-rule.d.ts +9 -0
  68. package/dist/src/oracle/rules/constant-rule.js +14 -0
  69. package/dist/src/oracle/rules/pyth-rule.d.ts +11 -0
  70. package/dist/src/oracle/rules/pyth-rule.js +20 -0
  71. package/dist/src/oracle/rules/sponsor.d.ts +28 -0
  72. package/dist/src/oracle/rules/sponsor.js +48 -0
  73. package/dist/src/oracle/rules/supra-rule.d.ts +11 -0
  74. package/dist/src/oracle/rules/supra-rule.js +22 -0
  75. package/dist/src/perp/client.d.ts +78 -0
  76. package/dist/src/perp/client.js +108 -0
  77. package/dist/src/{client.d.ts → perp/config-view.d.ts} +15 -60
  78. package/dist/src/{client.js → perp/config-view.js} +23 -95
  79. package/dist/src/perp/config.d.ts +126 -0
  80. package/dist/src/{config.js → perp/config.js} +11 -12
  81. package/dist/src/perp/constants.d.ts +49 -0
  82. package/dist/src/perp/constants.js +61 -0
  83. package/dist/src/perp/fetch/account.d.ts +43 -0
  84. package/dist/src/perp/fetch/account.js +64 -0
  85. package/dist/src/perp/fetch/bridge.d.ts +90 -0
  86. package/dist/src/perp/fetch/bridge.js +127 -0
  87. package/dist/src/perp/fetch/custody.d.ts +32 -0
  88. package/dist/src/perp/fetch/custody.js +62 -0
  89. package/dist/src/perp/fetch/market.d.ts +30 -0
  90. package/dist/src/perp/fetch/market.js +68 -0
  91. package/dist/src/perp/fetch/positions.d.ts +70 -0
  92. package/dist/src/perp/fetch/positions.js +185 -0
  93. package/dist/src/perp/fetch/simulate.d.ts +12 -0
  94. package/dist/src/perp/fetch/simulate.js +13 -0
  95. package/dist/src/perp/fetch.d.ts +23 -0
  96. package/dist/src/perp/fetch.js +23 -0
  97. package/dist/src/{index.d.ts → perp/index.d.ts} +21 -21
  98. package/dist/src/{index.js → perp/index.js} +21 -21
  99. package/dist/src/perp/tx-builders/common.d.ts +83 -0
  100. package/dist/src/perp/tx-builders/common.js +70 -0
  101. package/dist/src/perp/tx-builders/credit.d.ts +65 -0
  102. package/dist/src/perp/tx-builders/credit.js +62 -0
  103. package/dist/src/perp/tx-builders/rewards.d.ts +30 -0
  104. package/dist/src/perp/tx-builders/rewards.js +34 -0
  105. package/dist/src/perp/tx-builders/trading.d.ts +51 -0
  106. package/dist/src/perp/tx-builders/trading.js +59 -0
  107. package/dist/src/perp/tx-builders/wlp.d.ts +90 -0
  108. package/dist/src/perp/tx-builders/wlp.js +120 -0
  109. package/dist/src/perp/tx-builders.d.ts +23 -0
  110. package/dist/src/perp/tx-builders.js +23 -0
  111. package/dist/src/perp/user/index.d.ts +8 -0
  112. package/dist/src/perp/user/index.js +8 -0
  113. package/dist/src/{user → perp/user}/order.d.ts +7 -7
  114. package/dist/src/{user → perp/user}/order.js +3 -3
  115. package/dist/src/{user → perp/user}/staking.d.ts +4 -4
  116. package/dist/src/{user → perp/user}/staking.js +2 -2
  117. package/dist/src/{user → perp/user}/trading.d.ts +13 -13
  118. package/dist/src/{user → perp/user}/trading.js +2 -2
  119. package/dist/src/{user → perp/user}/wlp.d.ts +7 -7
  120. package/dist/src/{user → perp/user}/wlp.js +3 -3
  121. package/dist/src/prediction/account.js +40 -76
  122. package/dist/src/prediction/bcs.d.ts +15 -9
  123. package/dist/src/prediction/bcs.js +17 -81
  124. package/dist/src/prediction/client.d.ts +8 -38
  125. package/dist/src/prediction/client.js +11 -67
  126. package/dist/src/prediction/config.d.ts +16 -2
  127. package/dist/src/prediction/config.js +10 -4
  128. package/dist/src/prediction/gift.js +2 -10
  129. package/dist/src/prediction/index.d.ts +11 -11
  130. package/dist/src/prediction/index.js +10 -10
  131. package/dist/src/prediction/prediction.d.ts +45 -0
  132. package/dist/src/prediction/prediction.js +71 -0
  133. package/dist/src/prediction/tx-builders.d.ts +4 -4
  134. package/dist/src/prediction/tx-builders.js +2 -2
  135. package/dist/src/prediction/types.d.ts +2 -0
  136. package/dist/src/prediction/user/index.d.ts +2 -2
  137. package/dist/src/prediction/user/index.js +1 -1
  138. package/dist/src/prediction/user/position.d.ts +2 -2
  139. package/dist/src/prediction/user/position.js +1 -1
  140. package/dist/src/prediction/utils/bcs.d.ts +5 -0
  141. package/dist/src/prediction/utils/bcs.js +5 -0
  142. package/dist/src/prediction/utils/index.d.ts +7 -0
  143. package/dist/src/prediction/utils/index.js +7 -0
  144. package/dist/src/sdk.d.ts +10 -6
  145. package/dist/src/sdk.js +9 -5
  146. package/dist/src/unified-client.d.ts +140 -145
  147. package/dist/src/unified-client.js +98 -40
  148. package/dist/src/utils/config.d.ts +1 -1
  149. package/package.json +22 -5
  150. package/dist/src/config.d.ts +0 -292
  151. package/dist/src/fetch.d.ts +0 -254
  152. package/dist/src/fetch.js +0 -564
  153. package/dist/src/prediction/generated/bucket_v2_framework/account.d.ts +0 -100
  154. package/dist/src/prediction/generated/bucket_v2_framework/account.js +0 -129
  155. package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.d.ts +0 -6
  156. package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.js +0 -19
  157. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.d.ts +0 -10
  158. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +0 -36
  159. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.js +0 -27
  160. package/dist/src/prediction/generated/bucket_v2_framework/double.d.ts +0 -382
  161. package/dist/src/prediction/generated/bucket_v2_framework/double.js +0 -466
  162. package/dist/src/prediction/generated/bucket_v2_framework/float.d.ts +0 -362
  163. package/dist/src/prediction/generated/bucket_v2_framework/float.js +0 -440
  164. package/dist/src/prediction/generated/bucket_v2_framework/liability.d.ts +0 -193
  165. package/dist/src/prediction/generated/bucket_v2_framework/liability.js +0 -205
  166. package/dist/src/prediction/generated/bucket_v2_framework/linked_table.d.ts +0 -384
  167. package/dist/src/prediction/generated/bucket_v2_framework/linked_table.js +0 -382
  168. package/dist/src/prediction/generated/bucket_v2_framework/sheet.d.ts +0 -344
  169. package/dist/src/prediction/generated/bucket_v2_framework/sheet.js +0 -338
  170. package/dist/src/prediction/generated/utils/index.d.ts +0 -30
  171. package/dist/src/prediction/generated/utils/index.js +0 -160
  172. package/dist/src/prediction/generated/waterx_account/account.d.ts +0 -1589
  173. package/dist/src/prediction/generated/waterx_account/account.js +0 -1758
  174. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +0 -7
  175. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.js +0 -13
  176. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +0 -7
  177. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.js +0 -16
  178. package/dist/src/prediction/generated/waterx_account/deps/std/type_name.d.ts +0 -6
  179. package/dist/src/prediction/generated/waterx_account/deps/std/type_name.js +0 -19
  180. package/dist/src/prediction/generated/waterx_account/deps/sui/balance.d.ts +0 -10
  181. package/dist/src/prediction/generated/waterx_account/deps/sui/balance.js +0 -14
  182. package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.d.ts +0 -12
  183. package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.js +0 -19
  184. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.d.ts +0 -36
  185. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.js +0 -27
  186. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.d.ts +0 -16
  187. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.js +0 -19
  188. package/dist/src/prediction/generated/waterx_account/direct_rule.d.ts +0 -75
  189. package/dist/src/prediction/generated/waterx_account/direct_rule.js +0 -78
  190. package/dist/src/prediction/generated/waterx_account/events.d.ts +0 -33
  191. package/dist/src/prediction/generated/waterx_account/events.js +0 -137
  192. package/dist/src/prediction/generated/waterx_account/version.js +0 -8
  193. package/dist/src/prediction/generated/waterx_prediction/bet_sharing.d.ts +0 -60
  194. package/dist/src/prediction/generated/waterx_prediction/bet_sharing.js +0 -83
  195. package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.js +0 -14
  196. package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.d.ts +0 -24
  197. package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.js +0 -31
  198. package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.d.ts +0 -16
  199. package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.js +0 -19
  200. package/dist/src/prediction/generated/waterx_prediction/events.d.ts +0 -22
  201. package/dist/src/prediction/generated/waterx_prediction/version.d.ts +0 -10
  202. package/dist/src/tx-builders.d.ts +0 -296
  203. package/dist/src/tx-builders.js +0 -461
  204. package/dist/src/user/index.d.ts +0 -8
  205. package/dist/src/user/index.js +0 -8
  206. package/dist/src/utils/pyth.d.ts +0 -124
  207. package/dist/src/utils/pyth.js +0 -392
  208. /package/dist/src/{utils → account}/account-request.js +0 -0
  209. /package/dist/src/{core → account}/waterx-account.d.ts +0 -0
  210. /package/dist/src/{core → account}/waterx-account.js +0 -0
  211. /package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.js +0 -0
  212. /package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.js +0 -0
  213. /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +0 -0
  214. /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.js +0 -0
  215. /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/balance.js +0 -0
  216. /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.js +0 -0
  217. /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.d.ts +0 -0
  218. /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.js +0 -0
  219. /package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.js +0 -0
  220. /package/dist/src/{prediction/generated → generated}/waterx_prediction/order.js +0 -0
  221. /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.d.ts +0 -0
  222. /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.js +0 -0
  223. /package/dist/src/{prediction/generated → generated}/waterx_prediction/position.js +0 -0
  224. /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/version.d.ts +0 -0
  225. /package/dist/src/{prediction/generated → generated}/waterx_prediction/version.js +0 -0
  226. /package/dist/src/{prediction/generated → generated}/waterx_prediction/view.js +0 -0
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Shared transport base for the two product-line clients (`PerpClient`,
3
+ * `PredictClient`).
4
+ *
5
+ * Holds the half that is identical across both lines: the gRPC client
6
+ * construction (network + URL resolution), the read-only gRPC convenience
7
+ * wrappers, `simulate` / `signAndExecuteTransaction`, and the `packageIds()`
8
+ * lookup. The config-schema half (per-line typed lookups like `getMarket` /
9
+ * `marketRegistry`) legitimately differs and lives on each subclass.
10
+ *
11
+ * `Cfg` is the line's parsed `waterx-config` JSON type. Only the fields needed
12
+ * here are constrained ({@link BaseLineConfig}); each subclass narrows `Cfg` to
13
+ * its full config type so `this.config` stays precisely typed.
14
+ */
15
+ import { SuiGrpcClient } from "@mysten/sui/grpc";
16
+ /** Default Sui gRPC base URLs by network (public Mysten fullnodes). */
17
+ export const DEFAULT_GRPC_URLS = {
18
+ MAINNET: "https://fullnode.mainnet.sui.io:443",
19
+ TESTNET: "https://fullnode.testnet.sui.io:443",
20
+ };
21
+ function isPublishedPackage(value) {
22
+ return (!!value &&
23
+ typeof value === "object" &&
24
+ "published_at" in value &&
25
+ typeof value.published_at === "string" &&
26
+ value.published_at.length > 0);
27
+ }
28
+ export class BaseLineClient {
29
+ /** gRPC client — all RPC including `simulateTransaction`. */
30
+ grpcClient;
31
+ /** Network identifier in upper case (`MAINNET` / `TESTNET`). */
32
+ network;
33
+ /** Parsed canonical `waterx-config` JSON for this line. */
34
+ config;
35
+ constructor(network, config, opts = {}) {
36
+ this.network = network;
37
+ this.config = config;
38
+ const grpcUrl = opts.grpcUrl ?? config.grpcUrl ?? DEFAULT_GRPC_URLS[network];
39
+ this.grpcClient = new SuiGrpcClient({
40
+ baseUrl: grpcUrl,
41
+ network: network.toLowerCase(),
42
+ });
43
+ }
44
+ // ========================================================
45
+ // gRPC convenience wrappers
46
+ // ========================================================
47
+ getObject(objectId) {
48
+ return this.grpcClient.getObject({ objectId });
49
+ }
50
+ getObjects(objectIds) {
51
+ return this.grpcClient.getObjects({ objectIds });
52
+ }
53
+ listOwnedObjects(owner) {
54
+ return this.grpcClient.listOwnedObjects({ owner });
55
+ }
56
+ listCoins(params) {
57
+ return this.grpcClient.listCoins(params);
58
+ }
59
+ getBalance(params) {
60
+ return this.grpcClient.getBalance(params);
61
+ }
62
+ listDynamicFields(parentId) {
63
+ return this.grpcClient.listDynamicFields({ parentId });
64
+ }
65
+ getDynamicField(parentId, name) {
66
+ return this.grpcClient.getDynamicField({ parentId, name });
67
+ }
68
+ waitForTransaction(digest) {
69
+ return this.grpcClient.waitForTransaction({ digest });
70
+ }
71
+ /**
72
+ * Simulate a transaction (no signing). Subclasses may override to add
73
+ * transport policy (e.g. the prediction line wraps this with rate-limit
74
+ * retry against the public testnet RPC).
75
+ */
76
+ async simulate(tx) {
77
+ return this.grpcClient.simulateTransaction({
78
+ transaction: tx,
79
+ include: { commandResults: true },
80
+ });
81
+ }
82
+ async signAndExecuteTransaction(params) {
83
+ return this.grpcClient.signAndExecuteTransaction(params);
84
+ }
85
+ // ========================================================
86
+ // Shared config lookup
87
+ // ========================================================
88
+ /** All package IDs (`published_at`) keyed by package name. */
89
+ packageIds() {
90
+ const out = {};
91
+ for (const [name, pkg] of Object.entries(this.config.packages)) {
92
+ if (isPublishedPackage(pkg))
93
+ out[name] = pkg.published_at;
94
+ }
95
+ return out;
96
+ }
97
+ }
@@ -23,52 +23,10 @@ export declare const TOKEN_DECIMALS: {
23
23
  readonly USDSUI: 6;
24
24
  readonly WLP: 6;
25
25
  };
26
- /** Default crypto market trading fee rate (3 bps). Per-market value lives in MarketConfig. */
27
- export declare const CRYPTO_FEE_RATE = 0.0003;
28
- /** Default stock / commodity market trading fee rate (5 bps). Per-market value lives in MarketConfig. */
29
- export declare const STOCK_FEE_RATE = 0.0005;
30
- /** Default maintenance margin rate (150 bps = 1.5%). Per-market value lives in MarketConfig. */
31
- export declare const MAINTENANCE_MARGIN_RATE = 0.015;
32
- export declare const PERM_OPEN_POSITION = 1;
33
- export declare const PERM_CLOSE_POSITION = 2;
34
- export declare const PERM_INCREASE_POSITION = 4;
35
- export declare const PERM_DECREASE_POSITION = 8;
36
- export declare const PERM_PLACE_ORDER = 16;
37
- export declare const PERM_CANCEL_ORDER = 32;
38
- export declare const PERM_DEPOSIT_COLLATERAL = 64;
39
- export declare const PERM_WITHDRAW_COLLATERAL = 128;
40
- export declare const PERM_MINT_WLP = 256;
41
- export declare const PERM_REDEEM_WLP = 512;
42
- export declare const PERM_ALL_TRADING = 255;
43
- export declare const PERM_ALL = 65535;
44
- export declare const STAKING_PERM_DEPOSIT_STAKE: number;
45
- export declare const STAKING_PERM_REDEEM_STAKE: number;
46
- export declare const STAKING_PERM_CLAIM_REWARD: number;
47
- export declare const STAKING_PERM_ALL: number;
48
- export declare const ORDER_LIMIT_BUY = 0;
49
- export declare const ORDER_LIMIT_SELL = 1;
50
- export declare const ORDER_STOP_BUY = 2;
51
- export declare const ORDER_STOP_SELL = 3;
52
- /** Wildcard tag accepted by `cancel_order_request` — scans all 4 books. */
53
- export declare const ORDER_TAG_WILDCARD = 255;
54
- export declare const ACTION_OPEN_POSITION = 0;
55
- export declare const ACTION_CLOSE_POSITION = 1;
56
- export declare const ACTION_PLACE_ORDER = 2;
57
- export declare const ACTION_CANCEL_ORDER = 3;
58
- export declare const ACTION_DEPOSIT_COLLATERAL = 4;
59
- export declare const ACTION_WITHDRAW_COLLATERAL = 5;
60
- export declare const ACTION_LIQUIDATE = 6;
61
- export declare const ACTION_INCREASE_POSITION = 7;
62
- export declare const ACTION_DECREASE_POSITION = 8;
63
- export declare const ACTION_UPDATE_ORDER = 9;
64
- export declare const ACTION_CANCEL_PRE_ORDER = 10;
65
- export declare const ACTION_ADD_PRE_ORDER = 11;
66
26
  export declare const MS_PER_YEAR: number;
67
- /** Zero-address placeholder used as the sender in dry-run / simulate calls. */
68
- export declare const DRY_RUN_SENDER = "0x0000000000000000000000000000000000000000000000000000000000000000";
69
27
  /**
70
- * Well-known address of Sui's native funds-accumulator root shared object
71
- * (`@0xacc` in the framework). Pass this to `request_deposit_from_funds<T>`
72
- * to drain `Balance<T>` parked at an account's address.
28
+ * Zero-address placeholder used as the sender in dry-run / simulate calls.
29
+ * Line-agnostic (every read path simulates with it); re-exported from
30
+ * `perp/constants.ts` for back-compat.
73
31
  */
74
- export declare const ACCUMULATOR_ROOT = "0xacc";
32
+ export declare const DRY_RUN_SENDER = "0x0000000000000000000000000000000000000000000000000000000000000000";
@@ -1,3 +1,6 @@
1
+ // Shared, line-agnostic primitives (network id, scaling, decimals, time).
2
+ // Perp-domain enums (permissions / order tags / action codes / fee rates) live
3
+ // in `perp/constants.ts`; prediction has its own `prediction/constants.ts`.
1
4
  // ======== Scaling ========
2
5
  /** Basis-point denominator (10_000). Matches BP_SCALE in the Move contracts. */
3
6
  export const BPS_SCALE = 10000n;
@@ -24,59 +27,12 @@ export const TOKEN_DECIMALS = {
24
27
  USDSUI: COLLATERAL_DECIMALS,
25
28
  WLP: WLP_DECIMALS,
26
29
  };
27
- // ======== Fee rates & risk parameters ========
28
- /** Default crypto market trading fee rate (3 bps). Per-market value lives in MarketConfig. */
29
- export const CRYPTO_FEE_RATE = 0.0003;
30
- /** Default stock / commodity market trading fee rate (5 bps). Per-market value lives in MarketConfig. */
31
- export const STOCK_FEE_RATE = 0.0005;
32
- /** Default maintenance margin rate (150 bps = 1.5%). Per-market value lives in MarketConfig. */
33
- export const MAINTENANCE_MARGIN_RATE = 0.015;
34
- // ======== Permission Bitmasks (matches account_data.move) ========
35
- export const PERM_OPEN_POSITION = 1;
36
- export const PERM_CLOSE_POSITION = 2;
37
- export const PERM_INCREASE_POSITION = 4;
38
- export const PERM_DECREASE_POSITION = 8;
39
- export const PERM_PLACE_ORDER = 16;
40
- export const PERM_CANCEL_ORDER = 32;
41
- export const PERM_DEPOSIT_COLLATERAL = 64;
42
- export const PERM_WITHDRAW_COLLATERAL = 128;
43
- export const PERM_MINT_WLP = 256;
44
- export const PERM_REDEEM_WLP = 512;
45
- export const PERM_ALL_TRADING = 0xff;
46
- export const PERM_ALL = 0xffff;
47
- // ======== Staking Permission Bitmasks (matches waterx_staking.move) ========
48
- export const STAKING_PERM_DEPOSIT_STAKE = 1 << 0;
49
- export const STAKING_PERM_REDEEM_STAKE = 1 << 1;
50
- export const STAKING_PERM_CLAIM_REWARD = 1 << 2;
51
- export const STAKING_PERM_ALL = STAKING_PERM_DEPOSIT_STAKE | STAKING_PERM_REDEEM_STAKE | STAKING_PERM_CLAIM_REWARD;
52
- // ======== Order Type Tags ========
53
- export const ORDER_LIMIT_BUY = 0;
54
- export const ORDER_LIMIT_SELL = 1;
55
- export const ORDER_STOP_BUY = 2;
56
- export const ORDER_STOP_SELL = 3;
57
- /** Wildcard tag accepted by `cancel_order_request` — scans all 4 books. */
58
- export const ORDER_TAG_WILDCARD = 255;
59
- // ======== Action Type Constants (request.move) ========
60
- export const ACTION_OPEN_POSITION = 0;
61
- export const ACTION_CLOSE_POSITION = 1;
62
- export const ACTION_PLACE_ORDER = 2;
63
- export const ACTION_CANCEL_ORDER = 3;
64
- export const ACTION_DEPOSIT_COLLATERAL = 4;
65
- export const ACTION_WITHDRAW_COLLATERAL = 5;
66
- export const ACTION_LIQUIDATE = 6;
67
- export const ACTION_INCREASE_POSITION = 7;
68
- export const ACTION_DECREASE_POSITION = 8;
69
- export const ACTION_UPDATE_ORDER = 9;
70
- export const ACTION_CANCEL_PRE_ORDER = 10;
71
- export const ACTION_ADD_PRE_ORDER = 11;
72
30
  // ======== Time ========
73
31
  export const MS_PER_YEAR = 365 * 24 * 60 * 60 * 1000;
74
- // ======== Misc ========
75
- /** Zero-address placeholder used as the sender in dry-run / simulate calls. */
76
- export const DRY_RUN_SENDER = "0x0000000000000000000000000000000000000000000000000000000000000000";
32
+ // ======== Well-known addresses ========
77
33
  /**
78
- * Well-known address of Sui's native funds-accumulator root shared object
79
- * (`@0xacc` in the framework). Pass this to `request_deposit_from_funds<T>`
80
- * to drain `Balance<T>` parked at an account's address.
34
+ * Zero-address placeholder used as the sender in dry-run / simulate calls.
35
+ * Line-agnostic (every read path simulates with it); re-exported from
36
+ * `perp/constants.ts` for back-compat.
81
37
  */
82
- export const ACCUMULATOR_ROOT = "0xacc";
38
+ export const DRY_RUN_SENDER = "0x0000000000000000000000000000000000000000000000000000000000000000";
@@ -169,29 +169,3 @@ export interface DebtValueOptions {
169
169
  ];
170
170
  }
171
171
  export declare function debtValue(options: DebtValueOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
172
- export interface DestroyCreditForTestingArguments {
173
- credit: TransactionArgument;
174
- }
175
- export interface DestroyCreditForTestingOptions {
176
- package?: string;
177
- arguments: DestroyCreditForTestingArguments | [
178
- credit: TransactionArgument
179
- ];
180
- typeArguments: [
181
- string
182
- ];
183
- }
184
- export declare function destroyCreditForTesting(options: DestroyCreditForTestingOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
185
- export interface DestroyDebtForTestingArguments {
186
- debt: TransactionArgument;
187
- }
188
- export interface DestroyDebtForTestingOptions {
189
- package?: string;
190
- arguments: DestroyDebtForTestingArguments | [
191
- debt: TransactionArgument
192
- ];
193
- typeArguments: [
194
- string
195
- ];
196
- }
197
- export declare function destroyDebtForTesting(options: DestroyDebtForTestingOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -175,31 +175,3 @@ export function debtValue(options) {
175
175
  typeArguments: options.typeArguments
176
176
  });
177
177
  }
178
- export function destroyCreditForTesting(options) {
179
- const packageAddress = options.package ?? '@bucket/framework';
180
- const argumentsTypes = [
181
- null
182
- ];
183
- const parameterNames = ["credit"];
184
- return (tx) => tx.moveCall({
185
- package: packageAddress,
186
- module: 'liability',
187
- function: 'destroy_credit_for_testing',
188
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
189
- typeArguments: options.typeArguments
190
- });
191
- }
192
- export function destroyDebtForTesting(options) {
193
- const packageAddress = options.package ?? '@bucket/framework';
194
- const argumentsTypes = [
195
- null
196
- ];
197
- const parameterNames = ["debt"];
198
- return (tx) => tx.moveCall({
199
- package: packageAddress,
200
- module: 'liability',
201
- function: 'destroy_debt_for_testing',
202
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
203
- typeArguments: options.typeArguments
204
- });
205
- }
@@ -220,7 +220,16 @@ export declare const ProtocolDataKey: MoveTuple<readonly [BcsType<boolean, boole
220
220
  export declare const Delegate: MoveStruct<{
221
221
  delegate_address: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
222
222
  alias: BcsType<string, string, "string">;
223
- /** Framework-level action bitmap (PERM_WITHDRAW etc). */
223
+ /**
224
+ * Framework-level action bitmap (`PERM_WITHDRAW`, `PERM_RECEIVE`,
225
+ * `PERM_MANAGE_DELEGATES`). **Vestigial — retained for ABI/bitmap stability but no
226
+ * longer the live authority for any path.** All three bits now gate nothing: the
227
+ * funds-out paths (`request_withdraw` / `withdraw_from_funds` / `receive`) and
228
+ * delegate-perm management (`set/unset_delegate_protocol_permission`) are
229
+ * owner-only. Delegate authority lives entirely in `protocol_permissions` below
230
+ * plus the per-account `take`/`put` gate. `effective_permissions` /
231
+ * `has_permission` remain as public views but no internal path consults them.
232
+ */
224
233
  permissions: BcsType<number, number, "u32">;
225
234
  /**
226
235
  * Per-protocol bitmap. Missing key → delegate cannot drive that protocol. Each
@@ -1181,8 +1190,9 @@ export interface RequestWithdrawOptions {
1181
1190
  }
1182
1191
  /**
1183
1192
  * Debits `amount` of the account's stored `Balance<T>` and packages it into a
1184
- * `WithdrawRequest<T>` for the registered withdraw policy. Auth (`PERM_WITHDRAW`
1185
- * on `T`'s account) and pause are checked here, not in `consume_withdraw`.
1193
+ * `WithdrawRequest<T>` for the registered withdraw policy. Auth (owner-only — see
1194
+ * the gate below; `PERM_WITHDRAW` delegates are rejected) and pause are checked
1195
+ * here, not in `consume_withdraw`.
1186
1196
  */
1187
1197
  export declare function requestWithdraw(options: RequestWithdrawOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1188
1198
  export interface ConsumeWithdrawArguments<P extends BcsType<any>> {
@@ -1229,9 +1239,9 @@ export interface TransferCoinOptions {
1229
1239
  * TTOs a `Coin<T>` to the account's UID address. The coin sits there until someone
1230
1240
  * calls `request_deposit_from_receivings<T>` (which requires a registered deposit
1231
1241
  * policy that then folds the coin into the account's stored balance) or
1232
- * `receive<Coin<T>>` (owner / `PERM_RECEIVE` delegate, no policy needed). Useful
1233
- * for async / cross-PTB deposits and for routing protocol payouts (e.g. reward
1234
- * claims) into an account when `T` has no deposit policy.
1242
+ * `receive<Coin<T>>` (owner-only, no policy needed). Useful for async / cross-PTB
1243
+ * deposits and for routing protocol payouts (e.g. reward claims) into an account
1244
+ * when `T` has no deposit policy.
1235
1245
  */
1236
1246
  export declare function transferCoin(options: TransferCoinOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1237
1247
  export interface ReceiveArguments {
@@ -1264,9 +1274,10 @@ export interface ReceiveOptions {
1264
1274
  * `request_deposit_from_receivings<X>` or `request_deposit_from_funds<X>` for
1265
1275
  * inflow when X has a deposit policy.
1266
1276
  *
1267
- * Auth: account owner or a `PERM_RECEIVE` delegate (kept separate from
1268
- * `PERM_WITHDRAW` so reward-collection rights don't imply balance-drain rights).
1269
- * Returns the received object to the caller's PTB.
1277
+ * Auth: account owner only. Receiving a TTO'd object hands it to the caller's PTB
1278
+ * an off-platform exfil path so a delegate can never drive it, even one
1279
+ * holding `PERM_RECEIVE`. The `PERM_RECEIVE` bit is retained for ABI stability but
1280
+ * no longer gates any path. Returns the received object to the caller's PTB.
1270
1281
  */
1271
1282
  export declare function receive(options: ReceiveOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1272
1283
  export interface WithdrawFromFundsArguments {
@@ -1292,13 +1303,15 @@ export interface WithdrawFromFundsOptions {
1292
1303
  * native funds accumulator and returns it directly as a `Balance<T>`. Symmetric to
1293
1304
  * `request_deposit_from_funds<T>`, but explicitly for `T` that has **no**
1294
1305
  * registered deposit policy — policy-managed inflow must route through the
1295
- * deposit-policy pipeline instead. The intent is to let owners (or `PERM_WITHDRAW`
1296
- * delegates) pull policy-less inflow (reward tokens TTO'd via `send_funds`,
1297
- * miscellaneous `Balance<T>` the SDK parked at the address) straight out.
1306
+ * deposit-policy pipeline instead. The intent is to let the account owner pull
1307
+ * policy-less inflow (reward tokens TTO'd via `send_funds`, miscellaneous
1308
+ * `Balance<T>` the SDK parked at the address) straight out.
1298
1309
  *
1299
- * Auth: same as `request_withdraw<T>` — `PERM_WITHDRAW` or owner. Aborts
1300
- * `EUseRequestDepositInstead` if `T` has a deposit policy registered. Pause-gated.
1301
- * Returns `Balance::zero<T>()` when the address holds no T.
1310
+ * Auth: same as `request_withdraw<T>` — owner-only. A delegate is rejected even
1311
+ * one holding `PERM_WITHDRAW` (the bit no longer gates this path; retained for ABI
1312
+ * stability only). Aborts `EUseRequestDepositInstead` if `T` has a deposit policy
1313
+ * registered. Pause-gated. Returns `Balance::zero<T>()` when the address holds no
1314
+ * T.
1302
1315
  */
1303
1316
  export declare function withdrawFromFunds(options: WithdrawFromFundsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1304
1317
  export interface TakeArguments<P extends BcsType<any>> {
@@ -1401,6 +1414,28 @@ export interface IsAccountAuthorizedOptions {
1401
1414
  * top of this.
1402
1415
  */
1403
1416
  export declare function isAccountAuthorized(options: IsAccountAuthorizedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1417
+ export interface IsAccountOwnerArguments {
1418
+ registry: RawTransactionArgument<string>;
1419
+ accountId: RawTransactionArgument<string>;
1420
+ addr: RawTransactionArgument<string>;
1421
+ }
1422
+ export interface IsAccountOwnerOptions {
1423
+ package?: string;
1424
+ arguments: IsAccountOwnerArguments | [
1425
+ registry: RawTransactionArgument<string>,
1426
+ accountId: RawTransactionArgument<string>,
1427
+ addr: RawTransactionArgument<string>
1428
+ ];
1429
+ }
1430
+ /**
1431
+ * Returns `true` only when `addr` is the account's **owner** — delegates are
1432
+ * excluded regardless of their permission bits or expiry. Protocols use this for
1433
+ * owner-only actions that must never be delegate-driven (e.g. collateral
1434
+ * withdrawal): defense-in-depth so a phished or compromised delegate key can never
1435
+ * move funds, only the owner's own signature can. Contrast `is_account_authorized`
1436
+ * (owner OR live delegate).
1437
+ */
1438
+ export declare function isAccountOwner(options: IsAccountOwnerOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1404
1439
  export interface AccountCountArguments {
1405
1440
  registry: RawTransactionArgument<string>;
1406
1441
  owner: RawTransactionArgument<string>;
@@ -111,7 +111,16 @@ export const ProtocolDataKey = new MoveTuple({ name: `${$moduleName}::ProtocolDa
111
111
  export const Delegate = new MoveStruct({ name: `${$moduleName}::Delegate`, fields: {
112
112
  delegate_address: bcs.Address,
113
113
  alias: bcs.string(),
114
- /** Framework-level action bitmap (PERM_WITHDRAW etc). */
114
+ /**
115
+ * Framework-level action bitmap (`PERM_WITHDRAW`, `PERM_RECEIVE`,
116
+ * `PERM_MANAGE_DELEGATES`). **Vestigial — retained for ABI/bitmap stability but no
117
+ * longer the live authority for any path.** All three bits now gate nothing: the
118
+ * funds-out paths (`request_withdraw` / `withdraw_from_funds` / `receive`) and
119
+ * delegate-perm management (`set/unset_delegate_protocol_permission`) are
120
+ * owner-only. Delegate authority lives entirely in `protocol_permissions` below
121
+ * plus the per-account `take`/`put` gate. `effective_permissions` /
122
+ * `has_permission` remain as public views but no internal path consults them.
123
+ */
115
124
  permissions: bcs.u32(),
116
125
  /**
117
126
  * Per-protocol bitmap. Missing key → delegate cannot drive that protocol. Each
@@ -1023,8 +1032,9 @@ export function consumeDeposit(options) {
1023
1032
  }
1024
1033
  /**
1025
1034
  * 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`.
1035
+ * `WithdrawRequest<T>` for the registered withdraw policy. Auth (owner-only — see
1036
+ * the gate below; `PERM_WITHDRAW` delegates are rejected) and pause are checked
1037
+ * here, not in `consume_withdraw`.
1028
1038
  */
1029
1039
  export function requestWithdraw(options) {
1030
1040
  const packageAddress = options.package ?? '@waterx/account';
@@ -1072,9 +1082,9 @@ export function consumeWithdraw(options) {
1072
1082
  * TTOs a `Coin<T>` to the account's UID address. The coin sits there until someone
1073
1083
  * calls `request_deposit_from_receivings<T>` (which requires a registered deposit
1074
1084
  * 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.
1085
+ * `receive<Coin<T>>` (owner-only, no policy needed). Useful for async / cross-PTB
1086
+ * deposits and for routing protocol payouts (e.g. reward claims) into an account
1087
+ * when `T` has no deposit policy.
1078
1088
  */
1079
1089
  export function transferCoin(options) {
1080
1090
  const packageAddress = options.package ?? '@waterx/account';
@@ -1104,9 +1114,10 @@ export function transferCoin(options) {
1104
1114
  * `request_deposit_from_receivings<X>` or `request_deposit_from_funds<X>` for
1105
1115
  * inflow when X has a deposit policy.
1106
1116
  *
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.
1117
+ * Auth: account owner only. Receiving a TTO'd object hands it to the caller's PTB
1118
+ * an off-platform exfil path so a delegate can never drive it, even one
1119
+ * holding `PERM_RECEIVE`. The `PERM_RECEIVE` bit is retained for ABI stability but
1120
+ * no longer gates any path. Returns the received object to the caller's PTB.
1110
1121
  */
1111
1122
  export function receive(options) {
1112
1123
  const packageAddress = options.package ?? '@waterx/account';
@@ -1131,13 +1142,15 @@ export function receive(options) {
1131
1142
  * native funds accumulator and returns it directly as a `Balance<T>`. Symmetric to
1132
1143
  * `request_deposit_from_funds<T>`, but explicitly for `T` that has **no**
1133
1144
  * 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.
1145
+ * deposit-policy pipeline instead. The intent is to let the account owner pull
1146
+ * policy-less inflow (reward tokens TTO'd via `send_funds`, miscellaneous
1147
+ * `Balance<T>` the SDK parked at the address) straight out.
1137
1148
  *
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.
1149
+ * Auth: same as `request_withdraw<T>` — owner-only. A delegate is rejected even
1150
+ * one holding `PERM_WITHDRAW` (the bit no longer gates this path; retained for ABI
1151
+ * stability only). Aborts `EUseRequestDepositInstead` if `T` has a deposit policy
1152
+ * registered. Pause-gated. Returns `Balance::zero<T>()` when the address holds no
1153
+ * T.
1141
1154
  */
1142
1155
  export function withdrawFromFunds(options) {
1143
1156
  const packageAddress = options.package ?? '@waterx/account';
@@ -1253,6 +1266,29 @@ export function isAccountAuthorized(options) {
1253
1266
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1254
1267
  });
1255
1268
  }
1269
+ /**
1270
+ * Returns `true` only when `addr` is the account's **owner** — delegates are
1271
+ * excluded regardless of their permission bits or expiry. Protocols use this for
1272
+ * owner-only actions that must never be delegate-driven (e.g. collateral
1273
+ * withdrawal): defense-in-depth so a phished or compromised delegate key can never
1274
+ * move funds, only the owner's own signature can. Contrast `is_account_authorized`
1275
+ * (owner OR live delegate).
1276
+ */
1277
+ export function isAccountOwner(options) {
1278
+ const packageAddress = options.package ?? '@waterx/account';
1279
+ const argumentsTypes = [
1280
+ null,
1281
+ '0x2::object::ID',
1282
+ 'address'
1283
+ ];
1284
+ const parameterNames = ["registry", "accountId", "addr"];
1285
+ return (tx) => tx.moveCall({
1286
+ package: packageAddress,
1287
+ module: 'account',
1288
+ function: 'is_account_owner',
1289
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1290
+ });
1291
+ }
1256
1292
  export function accountCount(options) {
1257
1293
  const packageAddress = options.package ?? '@waterx/account';
1258
1294
  const argumentsTypes = [
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ```text
10
10
  * let collector = oracle::new_collector(b"BTC_USD".to_string());
11
- * waterx_rule::feed(&mut collector, &waterx_config, &clock, ...);
11
+ * waterx_rule::feed(&mut collector, &mut waterx_config, &clock, ...);
12
12
  * oracle::aggregate(&mut oracle, collector, &clock);
13
13
  * // ... later in the same tx:
14
14
  * let price = oracle::get_price(&oracle, b"BTC_USD".to_string(), &clock);
@@ -240,6 +240,7 @@ export interface GetPriceAtTimestampOptions {
240
240
  export declare function getPriceAtTimestamp(options: GetPriceAtTimestampOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
241
241
  export interface RemovePriceAtTimestampArguments {
242
242
  oracle: RawTransactionArgument<string>;
243
+ Cap: RawTransactionArgument<string>;
243
244
  ticker: RawTransactionArgument<string>;
244
245
  timestampMs: RawTransactionArgument<number | bigint>;
245
246
  }
@@ -247,6 +248,7 @@ export interface RemovePriceAtTimestampOptions {
247
248
  package?: string;
248
249
  arguments: RemovePriceAtTimestampArguments | [
249
250
  oracle: RawTransactionArgument<string>,
251
+ Cap: RawTransactionArgument<string>,
250
252
  ticker: RawTransactionArgument<string>,
251
253
  timestampMs: RawTransactionArgument<number | bigint>
252
254
  ];
@@ -254,6 +256,10 @@ export interface RemovePriceAtTimestampOptions {
254
256
  /**
255
257
  * Removes the exact historical price snapshot at `timestamp_ms` so the caller can
256
258
  * reclaim the dynamic-field storage rebate. Latest price is unchanged.
259
+ *
260
+ * `ListingCap`-gated (F-012): without it any address could delete any listed
261
+ * ticker's history snapshots, griefing off-chain reconciliation. The live price
262
+ * path (`latest_price` / `last_update_ms`) is never touched here.
257
263
  */
258
264
  export declare function removePriceAtTimestamp(options: RemovePriceAtTimestampOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
259
265
  export interface UnsafeGetLatestPriceArguments {
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ```text
10
10
  * let collector = oracle::new_collector(b"BTC_USD".to_string());
11
- * waterx_rule::feed(&mut collector, &waterx_config, &clock, ...);
11
+ * waterx_rule::feed(&mut collector, &mut waterx_config, &clock, ...);
12
12
  * oracle::aggregate(&mut oracle, collector, &clock);
13
13
  * // ... later in the same tx:
14
14
  * let price = oracle::get_price(&oracle, b"BTC_USD".to_string(), &clock);
@@ -259,15 +259,20 @@ export function getPriceAtTimestamp(options) {
259
259
  /**
260
260
  * Removes the exact historical price snapshot at `timestamp_ms` so the caller can
261
261
  * reclaim the dynamic-field storage rebate. Latest price is unchanged.
262
+ *
263
+ * `ListingCap`-gated (F-012): without it any address could delete any listed
264
+ * ticker's history snapshots, griefing off-chain reconciliation. The live price
265
+ * path (`latest_price` / `last_update_ms`) is never touched here.
262
266
  */
263
267
  export function removePriceAtTimestamp(options) {
264
268
  const packageAddress = options.package ?? '@waterx/oracle';
265
269
  const argumentsTypes = [
270
+ null,
266
271
  null,
267
272
  '0x1::string::String',
268
273
  'u64'
269
274
  ];
270
- const parameterNames = ["oracle", "ticker", "timestampMs"];
275
+ const parameterNames = ["oracle", "Cap", "ticker", "timestampMs"];
271
276
  return (tx) => tx.moveCall({
272
277
  package: packageAddress,
273
278
  module: 'oracle',
@@ -12,8 +12,25 @@
12
12
  */
13
13
  import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
14
14
  import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
15
- export declare const WaterXPrediction: MoveStruct<any, any>;
16
- export declare const WaterXPredictionData: MoveStruct<any, any>;
15
+ export declare const WaterXPrediction: MoveStruct<{
16
+ dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
17
+ }, "@waterx/prediction::account_data::WaterXPrediction">;
18
+ export declare const WaterXPredictionData: MoveStruct<{
19
+ /** Pending open/close order IDs for this account. Value = market key. */
20
+ orders: MoveStruct<any, any>;
21
+ /** Active position IDs for this account. Value = market key. */
22
+ positions: MoveStruct<any, any>;
23
+ /** Per-market pending order ID sets. Key = market key. */
24
+ orders_by_market: MoveStruct<{
25
+ id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
26
+ size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
27
+ }, "0x2::table::Table<phantom K, phantom V>">;
28
+ /** Per-market active position ID sets. Key = market key. */
29
+ positions_by_market: MoveStruct<{
30
+ id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
31
+ size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
32
+ }, "0x2::table::Table<phantom K, phantom V>">;
33
+ }, "@waterx/prediction::account_data::WaterXPredictionData">;
17
34
  export interface PermPlaceOrderOptions {
18
35
  package?: string;
19
36
  arguments?: [
@@ -2,4 +2,6 @@
2
2
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
3
  **************************************************************/
4
4
  import { MoveStruct } from '../utils/index.ts';
5
- export declare const AdminCap: MoveStruct<any, any>;
5
+ export declare const AdminCap: MoveStruct<{
6
+ id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
7
+ }, "@waterx/prediction::admin::AdminCap">;
@@ -7,4 +7,6 @@
7
7
  * and `Balance`s.
8
8
  */
9
9
  import { MoveStruct } from '../../../utils/index.ts';
10
- export declare const Balance: MoveStruct<any, any>;
10
+ export declare const Balance: MoveStruct<{
11
+ value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
12
+ }, "0x2::balance::Balance<phantom T>">;
@@ -21,4 +21,9 @@
21
21
  * ```
22
22
  */
23
23
  import { MoveStruct } from '../../../utils/index.ts';
24
- export declare const Table: MoveStruct<any, any>;
24
+ export declare const Table: MoveStruct<{
25
+ /** the ID of this table */
26
+ id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
27
+ /** the number of key-value pairs in the table */
28
+ size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
29
+ }, "0x2::table::Table<phantom K, phantom V>">;