@waterx/sdk 2.4.1 → 3.0.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 (222) 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/client.d.ts +8 -38
  123. package/dist/src/prediction/client.js +11 -67
  124. package/dist/src/prediction/config.d.ts +16 -2
  125. package/dist/src/prediction/config.js +10 -4
  126. package/dist/src/prediction/index.d.ts +11 -11
  127. package/dist/src/prediction/index.js +10 -10
  128. package/dist/src/prediction/prediction.d.ts +45 -0
  129. package/dist/src/prediction/prediction.js +71 -0
  130. package/dist/src/prediction/tx-builders.d.ts +4 -4
  131. package/dist/src/prediction/tx-builders.js +2 -2
  132. package/dist/src/prediction/user/index.d.ts +2 -2
  133. package/dist/src/prediction/user/index.js +1 -1
  134. package/dist/src/prediction/user/position.d.ts +2 -2
  135. package/dist/src/prediction/user/position.js +1 -1
  136. package/dist/src/prediction/utils/bcs.d.ts +5 -0
  137. package/dist/src/prediction/utils/bcs.js +5 -0
  138. package/dist/src/prediction/utils/index.d.ts +7 -0
  139. package/dist/src/prediction/utils/index.js +7 -0
  140. package/dist/src/sdk.d.ts +10 -6
  141. package/dist/src/sdk.js +9 -5
  142. package/dist/src/unified-client.d.ts +140 -145
  143. package/dist/src/unified-client.js +98 -40
  144. package/dist/src/utils/config.d.ts +1 -1
  145. package/package.json +22 -5
  146. package/dist/src/config.d.ts +0 -292
  147. package/dist/src/fetch.d.ts +0 -254
  148. package/dist/src/fetch.js +0 -564
  149. package/dist/src/prediction/generated/bucket_v2_framework/account.d.ts +0 -100
  150. package/dist/src/prediction/generated/bucket_v2_framework/account.js +0 -129
  151. package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.d.ts +0 -6
  152. package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.js +0 -19
  153. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.d.ts +0 -10
  154. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +0 -36
  155. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.js +0 -27
  156. package/dist/src/prediction/generated/bucket_v2_framework/double.d.ts +0 -382
  157. package/dist/src/prediction/generated/bucket_v2_framework/double.js +0 -466
  158. package/dist/src/prediction/generated/bucket_v2_framework/float.d.ts +0 -362
  159. package/dist/src/prediction/generated/bucket_v2_framework/float.js +0 -440
  160. package/dist/src/prediction/generated/bucket_v2_framework/liability.d.ts +0 -193
  161. package/dist/src/prediction/generated/bucket_v2_framework/liability.js +0 -205
  162. package/dist/src/prediction/generated/bucket_v2_framework/linked_table.d.ts +0 -384
  163. package/dist/src/prediction/generated/bucket_v2_framework/linked_table.js +0 -382
  164. package/dist/src/prediction/generated/bucket_v2_framework/sheet.d.ts +0 -344
  165. package/dist/src/prediction/generated/bucket_v2_framework/sheet.js +0 -338
  166. package/dist/src/prediction/generated/utils/index.d.ts +0 -30
  167. package/dist/src/prediction/generated/utils/index.js +0 -160
  168. package/dist/src/prediction/generated/waterx_account/account.d.ts +0 -1589
  169. package/dist/src/prediction/generated/waterx_account/account.js +0 -1758
  170. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +0 -7
  171. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.js +0 -13
  172. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +0 -7
  173. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.js +0 -16
  174. package/dist/src/prediction/generated/waterx_account/deps/std/type_name.d.ts +0 -6
  175. package/dist/src/prediction/generated/waterx_account/deps/std/type_name.js +0 -19
  176. package/dist/src/prediction/generated/waterx_account/deps/sui/balance.d.ts +0 -10
  177. package/dist/src/prediction/generated/waterx_account/deps/sui/balance.js +0 -14
  178. package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.d.ts +0 -12
  179. package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.js +0 -19
  180. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.d.ts +0 -36
  181. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.js +0 -27
  182. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.d.ts +0 -16
  183. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.js +0 -19
  184. package/dist/src/prediction/generated/waterx_account/direct_rule.d.ts +0 -75
  185. package/dist/src/prediction/generated/waterx_account/direct_rule.js +0 -78
  186. package/dist/src/prediction/generated/waterx_account/events.d.ts +0 -33
  187. package/dist/src/prediction/generated/waterx_account/events.js +0 -137
  188. package/dist/src/prediction/generated/waterx_account/version.js +0 -8
  189. package/dist/src/prediction/generated/waterx_prediction/bet_sharing.d.ts +0 -60
  190. package/dist/src/prediction/generated/waterx_prediction/bet_sharing.js +0 -83
  191. package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.js +0 -14
  192. package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.d.ts +0 -24
  193. package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.js +0 -31
  194. package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.d.ts +0 -16
  195. package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.js +0 -19
  196. package/dist/src/prediction/generated/waterx_prediction/events.d.ts +0 -22
  197. package/dist/src/prediction/generated/waterx_prediction/version.d.ts +0 -10
  198. package/dist/src/tx-builders.d.ts +0 -296
  199. package/dist/src/tx-builders.js +0 -461
  200. package/dist/src/user/index.d.ts +0 -8
  201. package/dist/src/user/index.js +0 -8
  202. package/dist/src/utils/pyth.d.ts +0 -124
  203. package/dist/src/utils/pyth.js +0 -392
  204. /package/dist/src/{utils → account}/account-request.js +0 -0
  205. /package/dist/src/{core → account}/waterx-account.d.ts +0 -0
  206. /package/dist/src/{core → account}/waterx-account.js +0 -0
  207. /package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.js +0 -0
  208. /package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.js +0 -0
  209. /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +0 -0
  210. /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.js +0 -0
  211. /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/balance.js +0 -0
  212. /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.js +0 -0
  213. /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.d.ts +0 -0
  214. /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.js +0 -0
  215. /package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.js +0 -0
  216. /package/dist/src/{prediction/generated → generated}/waterx_prediction/order.js +0 -0
  217. /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.d.ts +0 -0
  218. /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.js +0 -0
  219. /package/dist/src/{prediction/generated → generated}/waterx_prediction/position.js +0 -0
  220. /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/version.d.ts +0 -0
  221. /package/dist/src/{prediction/generated → generated}/waterx_prediction/version.js +0 -0
  222. /package/dist/src/{prediction/generated → generated}/waterx_prediction/view.js +0 -0
@@ -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";
@@ -1,34 +1,51 @@
1
1
  /**
2
- * Unified WaterX SDK client.
2
+ * Umbrella WaterX SDK client — the main entry point.
3
3
  *
4
- * Wraps the two product-line clients (`WaterXClient` for perp, `PredictClient`
5
- * for prediction) behind a single object with namespaced modules, so the
6
- * colliding builder names (`placeOrder`, `createAccount`, `deposit`, …) can be
7
- * called unambiguously:
4
+ * Exposes three namespaces over the two product-line sub-clients:
8
5
  *
9
- * const client = await Client.create({ network: "TESTNET" });
10
- * client.perp.openPosition(tx, params); // -> perp builder
11
- * client.predict.placeOrder(tx, params); // -> prediction builder
6
+ * const client = await WaterXClient.create({ network: "TESTNET" });
7
+ * client.account.createAccount(tx, { alias }); // -> shared waterx_account + funding
8
+ * client.perp.placeOrderRequest(tx, params); // -> perp builder
9
+ * client.predict.placeOrder(tx, params); // -> prediction builder
12
10
  *
13
- * The modules are thin: each method forwards to the existing free-function
14
- * builder with the line's client pre-bound as the first argument. Builders are
15
- * build-only (they return / mutate a `Transaction`); signing & execution stay
16
- * with the caller (`client.perpClient` / `client.predictClient`, or a wallet),
17
- * so frontend wallet flows and multi-step Pyth injection keep working.
11
+ * `client.perp` **is** the `PerpClient` instance with the perp builder/view
12
+ * methods grafted on, and `client.predict` **is** the `PredictClient` instance
13
+ * likewise so signing & execution live on the same object
14
+ * (`client.perp.signAndExecuteTransaction(...)`) right next to the builders.
15
+ * There are no separate `.perpClient` / `.predictClient` accessors.
16
+ *
17
+ * `client.account` is a thin namespace (no own client) bound to the perp
18
+ * sub-client: the perp config carries the shared `waterx_account` registry plus
19
+ * the bridge / native_custody / withdrawal_queue / credit_registry that the
20
+ * credit & custody builders read. `waterx_account` is one shared on-chain object,
21
+ * so an account created here serves both lines — except when the two lines target
22
+ * different networks (`opts.perp.network !== opts.predict.network`), where
23
+ * `client.account` follows the perp line; split-network callers should reach the
24
+ * predict line's generic account builders via the `prediction` namespace directly.
25
+ *
26
+ * Each namespace method forwards to the existing free-function builder with the
27
+ * line's client pre-bound as the first argument; builders are build-only (they
28
+ * return / mutate a `Transaction`), so frontend wallet flows and multi-step Pyth
29
+ * injection keep working.
18
30
  */
19
31
  import { Transaction } from "@mysten/sui/transactions";
20
- import { WaterXClient, type CreateClientOptions as PerpCreateOptions } from "./client.ts";
32
+ import * as accountOps from "./account/index.ts";
33
+ import * as perpReferral from "./account/referral.ts";
21
34
  import type { Network } from "./constants.ts";
22
- import * as perpFetch from "./fetch.ts";
23
- import * as predAccount from "./prediction/account.ts";
35
+ import { PerpClient, type CreateClientOptions as PerpCreateOptions } from "./perp/client.ts";
36
+ import * as perpFetch from "./perp/fetch.ts";
37
+ import * as perpTx from "./perp/tx-builders.ts";
38
+ import * as perpOrder from "./perp/user/order.ts";
39
+ import * as perpStaking from "./perp/user/staking.ts";
40
+ import * as perpTrading from "./perp/user/trading.ts";
41
+ import * as perpWlp from "./perp/user/wlp.ts";
42
+ import { allowPredictionProtocolAsset, disallowPredictionProtocolAsset, setDelegatePredictionPermission, whitelistPredictionProtocol } from "./prediction/account.ts";
24
43
  import * as predAdmin from "./prediction/admin.ts";
25
44
  import { PredictClient, type CreateClientOptions as PredictCreateOptions } from "./prediction/client.ts";
26
45
  import * as predFetch from "./prediction/fetch.ts";
27
46
  import * as predGift from "./prediction/gift.ts";
28
47
  import * as predOps from "./prediction/prediction.ts";
29
48
  import { type BuildBatchClaimTxParams, type BuildPlaceOrderTxParams } from "./prediction/tx-builders.ts";
30
- import * as perpTx from "./tx-builders.ts";
31
- import * as perpUser from "./user/index.ts";
32
49
  /**
33
50
  * Exports from the spread builder/view modules that are NOT client-first — their
34
51
  * first argument is not the line client, so they must not become bound facade
@@ -47,32 +64,35 @@ type ClientBound<NS, C> = {
47
64
  [K in keyof Omit<NS, NonClientFirstKey>]: NS[K] extends (client: C, ...args: infer A) => infer R ? (...args: A) => R : NS[K];
48
65
  };
49
66
  declare const perpOps: {
50
- getAccountData(client: WaterXClient, accountId: string): Promise<perpFetch.AccountDataView | undefined>;
51
- getMarketData(client: WaterXClient, args: {
67
+ getRefererFor(client: import("./account/client.ts").WxaClientLike, referee: string): Promise<string | undefined>;
68
+ isValidReferralCode(client: import("./account/client.ts").WxaClientLike, code: string): Promise<boolean>;
69
+ referralCodeExists(client: import("./account/client.ts").WxaClientLike, code: string): Promise<boolean>;
70
+ getAccountData(client: PerpClient, accountId: string): Promise<perpFetch.AccountDataView | undefined>;
71
+ getMarketData(client: PerpClient, args: {
52
72
  ticker: string;
53
73
  lpType?: string;
54
74
  }): Promise<perpFetch.MarketDataView>;
55
- getPoolData(client: WaterXClient, args?: {
75
+ getPoolData(client: PerpClient, args?: {
56
76
  lpType?: string;
57
77
  }): Promise<perpFetch.PoolDataView>;
58
- getTokenPoolData(client: WaterXClient, args: {
78
+ getTokenPoolData(client: PerpClient, args: {
59
79
  tokenIndex: bigint | number;
60
80
  lpType?: string;
61
81
  }): Promise<perpFetch.TokenPoolDataView>;
62
- getGlobalConfigData(client: WaterXClient): Promise<perpFetch.GlobalConfigDataView>;
63
- positionExists(client: WaterXClient, args: {
82
+ getGlobalConfigData(client: PerpClient): Promise<perpFetch.GlobalConfigDataView>;
83
+ positionExists(client: PerpClient, args: {
64
84
  ticker: string;
65
85
  positionId: bigint | number;
66
86
  lpType?: string;
67
87
  }): Promise<boolean>;
68
- getPosition(client: WaterXClient, args: {
88
+ getPosition(client: PerpClient, args: {
69
89
  ticker: string;
70
90
  positionId: bigint | number;
71
91
  basePriceUsd: bigint | number;
72
92
  collateralPriceUsd: bigint | number;
73
93
  lpType?: string;
74
94
  }): Promise<perpFetch.PositionDataView>;
75
- getOrder(client: WaterXClient, args: {
95
+ getOrder(client: PerpClient, args: {
76
96
  ticker: string;
77
97
  orderId: bigint | number;
78
98
  orderTypeTag: number;
@@ -80,7 +100,7 @@ declare const perpOps: {
80
100
  basePriceUsd: bigint | number;
81
101
  lpType?: string;
82
102
  }): Promise<perpFetch.OrderDataView>;
83
- getMarketOrders(client: WaterXClient, args: {
103
+ getMarketOrders(client: PerpClient, args: {
84
104
  ticker: string;
85
105
  basePriceUsd?: bigint | number;
86
106
  lpType?: string;
@@ -88,7 +108,7 @@ declare const perpOps: {
88
108
  orders: perpFetch.OrderDataView[];
89
109
  nextCursor?: bigint;
90
110
  }>;
91
- getMarketPositions(client: WaterXClient, args: {
111
+ getMarketPositions(client: PerpClient, args: {
92
112
  ticker: string;
93
113
  basePriceUsd: bigint | number;
94
114
  collateralPriceUsd?: bigint | number;
@@ -97,121 +117,95 @@ declare const perpOps: {
97
117
  positions: perpFetch.PositionDataView[];
98
118
  nextCursor?: bigint;
99
119
  }>;
100
- getAccountPositions(client: WaterXClient, args: {
120
+ getAccountPositions(client: PerpClient, args: {
101
121
  ticker: string;
102
122
  accountObjectAddress: string;
103
123
  basePriceUsd: bigint | number;
104
124
  collateralPriceUsd?: bigint | number;
105
125
  lpType?: string;
106
126
  }): Promise<perpFetch.PositionDataView[]>;
107
- getAccountOrders(client: WaterXClient, args: {
127
+ getAccountOrders(client: PerpClient, args: {
108
128
  ticker: string;
109
129
  accountObjectAddress: string;
110
130
  basePriceUsd?: bigint | number;
111
131
  lpType?: string;
112
132
  }): Promise<perpFetch.OrderDataView[]>;
113
- getRedeemRequests(client: WaterXClient, args?: {
133
+ getRedeemRequests(client: PerpClient, args?: {
114
134
  lpType?: string;
115
135
  } & perpFetch.PageOpts): Promise<{
116
136
  requests: perpFetch.RedeemRequestDataView[];
117
137
  nextCursor?: bigint;
118
138
  }>;
119
- getRefererFor(client: WaterXClient, referee: string): Promise<string | undefined>;
120
- isValidReferralCode(client: WaterXClient, code: string): Promise<boolean>;
121
- referralCodeExists(client: WaterXClient, code: string): Promise<boolean>;
122
- getAccountsByOwner(client: WaterXClient, owner: string): Promise<string[]>;
123
- getAccountBalance(client: WaterXClient, accountId: string, coinType?: string): Promise<bigint>;
124
- getSpendableCreditBalance(client: WaterXClient, accountId: string): Promise<perpFetch.SpendableCreditBalance>;
125
- getCustodyVaultData(client: WaterXClient): Promise<perpFetch.CustodyVaultData>;
126
- getCustodyAssetData(client: WaterXClient, assetType: string): Promise<perpFetch.CustodyAssetData>;
127
- getBridgeLimits(client: WaterXClient, args?: perpFetch.BridgeLimitsArgs): Promise<perpFetch.BridgeLimitsView>;
128
- getBridgeFee(client: WaterXClient, args: {
139
+ getAccountsByOwner(client: PerpClient, owner: string): Promise<string[]>;
140
+ getAccountBalance(client: PerpClient, accountId: string, coinType?: string): Promise<bigint>;
141
+ getSpendableCreditBalance(client: PerpClient, accountId: string): Promise<perpFetch.SpendableCreditBalance>;
142
+ getCustodyVaultData(client: PerpClient): Promise<perpFetch.CustodyVaultData>;
143
+ getCustodyAssetData(client: PerpClient, assetType: string): Promise<perpFetch.CustodyAssetData>;
144
+ getBridgeLimits(client: PerpClient, args?: perpFetch.BridgeLimitsArgs): Promise<perpFetch.BridgeLimitsView>;
145
+ getBridgeFee(client: PerpClient, args: {
129
146
  evmDestinationChain: number;
130
147
  amount: bigint | number;
131
148
  creditType?: string;
132
149
  }): Promise<perpFetch.BridgeFeeView>;
133
- appendConsolidateToUsd(client: WaterXClient, tx: Transaction, accountId: string): Promise<number>;
134
- appendConsolidateAddressCredit(client: WaterXClient, tx: Transaction, accountId: string): Promise<number>;
135
- appendConsolidateForSpend(client: WaterXClient, tx: Transaction, accountId: string): Promise<number>;
136
- buildConsolidateToUsdTx(client: WaterXClient, accountId: string, tx?: Transaction): Promise<Transaction>;
137
- buildClosePositionTx(client: WaterXClient, params: perpTx.BuildClosePositionParams): Promise<Transaction>;
138
- buildIncreasePositionTx(client: WaterXClient, params: perpTx.BuildIncreasePositionParams): Promise<Transaction>;
139
- buildDecreasePositionTx(client: WaterXClient, params: perpTx.BuildDecreasePositionParams): Promise<Transaction>;
140
- buildDepositCollateralTx(client: WaterXClient, params: perpTx.BuildDepositCollateralParams): Promise<Transaction>;
141
- buildWithdrawCollateralTx(client: WaterXClient, params: perpTx.BuildWithdrawCollateralParams): Promise<Transaction>;
142
- buildPlaceOrderTx(client: WaterXClient, params: perpTx.BuildPlaceOrderParams): Promise<Transaction>;
143
- buildCancelOrderTx(client: WaterXClient, params: perpTx.BuildCancelOrderParams): Promise<Transaction>;
144
- buildUpdateOrderTx(client: WaterXClient, params: perpTx.BuildUpdateOrderParams): Promise<Transaction>;
145
- buildCancelPreOrderTx(client: WaterXClient, params: perpTx.BuildCancelPreOrderParams): Promise<Transaction>;
146
- buildAddPreOrderTx(client: WaterXClient, params: perpTx.BuildAddPreOrderParams): Promise<Transaction>;
147
- buildMintWlpTx(client: WaterXClient, params: perpTx.BuildMintWlpParams): Promise<Transaction>;
148
- buildMintAndStakeWlpTx(client: WaterXClient, params: perpTx.BuildMintAndStakeWlpParams): Promise<Transaction>;
149
- buildUnstakeAndRequestRedeemWlpTx(client: WaterXClient, params: perpTx.BuildUnstakeAndRequestRedeemWlpParams): Promise<Transaction>;
150
- buildCancelRedeemAndStakeWlpTx(client: WaterXClient, params: perpTx.BuildCancelRedeemAndStakeWlpParams): Transaction;
151
- buildClaimRewardsToAccountTx(client: WaterXClient, params: perpTx.BuildClaimRewardsToAccountParams): Transaction;
152
- buildRedeemVaaTx(client: WaterXClient, params: perpTx.BuildRedeemVaaParams): Transaction;
153
- buildRequestCreditWithdrawTx(client: WaterXClient, params: perpTx.BuildRequestCreditWithdrawParams): Transaction;
154
- buildExecuteWithdrawalTx(client: WaterXClient, params: perpTx.BuildExecuteWithdrawalParams): Transaction;
155
150
  openPythSponsorFund: typeof perpTx.openPythSponsorFund;
156
151
  PythCache: typeof perpTx.PythCache;
157
152
  refreshOraclePrices: typeof perpTx.refreshOraclePrices;
158
153
  reimbursePythSponsor: typeof perpTx.reimbursePythSponsor;
159
154
  updatePythPrices: typeof perpTx.updatePythPrices;
160
- createAccount(client: WaterXClient, tx: Transaction, params: perpUser.CreateAccountParams): void;
161
- setAlias(client: WaterXClient, tx: Transaction, params: perpUser.SetAliasParams): void;
162
- addDelegate(client: WaterXClient, tx: Transaction, params: perpUser.AddDelegateParams): void;
163
- removeDelegate(client: WaterXClient, tx: Transaction, params: perpUser.RemoveDelegateParams): void;
164
- setDelegateProtocolPermission(client: WaterXClient, tx: Transaction, params: perpUser.SetDelegateProtocolPermissionParams): void;
165
- requestDeposit(client: WaterXClient, tx: Transaction, params: perpUser.RequestDepositParams): import("@mysten/sui/transactions").TransactionArgument;
166
- requestDepositFromReceivings(client: WaterXClient, tx: Transaction, params: perpUser.RequestDepositFromReceivingsParams): import("@mysten/sui/transactions").TransactionArgument;
167
- requestDepositFromFunds(client: WaterXClient, tx: Transaction, params: perpUser.RequestDepositFromFundsParams): import("@mysten/sui/transactions").TransactionArgument;
168
- requestWithdraw(client: WaterXClient, tx: Transaction, params: perpUser.RequestWithdrawParams): import("@mysten/sui/transactions").TransactionArgument;
169
- transferToAccount(client: WaterXClient, tx: Transaction, params: perpUser.TransferToAccountParams): void;
170
- receive(client: WaterXClient, tx: Transaction, params: perpUser.ReceiveParams): import("@mysten/sui/transactions").TransactionArgument;
171
- redeemVaa(client: WaterXClient, tx: Transaction, params: perpUser.RedeemVaaParams): import("@mysten/sui/transactions").TransactionArgument;
172
- consumeCreditDeposit(client: WaterXClient, tx: Transaction, params: perpUser.ConsumeCreditDepositParams): void;
173
- routeWormhole(client: WaterXClient, tx: Transaction, params: perpUser.RouteWormholeParams): import("@mysten/sui/transactions").TransactionArgument;
174
- routeNative(client: WaterXClient, tx: Transaction, params: perpUser.RouteNativeParams): import("@mysten/sui/transactions").TransactionArgument;
175
- requestCreditWithdraw(client: WaterXClient, tx: Transaction, params: perpUser.RequestCreditWithdrawParams): import("@mysten/sui/transactions").TransactionArgument;
176
- enqueueWithdrawal(client: WaterXClient, tx: Transaction, params: perpUser.EnqueueWithdrawalParams): import("@mysten/sui/transactions").TransactionArgument;
177
- executeWithdrawalWormhole(client: WaterXClient, tx: Transaction, params: perpUser.ExecuteWithdrawalWormholeParams): void;
178
- executeWithdrawalNative(client: WaterXClient, tx: Transaction, params: perpUser.ExecuteWithdrawalNativeParams): void;
179
- custodyMint(client: WaterXClient, tx: Transaction, params: perpUser.CustodyMintParams): import("@mysten/sui/transactions").TransactionArgument;
180
- mintCredit(client: WaterXClient, tx: Transaction, params: perpUser.MintCreditParams): import("@mysten/sui/transactions").TransactionArgument;
181
- mintCreditFromRequest(client: WaterXClient, tx: Transaction, params: perpUser.MintCreditFromRequestParams): import("@mysten/sui/transactions").TransactionArgument;
182
- mintCreditToAccount(client: WaterXClient, tx: Transaction, params: perpUser.MintCreditParams): void;
183
- buildPlaceOrderArgument(client: WaterXClient, tx: Transaction, p: perpUser.PlaceOrderArgumentParams): import("@mysten/sui/transactions").TransactionArgument;
184
- placeOrderRequest(client: WaterXClient, tx: Transaction, params: perpUser.PlaceOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
185
- cancelOrderRequest(client: WaterXClient, tx: Transaction, params: perpUser.CancelOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
186
- updateOrderRequest(client: WaterXClient, tx: Transaction, params: perpUser.UpdateOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
187
- cancelPreOrderRequest(client: WaterXClient, tx: Transaction, params: perpUser.CancelPreOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
188
- addPreOrderRequest(client: WaterXClient, tx: Transaction, params: perpUser.AddPreOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
189
- setReferralCode(client: WaterXClient, tx: Transaction, params: perpUser.SetReferralCodeParams): void;
190
- useReferralCode(client: WaterXClient, tx: Transaction, params: perpUser.UseReferralCodeParams): void;
191
- stake(client: WaterXClient, tx: Transaction, params: perpUser.StakeParams): void;
192
- unstake(client: WaterXClient, tx: Transaction, params: perpUser.UnstakeParams): void;
193
- claimReward(client: WaterXClient, tx: Transaction, params: perpUser.ClaimRewardParams): void;
194
- closePositionRequest(client: WaterXClient, tx: Transaction, params: perpUser.ClosePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
195
- increasePositionRequest(client: WaterXClient, tx: Transaction, params: perpUser.IncreasePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
196
- decreasePositionRequest(client: WaterXClient, tx: Transaction, params: perpUser.DecreasePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
197
- depositCollateralRequest(client: WaterXClient, tx: Transaction, params: perpUser.DepositCollateralRequestParams): import("@mysten/sui/transactions").TransactionArgument;
198
- withdrawCollateralRequest(client: WaterXClient, tx: Transaction, params: perpUser.WithdrawCollateralRequestParams): import("@mysten/sui/transactions").TransactionArgument;
199
- executeTrading(client: WaterXClient, tx: Transaction, params: perpUser.ExecuteTradingParams): void;
200
- liquidate(client: WaterXClient, tx: Transaction, params: perpUser.LiquidateParams): void;
201
- batchLiquidate(client: WaterXClient, tx: Transaction, params: perpUser.BatchLiquidateParams): void;
202
- matchOrders(client: WaterXClient, tx: Transaction, params: perpUser.MatchOrdersParams): void;
203
- updateFundingRate(client: WaterXClient, tx: Transaction, params: perpUser.UpdateFundingRateParams): void;
204
- openPositionByKeeper(client: WaterXClient, tx: Transaction, params: perpUser.OpenPositionByKeeperParams): void;
205
- closePositionByKeeper(client: WaterXClient, tx: Transaction, params: perpUser.ClosePositionByKeeperParams): void;
206
- ORDER_TAG_WILDCARD_VALUE: 255;
207
- mintWlp(client: WaterXClient, tx: Transaction, params: perpUser.MintWlpParams): import("@mysten/sui/transactions").TransactionArgument;
208
- requestRedeemWlp(client: WaterXClient, tx: Transaction, params: perpUser.RequestRedeemWlpParams): void;
209
- cancelRedeemWlp(client: WaterXClient, tx: Transaction, params: perpUser.CancelRedeemWlpParams): void;
210
- settleRedeemWlp(client: WaterXClient, tx: Transaction, params: perpUser.SettleRedeemWlpParams): void;
211
- updateTokenValue(client: WaterXClient, tx: Transaction, args: {
155
+ appendConsolidateToUsd(client: import("./account/client.ts").AccountClientLike, tx: Transaction, accountId: string): Promise<number>;
156
+ appendConsolidateAddressCredit(client: import("./account/client.ts").AccountClientLike, tx: Transaction, accountId: string): Promise<number>;
157
+ appendConsolidateForSpend(client: import("./account/client.ts").AccountClientLike, tx: Transaction, accountId: string): Promise<number>;
158
+ buildConsolidateToUsdTx(client: import("./account/client.ts").AccountClientLike, accountId: string, tx?: Transaction): Promise<Transaction>;
159
+ buildClosePositionTx(client: PerpClient, params: perpTx.BuildClosePositionParams): Promise<Transaction>;
160
+ buildIncreasePositionTx(client: PerpClient, params: perpTx.BuildIncreasePositionParams): Promise<Transaction>;
161
+ buildDecreasePositionTx(client: PerpClient, params: perpTx.BuildDecreasePositionParams): Promise<Transaction>;
162
+ buildDepositCollateralTx(client: PerpClient, params: perpTx.BuildDepositCollateralParams): Promise<Transaction>;
163
+ buildWithdrawCollateralTx(client: PerpClient, params: perpTx.BuildWithdrawCollateralParams): Promise<Transaction>;
164
+ buildPlaceOrderTx(client: PerpClient, params: perpTx.BuildPlaceOrderParams): Promise<Transaction>;
165
+ buildCancelOrderTx(client: PerpClient, params: perpTx.BuildCancelOrderParams): Promise<Transaction>;
166
+ buildUpdateOrderTx(client: PerpClient, params: perpTx.BuildUpdateOrderParams): Promise<Transaction>;
167
+ buildCancelPreOrderTx(client: PerpClient, params: perpTx.BuildCancelPreOrderParams): Promise<Transaction>;
168
+ buildAddPreOrderTx(client: PerpClient, params: perpTx.BuildAddPreOrderParams): Promise<Transaction>;
169
+ buildMintWlpTx(client: PerpClient, params: perpTx.BuildMintWlpParams): Promise<Transaction>;
170
+ buildMintAndStakeWlpTx(client: PerpClient, params: perpTx.BuildMintAndStakeWlpParams): Promise<Transaction>;
171
+ buildUnstakeAndRequestRedeemWlpTx(client: PerpClient, params: perpTx.BuildUnstakeAndRequestRedeemWlpParams): Promise<Transaction>;
172
+ buildCancelRedeemAndStakeWlpTx(client: PerpClient, params: perpTx.BuildCancelRedeemAndStakeWlpParams): Transaction;
173
+ buildClaimRewardsToAccountTx(client: PerpClient, params: perpTx.BuildClaimRewardsToAccountParams): Transaction;
174
+ buildRedeemVaaTx(client: PerpClient, params: perpTx.BuildRedeemVaaParams): Transaction;
175
+ buildRequestCreditWithdrawTx(client: PerpClient, params: perpTx.BuildRequestCreditWithdrawParams): Transaction;
176
+ buildExecuteWithdrawalTx(client: PerpClient, params: perpTx.BuildExecuteWithdrawalParams): Transaction;
177
+ setReferralCode(client: import("./account/client.ts").WxaClientLike, tx: Transaction, params: perpReferral.SetReferralCodeParams): void;
178
+ useReferralCode(client: import("./account/client.ts").WxaClientLike, tx: Transaction, params: perpReferral.UseReferralCodeParams): void;
179
+ stake(client: PerpClient, tx: Transaction, params: perpStaking.StakeParams): void;
180
+ unstake(client: PerpClient, tx: Transaction, params: perpStaking.UnstakeParams): void;
181
+ claimReward(client: PerpClient, tx: Transaction, params: perpStaking.ClaimRewardParams): void;
182
+ mintWlp(client: PerpClient, tx: Transaction, params: perpWlp.MintWlpParams): import("@mysten/sui/transactions").TransactionArgument;
183
+ requestRedeemWlp(client: PerpClient, tx: Transaction, params: perpWlp.RequestRedeemWlpParams): void;
184
+ cancelRedeemWlp(client: PerpClient, tx: Transaction, params: perpWlp.CancelRedeemWlpParams): void;
185
+ settleRedeemWlp(client: PerpClient, tx: Transaction, params: perpWlp.SettleRedeemWlpParams): void;
186
+ updateTokenValue(client: PerpClient, tx: Transaction, args: {
212
187
  tokenType: string;
213
188
  lpType?: string;
214
189
  }): void;
190
+ buildPlaceOrderArgument(client: PerpClient, tx: Transaction, p: perpOrder.PlaceOrderArgumentParams): import("@mysten/sui/transactions").TransactionArgument;
191
+ placeOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.PlaceOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
192
+ cancelOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.CancelOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
193
+ updateOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.UpdateOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
194
+ cancelPreOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.CancelPreOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
195
+ addPreOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.AddPreOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
196
+ closePositionRequest(client: PerpClient, tx: Transaction, params: perpTrading.ClosePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
197
+ increasePositionRequest(client: PerpClient, tx: Transaction, params: perpTrading.IncreasePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
198
+ decreasePositionRequest(client: PerpClient, tx: Transaction, params: perpTrading.DecreasePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
199
+ depositCollateralRequest(client: PerpClient, tx: Transaction, params: perpTrading.DepositCollateralRequestParams): import("@mysten/sui/transactions").TransactionArgument;
200
+ withdrawCollateralRequest(client: PerpClient, tx: Transaction, params: perpTrading.WithdrawCollateralRequestParams): import("@mysten/sui/transactions").TransactionArgument;
201
+ executeTrading(client: PerpClient, tx: Transaction, params: perpTrading.ExecuteTradingParams): void;
202
+ liquidate(client: PerpClient, tx: Transaction, params: perpTrading.LiquidateParams): void;
203
+ batchLiquidate(client: PerpClient, tx: Transaction, params: perpTrading.BatchLiquidateParams): void;
204
+ matchOrders(client: PerpClient, tx: Transaction, params: perpTrading.MatchOrdersParams): void;
205
+ updateFundingRate(client: PerpClient, tx: Transaction, params: perpTrading.UpdateFundingRateParams): void;
206
+ openPositionByKeeper(client: PerpClient, tx: Transaction, params: perpTrading.OpenPositionByKeeperParams): void;
207
+ closePositionByKeeper(client: PerpClient, tx: Transaction, params: perpTrading.ClosePositionByKeeperParams): void;
208
+ ORDER_TAG_WILDCARD_VALUE: 255;
215
209
  };
216
210
  declare const predictOps: {
217
211
  base64UrlNoPadEncode(bytes: Uint8Array): string;
@@ -315,7 +309,10 @@ declare const predictOps: {
315
309
  claim(client: PredictClient, tx: Transaction, params: predOps.ClaimParams): Transaction;
316
310
  batchClaim(client: PredictClient, tx: Transaction, params: predOps.BatchClaimParams): Transaction;
317
311
  requestClose(client: PredictClient, tx: Transaction, params: predOps.RequestCloseParams): Transaction;
312
+ requestPartialClose(client: PredictClient, tx: Transaction, params: predOps.RequestPartialCloseParams): Transaction;
318
313
  selfCancelClose(client: PredictClient, tx: Transaction, params: predOps.SelfCancelCloseParams): Transaction;
314
+ transferPosition(client: PredictClient, tx: Transaction, params: predOps.TransferPositionParams): Transaction;
315
+ splitPosition(client: PredictClient, tx: Transaction, params: predOps.SplitPositionParams): Transaction;
319
316
  fillOrder(client: PredictClient, tx: Transaction, params: predOps.FillOrderParams): Transaction;
320
317
  cancelOrder(client: PredictClient, tx: Transaction, params: predOps.CancelOrderParams): Transaction;
321
318
  confirmClose(client: PredictClient, tx: Transaction, params: predOps.ConfirmCloseParams): Transaction;
@@ -334,25 +331,15 @@ declare const predictOps: {
334
331
  unpauseMarket(client: PredictClient, tx: Transaction, params: predAdmin.MarketPauseParams): Transaction;
335
332
  addKeeper(client: PredictClient, tx: Transaction, params: predAdmin.KeeperAdminParams): Transaction;
336
333
  removeKeeper(client: PredictClient, tx: Transaction, params: predAdmin.KeeperAdminParams): Transaction;
337
- resolveRegistryAccountId(client: PredictClient, accountObjectId: string, params?: predAccount.AccountBaseParams): Promise<string>;
338
- createAccount(client: PredictClient, tx: Transaction, params: predAccount.CreateAccountParams): import("@mysten/sui/transactions").TransactionArgument;
339
- transferCoinToAccount(client: PredictClient, tx: Transaction, params: predAccount.TransferCoinToAccountParams): Transaction;
340
- requestDeposit(client: PredictClient, tx: Transaction, params: predAccount.RequestDepositParams): import("@mysten/sui/transactions").TransactionArgument;
341
- consumeDepositDirect(client: PredictClient, tx: Transaction, params: predAccount.ConsumeDepositDirectParams): Transaction;
342
- deposit(client: PredictClient, tx: Transaction, params: predAccount.RequestDepositParams): Transaction;
343
- requestDepositFromReceivings(client: PredictClient, tx: Transaction, params: predAccount.RequestDepositFromReceivingsParams): import("@mysten/sui/transactions").TransactionArgument;
344
- requestWithdraw(client: PredictClient, tx: Transaction, params: predAccount.RequestWithdrawParams): import("@mysten/sui/transactions").TransactionArgument;
345
- consumeWithdrawDirect(client: PredictClient, tx: Transaction, params: predAccount.ConsumeWithdrawDirectParams): Transaction;
346
- withdraw(client: PredictClient, tx: Transaction, params: predAccount.RequestWithdrawParams): Transaction;
347
- addDelegate(client: PredictClient, tx: Transaction, params: predAccount.AddDelegateParams): Transaction;
348
- removeDelegate(client: PredictClient, tx: Transaction, params: predAccount.RemoveDelegateParams): Transaction;
349
- setDelegatePredictionPermission(client: PredictClient, tx: Transaction, params: predAccount.SetDelegatePredictionPermissionParams): Transaction;
350
- whitelistPredictionProtocol(client: PredictClient, tx: Transaction, params: predAccount.WhitelistPredictionProtocolParams): Transaction;
351
- allowPredictionProtocolAsset(client: PredictClient, tx: Transaction, params: predAccount.PredictionProtocolAssetParams): Transaction;
352
- disallowPredictionProtocolAsset(client: PredictClient, tx: Transaction, params: predAccount.PredictionProtocolAssetParams): Transaction;
334
+ setDelegatePredictionPermission: typeof setDelegatePredictionPermission;
335
+ whitelistPredictionProtocol: typeof whitelistPredictionProtocol;
336
+ allowPredictionProtocolAsset: typeof allowPredictionProtocolAsset;
337
+ disallowPredictionProtocolAsset: typeof disallowPredictionProtocolAsset;
353
338
  };
339
+ /** Account namespace exposed as `client.account` — generic wxa + credit + custody, perp-backed. */
340
+ export type AccountModule = ClientBound<typeof accountOps, PerpClient>;
354
341
  /** Perp namespace exposed as `client.perp` — builder/view methods, client pre-bound. */
355
- export type PerpModule = ClientBound<typeof perpOps, WaterXClient>;
342
+ export type PerpModule = ClientBound<typeof perpOps, PerpClient>;
356
343
  /** Prediction namespace exposed as `client.predict` — builder/view methods, client pre-bound. */
357
344
  export type PredictModule = ClientBound<typeof predictOps, PredictClient>;
358
345
  /** Per-line network/config override. Falls back to the shared top-level options. */
@@ -376,18 +363,22 @@ export interface ClientCreateOptions {
376
363
  /** Prediction-line overrides (network, grpcUrl, configUrl, cache, settlement, …). */
377
364
  predict?: PredictLineOptions;
378
365
  }
379
- export declare class Client {
380
- /** Underlying perp client — use for signing/executing perp transactions. */
381
- readonly perpClient: WaterXClient;
382
- /** Underlying prediction client — use for signing/executing prediction transactions. */
383
- readonly predictClient: PredictClient;
384
- /** Perp builders & views (`client.perp.openPosition(tx, params)`). */
385
- readonly perp: PerpModule;
386
- /** Prediction builders & views (`client.predict.placeOrder(tx, params)`). */
387
- readonly predict: PredictModule;
366
+ export declare class WaterXClient {
367
+ /** Shared account namespace (`client.account.createAccount(tx, params)`) — perp-backed. */
368
+ readonly account: AccountModule;
369
+ /**
370
+ * Perp sub-client **with** the perp builders/views grafted on
371
+ * (`client.perp.placeOrderRequest(...)`, `client.perp.signAndExecuteTransaction(...)`).
372
+ */
373
+ readonly perp: PerpClient & PerpModule;
374
+ /**
375
+ * Prediction sub-client **with** the prediction builders/views grafted on
376
+ * (`client.predict.placeOrder(...)`, `client.predict.signAndExecuteTransaction(...)`).
377
+ */
378
+ readonly predict: PredictClient & PredictModule;
388
379
  /**
389
380
  * Async prediction builder: optional consolidate + `placeOrder`.
390
- * Uses `perpClient` for the sweep and `predictClient` for the bet leg.
381
+ * Uses the perp client for the sweep and the predict client for the bet leg.
391
382
  */
392
383
  buildPredictPlaceOrderTx(params: BuildPlaceOrderTxParams): Promise<Transaction>;
393
384
  /**
@@ -395,13 +386,17 @@ export declare class Client {
395
386
  */
396
387
  buildPredictBatchClaimTx(params: BuildBatchClaimTxParams): Promise<Transaction>;
397
388
  private constructor();
398
- /** Combine two pre-built line clients (advanced — full control over each). */
399
- static fromClients(perpClient: WaterXClient, predictClient: PredictClient): Client;
389
+ /**
390
+ * Combine two pre-built line clients (advanced full control over each).
391
+ * Note: this grafts the bound builder methods onto the provided client
392
+ * instances in place.
393
+ */
394
+ static fromClients(perpClient: PerpClient, predictClient: PredictClient): WaterXClient;
400
395
  /**
401
396
  * Async factory — loads each line's deployment config (from the canonical
402
397
  * `waterx-config` JSON) and returns a ready client. Each line can target a
403
398
  * different network via `opts.perp.network` / `opts.predict.network`.
404
399
  */
405
- static create(opts?: ClientCreateOptions): Promise<Client>;
400
+ static create(opts?: ClientCreateOptions): Promise<WaterXClient>;
406
401
  }
407
402
  export {};