@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
@@ -44,10 +44,55 @@ export interface RequestCloseParams extends BasePredictionParams, AccountIdentit
44
44
  expiryTs: bigint | number | string;
45
45
  }
46
46
  export declare function requestClose(client: PredictClient, tx: Transaction, params: RequestCloseParams): Transaction;
47
+ export interface RequestPartialCloseParams extends BasePredictionParams, AccountIdentityParams {
48
+ positionId: bigint | number | string;
49
+ /**
50
+ * Shares to peel off `positionId` into a new same-account position that is
51
+ * then closed. Must be `0 < closeShares < filled_shares` of the position.
52
+ */
53
+ closeShares: bigint | number | string;
54
+ minProceeds: bigint | number | string;
55
+ expiryTs: bigint | number | string;
56
+ }
57
+ /**
58
+ * Account-backed partial sell. Splits `closeShares` off `positionId` into a new
59
+ * same-account position and runs the close flow on it; the remainder stays
60
+ * `Open` under `positionId`. The on-chain call returns the new PendingClose
61
+ * position id (read it from events / the returned move-call result if needed).
62
+ */
63
+ export declare function requestPartialClose(client: PredictClient, tx: Transaction, params: RequestPartialCloseParams): Transaction;
47
64
  export interface SelfCancelCloseParams extends BasePredictionParams, AccountIdentityParams {
48
65
  positionId: bigint | number | string;
49
66
  }
50
67
  export declare function selfCancelClose(client: PredictClient, tx: Transaction, params: SelfCancelCloseParams): Transaction;
68
+ export interface TransferPositionParams extends BasePredictionParams, AccountIdentityParams {
69
+ positionId: bigint | number | string;
70
+ /** WXA account that receives the position; future close/claim proceeds go there. */
71
+ recipientAccountId: IdArgument;
72
+ }
73
+ /**
74
+ * Account-backed position transfer. The source account owner moves an open
75
+ * prediction position to another WXA account. Aborts if the position has a
76
+ * pending close.
77
+ */
78
+ export declare function transferPosition(client: PredictClient, tx: Transaction, params: TransferPositionParams): Transaction;
79
+ export interface SplitPositionParams extends BasePredictionParams, AccountIdentityParams {
80
+ positionId: bigint | number | string;
81
+ /** WXA account that receives the new independent position. */
82
+ recipientAccountId: IdArgument;
83
+ /**
84
+ * Shares to split into the recipient's new position. Must be
85
+ * `0 < splitShares < filled_shares` of the source position.
86
+ */
87
+ splitShares: bigint | number | string;
88
+ }
89
+ /**
90
+ * Account-backed partial transfer. Splits an open position into two independent
91
+ * positions: the source keeps the remainder and the recipient receives a new
92
+ * position with proportional cost basis. The on-chain call returns the new
93
+ * position id (read it from events / the returned move-call result if needed).
94
+ */
95
+ export declare function splitPosition(client: PredictClient, tx: Transaction, params: SplitPositionParams): Transaction;
51
96
  export interface KeeperBaseParams extends BasePredictionParams, AccountIdentityParams {
52
97
  }
53
98
  export interface FillOrderParams extends KeeperBaseParams {
@@ -124,6 +124,31 @@ export function requestClose(client, tx, params) {
124
124
  });
125
125
  return tx;
126
126
  }
127
+ /**
128
+ * Account-backed partial sell. Splits `closeShares` off `positionId` into a new
129
+ * same-account position and runs the close flow on it; the remainder stays
130
+ * `Open` under `positionId`. The on-chain call returns the new PendingClose
131
+ * position id (read it from events / the returned move-call result if needed).
132
+ */
133
+ export function requestPartialClose(client, tx, params) {
134
+ const senderRequest = createAccountRequest(client, tx, params);
135
+ tx.moveCall({
136
+ target: `${resolvePackageId(client, params.packageId)}::waterx_prediction::request_partial_close`,
137
+ typeArguments: [resolveSettlementCoinType(client, params.settlementCoinType)],
138
+ arguments: [
139
+ tx.object(resolveGlobalConfig(client, params.globalConfig)),
140
+ tx.object(resolveMarketRegistry(client, params.marketRegistry)),
141
+ tx.object(resolveAccountRegistry(client, params.accountRegistry)),
142
+ senderRequest,
143
+ tx.pure.u64(toBigInt(params.positionId)),
144
+ tx.pure.u64(toBigInt(params.closeShares)),
145
+ tx.pure.u64(toBigInt(params.minProceeds)),
146
+ tx.pure.u64(toBigInt(params.expiryTs)),
147
+ clockArg(tx),
148
+ ],
149
+ });
150
+ return tx;
151
+ }
127
152
  export function selfCancelClose(client, tx, params) {
128
153
  const senderRequest = createAccountRequest(client, tx, params);
129
154
  tx.moveCall({
@@ -140,6 +165,52 @@ export function selfCancelClose(client, tx, params) {
140
165
  });
141
166
  return tx;
142
167
  }
168
+ /**
169
+ * Account-backed position transfer. The source account owner moves an open
170
+ * prediction position to another WXA account. Aborts if the position has a
171
+ * pending close.
172
+ */
173
+ export function transferPosition(client, tx, params) {
174
+ const senderRequest = createAccountRequest(client, tx, params);
175
+ tx.moveCall({
176
+ target: `${resolvePackageId(client, params.packageId)}::waterx_prediction::transfer_position`,
177
+ typeArguments: [resolveSettlementCoinType(client, params.settlementCoinType)],
178
+ arguments: [
179
+ tx.object(resolveGlobalConfig(client, params.globalConfig)),
180
+ tx.object(resolveMarketRegistry(client, params.marketRegistry)),
181
+ tx.object(resolveAccountRegistry(client, params.accountRegistry)),
182
+ senderRequest,
183
+ tx.pure.u64(toBigInt(params.positionId)),
184
+ idArg(tx, params.recipientAccountId),
185
+ clockArg(tx),
186
+ ],
187
+ });
188
+ return tx;
189
+ }
190
+ /**
191
+ * Account-backed partial transfer. Splits an open position into two independent
192
+ * positions: the source keeps the remainder and the recipient receives a new
193
+ * position with proportional cost basis. The on-chain call returns the new
194
+ * position id (read it from events / the returned move-call result if needed).
195
+ */
196
+ export function splitPosition(client, tx, params) {
197
+ const senderRequest = createAccountRequest(client, tx, params);
198
+ tx.moveCall({
199
+ target: `${resolvePackageId(client, params.packageId)}::waterx_prediction::split_position`,
200
+ typeArguments: [resolveSettlementCoinType(client, params.settlementCoinType)],
201
+ arguments: [
202
+ tx.object(resolveGlobalConfig(client, params.globalConfig)),
203
+ tx.object(resolveMarketRegistry(client, params.marketRegistry)),
204
+ tx.object(resolveAccountRegistry(client, params.accountRegistry)),
205
+ senderRequest,
206
+ tx.pure.u64(toBigInt(params.positionId)),
207
+ idArg(tx, params.recipientAccountId),
208
+ tx.pure.u64(toBigInt(params.splitShares)),
209
+ clockArg(tx),
210
+ ],
211
+ });
212
+ return tx;
213
+ }
143
214
  export function fillOrder(client, tx, params) {
144
215
  const keeperRequest = createAccountRequest(client, tx, params);
145
216
  tx.moveCall({
@@ -2,14 +2,14 @@
2
2
  * Async high-level prediction PTB builders with optional pre-sweep of parked
3
3
  * backing assets into wxUSD credit ({@link appendConsolidateForSpend}).
4
4
  *
5
- * Takes both `WaterXClient` (native_custody / consolidate) and `PredictClient`
5
+ * Takes both `AccountClientLike` (native_custody / consolidate) and `PredictClient`
6
6
  * because sync prediction builders only target the prediction deployment.
7
7
  *
8
8
  * FE/BE tx services should call these instead of hand-composing
9
9
  * `appendConsolidateForSpend` before `placeOrder` / `batchClaim`.
10
10
  */
11
11
  import { Transaction } from "@mysten/sui/transactions";
12
- import type { WaterXClient } from "../client.ts";
12
+ import type { AccountClientLike } from "../account/client.ts";
13
13
  import type { PredictClient } from "./client.ts";
14
14
  import { type BatchClaimParams, type PlaceOrderParams } from "./prediction.ts";
15
15
  export interface PredictCommonBuildOpts {
@@ -37,8 +37,8 @@ export interface BuildBatchClaimTxParams extends BatchClaimParams, PredictCommon
37
37
  * @param perpClient — perp deployment (native_custody probe + PSM mint legs)
38
38
  * @param predictClient — prediction deployment (place_order MoveCall)
39
39
  */
40
- export declare function buildPlaceOrderTx(perpClient: WaterXClient, predictClient: PredictClient, params: BuildPlaceOrderTxParams): Promise<Transaction>;
40
+ export declare function buildPlaceOrderTx(perpClient: AccountClientLike, predictClient: PredictClient, params: BuildPlaceOrderTxParams): Promise<Transaction>;
41
41
  /**
42
42
  * Optional pre-sweep + {@link batchClaim} in one PTB.
43
43
  */
44
- export declare function buildBatchClaimTx(perpClient: WaterXClient, predictClient: PredictClient, params: BuildBatchClaimTxParams): Promise<Transaction>;
44
+ export declare function buildBatchClaimTx(perpClient: AccountClientLike, predictClient: PredictClient, params: BuildBatchClaimTxParams): Promise<Transaction>;
@@ -2,14 +2,14 @@
2
2
  * Async high-level prediction PTB builders with optional pre-sweep of parked
3
3
  * backing assets into wxUSD credit ({@link appendConsolidateForSpend}).
4
4
  *
5
- * Takes both `WaterXClient` (native_custody / consolidate) and `PredictClient`
5
+ * Takes both `AccountClientLike` (native_custody / consolidate) and `PredictClient`
6
6
  * because sync prediction builders only target the prediction deployment.
7
7
  *
8
8
  * FE/BE tx services should call these instead of hand-composing
9
9
  * `appendConsolidateForSpend` before `placeOrder` / `batchClaim`.
10
10
  */
11
11
  import { Transaction } from "@mysten/sui/transactions";
12
- import { appendConsolidateForSpend } from "../tx-builders.js";
12
+ import { appendConsolidateForSpend } from "../account/funding/consolidate.js";
13
13
  import { batchClaim, placeOrder, } from "./prediction.js";
14
14
  function newTx(opts) {
15
15
  return opts?.tx ?? new Transaction();
@@ -14,6 +14,7 @@ export interface RegistryView {
14
14
  minReserve: bigint;
15
15
  orderCancelCooldownMs: bigint;
16
16
  nextOrderId: bigint;
17
+ nextPositionId: bigint;
17
18
  orderCount: bigint;
18
19
  positionCount: bigint;
19
20
  unresolvedMarketCount: bigint;
@@ -23,6 +24,7 @@ export interface OrderView {
23
24
  orderId: bigint;
24
25
  kind: OrderKind;
25
26
  accountId: string;
27
+ receiverAccountId: string;
26
28
  marketId: Uint8Array;
27
29
  marketIdHex: string;
28
30
  selection: Selection;
@@ -1,5 +1,5 @@
1
1
  export { addDelegate, consumeDepositDirect, createAccount, deposit, removeDelegate, requestDeposit, requestDepositFromReceivings, requestWithdraw, setDelegatePredictionPermission, transferCoinToAccount, whitelistPredictionProtocol, } from "../account.ts";
2
2
  export type { AddDelegateParams, ConsumeDepositDirectParams, CreateAccountParams, RemoveDelegateParams, RequestDepositFromReceivingsParams, RequestDepositParams, RequestWithdrawParams, SetDelegatePredictionPermissionParams, TransferCoinToAccountParams, WhitelistPredictionProtocolParams, } from "../account.ts";
3
- export { batchClaim, claim, placeOrder, requestClose, selectionArg, selfCancelClose, selfCancelOrder, } from "../prediction.ts";
4
- export type { BatchClaimParams, ClaimParams, PlaceOrderParams, RequestCloseParams, SelfCancelCloseParams, SelfCancelOrderParams, } from "../prediction.ts";
3
+ export { batchClaim, claim, placeOrder, requestClose, requestPartialClose, selectionArg, selfCancelClose, selfCancelOrder, splitPosition, transferPosition, } from "../prediction.ts";
4
+ export type { BatchClaimParams, ClaimParams, PlaceOrderParams, RequestCloseParams, RequestPartialCloseParams, SelfCancelCloseParams, SelfCancelOrderParams, SplitPositionParams, TransferPositionParams, } from "../prediction.ts";
5
5
  export * as gift from "./gift.ts";
@@ -1,3 +1,3 @@
1
1
  export { addDelegate, consumeDepositDirect, createAccount, deposit, removeDelegate, requestDeposit, requestDepositFromReceivings, requestWithdraw, setDelegatePredictionPermission, transferCoinToAccount, whitelistPredictionProtocol, } from "../account.js";
2
- export { batchClaim, claim, placeOrder, requestClose, selectionArg, selfCancelClose, selfCancelOrder, } from "../prediction.js";
2
+ export { batchClaim, claim, placeOrder, requestClose, requestPartialClose, selectionArg, selfCancelClose, selfCancelOrder, splitPosition, transferPosition, } from "../prediction.js";
3
3
  export * as gift from "./gift.js";
@@ -1,2 +1,2 @@
1
- export { batchClaim, claim, requestClose, selfCancelClose } from "../prediction.ts";
2
- export type { BatchClaimParams, ClaimParams, RequestCloseParams, SelfCancelCloseParams, } from "../prediction.ts";
1
+ export { batchClaim, claim, requestClose, requestPartialClose, selfCancelClose, splitPosition, transferPosition, } from "../prediction.ts";
2
+ export type { BatchClaimParams, ClaimParams, RequestCloseParams, RequestPartialCloseParams, SelfCancelCloseParams, SplitPositionParams, TransferPositionParams, } from "../prediction.ts";
@@ -1 +1 @@
1
- export { batchClaim, claim, requestClose, selfCancelClose } from "../prediction.js";
1
+ export { batchClaim, claim, requestClose, requestPartialClose, selfCancelClose, splitPosition, transferPosition, } from "../prediction.js";
@@ -1 +1,6 @@
1
+ /**
2
+ * Public-subpath barrel for `@waterx/sdk/prediction/utils/bcs` (package.json `exports`).
3
+ * Thin re-export of the flat impl in `../bcs.ts`; pinned by `user-exports.test.ts`
4
+ * ("utils/bcs re-exports BCS helpers from prediction/bcs"). Not dead duplication.
5
+ */
1
6
  export { AccountDataViewBcs, MarketViewBcs, OrderKindBcs, OrderViewBcs, OutcomeBcs, PositionViewBcs, RegistryViewBcs, SelectionBcs, StatusBcs, decodeEnumVariant, mapAccountDataView, mapCursorView, mapMarketView, mapOrderKind, mapOrderView, mapOutcome, mapPositionView, mapRegistryView, mapSelection, mapStatus, } from "../bcs.ts";
@@ -1 +1,6 @@
1
+ /**
2
+ * Public-subpath barrel for `@waterx/sdk/prediction/utils/bcs` (package.json `exports`).
3
+ * Thin re-export of the flat impl in `../bcs.ts`; pinned by `user-exports.test.ts`
4
+ * ("utils/bcs re-exports BCS helpers from prediction/bcs"). Not dead duplication.
5
+ */
1
6
  export { AccountDataViewBcs, MarketViewBcs, OrderKindBcs, OrderViewBcs, OutcomeBcs, PositionViewBcs, RegistryViewBcs, SelectionBcs, StatusBcs, decodeEnumVariant, mapAccountDataView, mapCursorView, mapMarketView, mapOrderKind, mapOrderView, mapOutcome, mapPositionView, mapRegistryView, mapSelection, mapStatus, } from "../bcs.js";
@@ -1 +1,8 @@
1
+ /**
2
+ * Public-subpath barrel for `@waterx/sdk/prediction/utils` (package.json `exports`).
3
+ * Intentionally a thin re-export of the flat impl in `../utils.ts` — the flat file
4
+ * keeps its own `~predict/utils.ts` subpath + internal relative imports, while this
5
+ * folder exposes the grouped `prediction/utils` / `prediction/utils/bcs` namespace.
6
+ * Pinned by `test/post-build/package-exports.test.ts`. Not dead duplication.
7
+ */
1
8
  export { assertOutcome, assertSelection, assertU64, bytesToHex, clockArg, createAccountRequest, marketIdArg, marketIdBytesFromUnknown, normalizeMarketId, objectArg, optionU64, receivingCoinArg, requireConfig, resolveAccountPackageId, resolveAccountRegistry, resolveGlobalConfig, resolveMarketRegistry, resolvePackageId, resolveSettlementCoinType, toBigInt, } from "../utils.ts";
@@ -1 +1,8 @@
1
+ /**
2
+ * Public-subpath barrel for `@waterx/sdk/prediction/utils` (package.json `exports`).
3
+ * Intentionally a thin re-export of the flat impl in `../utils.ts` — the flat file
4
+ * keeps its own `~predict/utils.ts` subpath + internal relative imports, while this
5
+ * folder exposes the grouped `prediction/utils` / `prediction/utils/bcs` namespace.
6
+ * Pinned by `test/post-build/package-exports.test.ts`. Not dead duplication.
7
+ */
1
8
  export { assertOutcome, assertSelection, assertU64, bytesToHex, clockArg, createAccountRequest, marketIdArg, marketIdBytesFromUnknown, normalizeMarketId, objectArg, optionU64, receivingCoinArg, requireConfig, resolveAccountPackageId, resolveAccountRegistry, resolveGlobalConfig, resolveMarketRegistry, resolvePackageId, resolveSettlementCoinType, toBigInt, } from "../utils.js";
package/dist/src/sdk.d.ts CHANGED
@@ -1,18 +1,22 @@
1
1
  /**
2
2
  * Package root for `@waterx/sdk` (`.` export).
3
3
  *
4
- * - `Client` — the unified facade (`client.perp.*` / `client.predict.*`).
4
+ * - `WaterXClient` — the umbrella entry point
5
+ * (`client.account.*` / `client.perp.*` / `client.predict.*`).
5
6
  * - `perp` / `prediction` — namespaces exposing each line's full API; use these
6
- * to disambiguate the builder names that collide across the two lines.
7
+ * to disambiguate the builder names that collide across the two lines. The perp
8
+ * sub-client itself is exported (flat + `perp.PerpClient`) as `PerpClient`.
7
9
  * - The flat re-export below preserves the legacy `@waterx/perp-sdk` surface at
8
10
  * the package root for one major cycle (DEPRECATED — removed next major).
9
11
  *
10
12
  * Prediction is reachable only via the `prediction` namespace / `@waterx/sdk/prediction`
11
13
  * (never flat at the root) because its builder names collide with perp's.
12
14
  */
13
- export { Client } from "./unified-client.ts";
14
- export type { ClientCreateOptions, PerpModule, PredictModule } from "./unified-client.ts";
15
+ export { WaterXClient } from "./unified-client.ts";
16
+ /** @deprecated Renamed to `WaterXClient` (the umbrella). Removed next major. */
17
+ export { WaterXClient as Client } from "./unified-client.ts";
18
+ export type { AccountModule, ClientCreateOptions, PerpModule, PredictModule, } from "./unified-client.ts";
15
19
  export type { BuildBatchClaimTxParams as BuildPredictBatchClaimTxParams, BuildPlaceOrderTxParams as BuildPredictPlaceOrderTxParams, } from "./prediction/tx-builders.ts";
16
- export * as perp from "./index.ts";
20
+ export * as perp from "./perp/index.ts";
17
21
  export * as prediction from "./prediction/index.ts";
18
- export * from "./index.ts";
22
+ export * from "./perp/index.ts";
package/dist/src/sdk.js CHANGED
@@ -1,17 +1,21 @@
1
1
  /**
2
2
  * Package root for `@waterx/sdk` (`.` export).
3
3
  *
4
- * - `Client` — the unified facade (`client.perp.*` / `client.predict.*`).
4
+ * - `WaterXClient` — the umbrella entry point
5
+ * (`client.account.*` / `client.perp.*` / `client.predict.*`).
5
6
  * - `perp` / `prediction` — namespaces exposing each line's full API; use these
6
- * to disambiguate the builder names that collide across the two lines.
7
+ * to disambiguate the builder names that collide across the two lines. The perp
8
+ * sub-client itself is exported (flat + `perp.PerpClient`) as `PerpClient`.
7
9
  * - The flat re-export below preserves the legacy `@waterx/perp-sdk` surface at
8
10
  * the package root for one major cycle (DEPRECATED — removed next major).
9
11
  *
10
12
  * Prediction is reachable only via the `prediction` namespace / `@waterx/sdk/prediction`
11
13
  * (never flat at the root) because its builder names collide with perp's.
12
14
  */
13
- export { Client } from "./unified-client.js";
14
- export * as perp from "./index.js";
15
+ export { WaterXClient } from "./unified-client.js";
16
+ /** @deprecated Renamed to `WaterXClient` (the umbrella). Removed next major. */
17
+ export { WaterXClient as Client } from "./unified-client.js";
18
+ export * as perp from "./perp/index.js";
15
19
  export * as prediction from "./prediction/index.js";
16
20
  // DEPRECATED flat perp surface (migration aid from `@waterx/perp-sdk`).
17
- export * from "./index.js";
21
+ export * from "./perp/index.js";