@waterx/sdk 3.0.1 → 3.0.3

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 (398) hide show
  1. package/dist/cjs/package.json +3 -0
  2. package/dist/cjs/src/account/account-request.d.ts +9 -0
  3. package/dist/cjs/src/account/account-request.js +20 -0
  4. package/dist/cjs/src/account/account.d.ts +158 -0
  5. package/dist/cjs/src/account/account.js +238 -0
  6. package/dist/cjs/src/account/client.d.ts +42 -0
  7. package/dist/cjs/src/account/client.js +18 -0
  8. package/dist/cjs/src/account/config.d.ts +151 -0
  9. package/dist/cjs/src/account/config.js +9 -0
  10. package/dist/cjs/src/account/constants.d.ts +5 -0
  11. package/dist/cjs/src/account/constants.js +8 -0
  12. package/dist/cjs/src/account/fetch/referral.d.ts +15 -0
  13. package/dist/cjs/src/account/fetch/referral.js +56 -0
  14. package/dist/cjs/src/account/fetch/simulate.d.ts +34 -0
  15. package/dist/cjs/src/account/fetch/simulate.js +49 -0
  16. package/dist/cjs/src/account/funding/balance.d.ts +32 -0
  17. package/dist/cjs/src/account/funding/balance.js +100 -0
  18. package/dist/cjs/src/account/funding/consolidate.d.ts +46 -0
  19. package/dist/cjs/src/account/funding/consolidate.js +143 -0
  20. package/dist/cjs/src/account/funding/credit.d.ts +129 -0
  21. package/dist/cjs/src/account/funding/credit.js +252 -0
  22. package/dist/cjs/src/account/funding/custody.d.ts +57 -0
  23. package/dist/cjs/src/account/funding/custody.js +139 -0
  24. package/dist/cjs/src/account/funding/wormhole.d.ts +86 -0
  25. package/dist/cjs/src/account/funding/wormhole.js +166 -0
  26. package/dist/cjs/src/account/index.d.ts +29 -0
  27. package/dist/cjs/src/account/index.js +45 -0
  28. package/dist/cjs/src/account/referral.d.ts +21 -0
  29. package/dist/cjs/src/account/referral.js +78 -0
  30. package/dist/cjs/src/account/waterx-account.d.ts +31 -0
  31. package/dist/cjs/src/account/waterx-account.js +29 -0
  32. package/dist/cjs/src/base-client.d.ts +74 -0
  33. package/dist/cjs/src/base-client.js +101 -0
  34. package/dist/cjs/src/constants.d.ts +32 -0
  35. package/dist/cjs/src/constants.js +41 -0
  36. package/dist/cjs/src/generated/bucket_v2_framework/account.d.ts +107 -0
  37. package/dist/cjs/src/generated/bucket_v2_framework/account.js +141 -0
  38. package/dist/cjs/src/generated/bucket_v2_framework/deps/std/type_name.d.ts +17 -0
  39. package/dist/cjs/src/generated/bucket_v2_framework/deps/std/type_name.js +22 -0
  40. package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/balance.d.ts +12 -0
  41. package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/balance.js +17 -0
  42. package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
  43. package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/vec_map.js +31 -0
  44. package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
  45. package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/vec_set.js +22 -0
  46. package/dist/cjs/src/generated/bucket_v2_framework/double.d.ts +384 -0
  47. package/dist/cjs/src/generated/bucket_v2_framework/double.js +504 -0
  48. package/dist/cjs/src/generated/bucket_v2_framework/float.d.ts +364 -0
  49. package/dist/cjs/src/generated/bucket_v2_framework/float.js +476 -0
  50. package/dist/cjs/src/generated/bucket_v2_framework/liability.d.ts +171 -0
  51. package/dist/cjs/src/generated/bucket_v2_framework/liability.js +192 -0
  52. package/dist/cjs/src/generated/bucket_v2_framework/linked_table.d.ts +384 -0
  53. package/dist/cjs/src/generated/bucket_v2_framework/linked_table.js +405 -0
  54. package/dist/cjs/src/generated/bucket_v2_framework/sheet.d.ts +424 -0
  55. package/dist/cjs/src/generated/bucket_v2_framework/sheet.js +395 -0
  56. package/dist/cjs/src/generated/native_custody/custody_vault.d.ts +586 -0
  57. package/dist/cjs/src/generated/native_custody/custody_vault.js +555 -0
  58. package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/float.d.ts +8 -0
  59. package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/float.js +13 -0
  60. package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/liability.d.ts +11 -0
  61. package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/liability.js +16 -0
  62. package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/sheet.d.ts +49 -0
  63. package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/sheet.js +52 -0
  64. package/dist/cjs/src/generated/native_custody/deps/std/type_name.d.ts +17 -0
  65. package/dist/cjs/src/generated/native_custody/deps/std/type_name.js +22 -0
  66. package/dist/cjs/src/generated/native_custody/deps/sui/balance.d.ts +12 -0
  67. package/dist/cjs/src/generated/native_custody/deps/sui/balance.js +17 -0
  68. package/dist/cjs/src/generated/native_custody/deps/sui/vec_map.d.ts +36 -0
  69. package/dist/cjs/src/generated/native_custody/deps/sui/vec_map.js +31 -0
  70. package/dist/cjs/src/generated/native_custody/deps/sui/vec_set.d.ts +16 -0
  71. package/dist/cjs/src/generated/native_custody/deps/sui/vec_set.js +22 -0
  72. package/dist/cjs/src/generated/native_custody/events.d.ts +36 -0
  73. package/dist/cjs/src/generated/native_custody/events.js +71 -0
  74. package/dist/cjs/src/generated/pyth_sponsor_rule/deps/sui/balance.d.ts +12 -0
  75. package/dist/cjs/src/generated/pyth_sponsor_rule/deps/sui/balance.js +17 -0
  76. package/dist/cjs/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +68 -0
  77. package/dist/cjs/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +113 -0
  78. package/dist/cjs/src/generated/utils/index.d.ts +30 -0
  79. package/dist/cjs/src/generated/utils/index.js +168 -0
  80. package/dist/cjs/src/generated/waterx_account/account.d.ts +1906 -0
  81. package/dist/cjs/src/generated/waterx_account/account.js +1929 -0
  82. package/dist/cjs/src/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +11 -0
  83. package/dist/cjs/src/generated/waterx_account/deps/bucket_v2_framework/liability.js +16 -0
  84. package/dist/cjs/src/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +49 -0
  85. package/dist/cjs/src/generated/waterx_account/deps/bucket_v2_framework/sheet.js +52 -0
  86. package/dist/cjs/src/generated/waterx_account/deps/std/type_name.d.ts +17 -0
  87. package/dist/cjs/src/generated/waterx_account/deps/std/type_name.js +22 -0
  88. package/dist/cjs/src/generated/waterx_account/deps/sui/balance.d.ts +12 -0
  89. package/dist/cjs/src/generated/waterx_account/deps/sui/balance.js +17 -0
  90. package/dist/cjs/src/generated/waterx_account/deps/sui/object_table.d.ts +17 -0
  91. package/dist/cjs/src/generated/waterx_account/deps/sui/object_table.js +22 -0
  92. package/dist/cjs/src/generated/waterx_account/deps/sui/table.d.ts +29 -0
  93. package/dist/cjs/src/generated/waterx_account/deps/sui/table.js +34 -0
  94. package/dist/cjs/src/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
  95. package/dist/cjs/src/generated/waterx_account/deps/sui/vec_map.js +31 -0
  96. package/dist/cjs/src/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
  97. package/dist/cjs/src/generated/waterx_account/deps/sui/vec_set.js +22 -0
  98. package/dist/cjs/src/generated/waterx_account/direct_rule.d.ts +77 -0
  99. package/dist/cjs/src/generated/waterx_account/direct_rule.js +83 -0
  100. package/dist/cjs/src/generated/waterx_account/events.d.ts +190 -0
  101. package/dist/cjs/src/generated/waterx_account/events.js +173 -0
  102. package/dist/cjs/src/generated/waterx_account/version.d.ts +10 -0
  103. package/dist/cjs/src/generated/waterx_account/version.js +11 -0
  104. package/dist/cjs/src/generated/waterx_constant_rule/constant_rule.d.ts +68 -0
  105. package/dist/cjs/src/generated/waterx_constant_rule/constant_rule.js +97 -0
  106. package/dist/cjs/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.d.ts +8 -0
  107. package/dist/cjs/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.js +13 -0
  108. package/dist/cjs/src/generated/waterx_constant_rule/deps/sui/vec_map.d.ts +36 -0
  109. package/dist/cjs/src/generated/waterx_constant_rule/deps/sui/vec_map.js +31 -0
  110. package/dist/cjs/src/generated/waterx_credit/credit_registry.d.ts +708 -0
  111. package/dist/cjs/src/generated/waterx_credit/credit_registry.js +728 -0
  112. package/dist/cjs/src/generated/waterx_credit/deps/std/type_name.d.ts +17 -0
  113. package/dist/cjs/src/generated/waterx_credit/deps/std/type_name.js +22 -0
  114. package/dist/cjs/src/generated/waterx_credit/deps/sui/table.d.ts +29 -0
  115. package/dist/cjs/src/generated/waterx_credit/deps/sui/table.js +34 -0
  116. package/dist/cjs/src/generated/waterx_credit/deps/sui/vec_map.d.ts +36 -0
  117. package/dist/cjs/src/generated/waterx_credit/deps/sui/vec_map.js +31 -0
  118. package/dist/cjs/src/generated/waterx_credit/deps/sui/vec_set.d.ts +16 -0
  119. package/dist/cjs/src/generated/waterx_credit/deps/sui/vec_set.js +22 -0
  120. package/dist/cjs/src/generated/waterx_credit/limited_supply.d.ts +107 -0
  121. package/dist/cjs/src/generated/waterx_credit/limited_supply.js +143 -0
  122. package/dist/cjs/src/generated/waterx_oracle/aggregator.d.ts +211 -0
  123. package/dist/cjs/src/generated/waterx_oracle/aggregator.js +258 -0
  124. package/dist/cjs/src/generated/waterx_oracle/collector.d.ts +119 -0
  125. package/dist/cjs/src/generated/waterx_oracle/collector.js +147 -0
  126. package/dist/cjs/src/generated/waterx_oracle/deps/bucket_v2_framework/float.d.ts +8 -0
  127. package/dist/cjs/src/generated/waterx_oracle/deps/bucket_v2_framework/float.js +13 -0
  128. package/dist/cjs/src/generated/waterx_oracle/deps/std/type_name.d.ts +17 -0
  129. package/dist/cjs/src/generated/waterx_oracle/deps/std/type_name.js +22 -0
  130. package/dist/cjs/src/generated/waterx_oracle/deps/sui/vec_map.d.ts +36 -0
  131. package/dist/cjs/src/generated/waterx_oracle/deps/sui/vec_map.js +31 -0
  132. package/dist/cjs/src/generated/waterx_oracle/deps/sui/vec_set.d.ts +16 -0
  133. package/dist/cjs/src/generated/waterx_oracle/deps/sui/vec_set.js +22 -0
  134. package/dist/cjs/src/generated/waterx_oracle/oracle.d.ts +304 -0
  135. package/dist/cjs/src/generated/waterx_oracle/oracle.js +381 -0
  136. package/dist/cjs/src/generated/waterx_oracle/version.d.ts +10 -0
  137. package/dist/cjs/src/generated/waterx_oracle/version.js +11 -0
  138. package/dist/cjs/src/generated/waterx_perp/account_data.d.ts +269 -0
  139. package/dist/cjs/src/generated/waterx_perp/account_data.js +340 -0
  140. package/dist/cjs/src/generated/waterx_perp/admin.d.ts +19 -0
  141. package/dist/cjs/src/generated/waterx_perp/admin.js +26 -0
  142. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/double.d.ts +8 -0
  143. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/double.js +13 -0
  144. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/float.d.ts +8 -0
  145. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/float.js +13 -0
  146. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/liability.d.ts +11 -0
  147. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/liability.js +16 -0
  148. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.d.ts +8 -0
  149. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.js +21 -0
  150. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.d.ts +49 -0
  151. package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.js +52 -0
  152. package/dist/cjs/src/generated/waterx_perp/deps/std/type_name.d.ts +17 -0
  153. package/dist/cjs/src/generated/waterx_perp/deps/std/type_name.js +22 -0
  154. package/dist/cjs/src/generated/waterx_perp/deps/sui/balance.d.ts +15 -0
  155. package/dist/cjs/src/generated/waterx_perp/deps/sui/balance.js +20 -0
  156. package/dist/cjs/src/generated/waterx_perp/deps/sui/coin.d.ts +14 -0
  157. package/dist/cjs/src/generated/waterx_perp/deps/sui/coin.js +51 -0
  158. package/dist/cjs/src/generated/waterx_perp/deps/sui/vec_map.d.ts +36 -0
  159. package/dist/cjs/src/generated/waterx_perp/deps/sui/vec_map.js +31 -0
  160. package/dist/cjs/src/generated/waterx_perp/deps/sui/vec_set.d.ts +16 -0
  161. package/dist/cjs/src/generated/waterx_perp/deps/sui/vec_set.js +22 -0
  162. package/dist/cjs/src/generated/waterx_perp/events.d.ts +1283 -0
  163. package/dist/cjs/src/generated/waterx_perp/events.js +990 -0
  164. package/dist/cjs/src/generated/waterx_perp/global_config.d.ts +775 -0
  165. package/dist/cjs/src/generated/waterx_perp/global_config.js +918 -0
  166. package/dist/cjs/src/generated/waterx_perp/keyed_big_vector.d.ts +553 -0
  167. package/dist/cjs/src/generated/waterx_perp/keyed_big_vector.js +626 -0
  168. package/dist/cjs/src/generated/waterx_perp/lp_pool.d.ts +1648 -0
  169. package/dist/cjs/src/generated/waterx_perp/lp_pool.js +1630 -0
  170. package/dist/cjs/src/generated/waterx_perp/market_config.d.ts +733 -0
  171. package/dist/cjs/src/generated/waterx_perp/market_config.js +871 -0
  172. package/dist/cjs/src/generated/waterx_perp/math.d.ts +63 -0
  173. package/dist/cjs/src/generated/waterx_perp/math.js +70 -0
  174. package/dist/cjs/src/generated/waterx_perp/memo.d.ts +251 -0
  175. package/dist/cjs/src/generated/waterx_perp/memo.js +360 -0
  176. package/dist/cjs/src/generated/waterx_perp/order_book.d.ts +290 -0
  177. package/dist/cjs/src/generated/waterx_perp/order_book.js +388 -0
  178. package/dist/cjs/src/generated/waterx_perp/position.d.ts +1005 -0
  179. package/dist/cjs/src/generated/waterx_perp/position.js +1200 -0
  180. package/dist/cjs/src/generated/waterx_perp/request.d.ts +544 -0
  181. package/dist/cjs/src/generated/waterx_perp/request.js +609 -0
  182. package/dist/cjs/src/generated/waterx_perp/response.d.ts +247 -0
  183. package/dist/cjs/src/generated/waterx_perp/response.js +331 -0
  184. package/dist/cjs/src/generated/waterx_perp/trading.d.ts +2945 -0
  185. package/dist/cjs/src/generated/waterx_perp/trading.js +2616 -0
  186. package/dist/cjs/src/generated/waterx_perp/version.d.ts +10 -0
  187. package/dist/cjs/src/generated/waterx_perp/version.js +11 -0
  188. package/dist/cjs/src/generated/waterx_perp/witness.d.ts +18 -0
  189. package/dist/cjs/src/generated/waterx_perp/witness.js +25 -0
  190. package/dist/cjs/src/generated/waterx_perp_view/deps/std/type_name.d.ts +17 -0
  191. package/dist/cjs/src/generated/waterx_perp_view/deps/std/type_name.js +22 -0
  192. package/dist/cjs/src/generated/waterx_perp_view/view.d.ts +447 -0
  193. package/dist/cjs/src/generated/waterx_perp_view/view.js +459 -0
  194. package/dist/cjs/src/generated/waterx_prediction/account_data.d.ts +344 -0
  195. package/dist/cjs/src/generated/waterx_prediction/account_data.js +470 -0
  196. package/dist/cjs/src/generated/waterx_prediction/admin.d.ts +7 -0
  197. package/dist/cjs/src/generated/waterx_prediction/admin.js +12 -0
  198. package/dist/cjs/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +8 -0
  199. package/dist/cjs/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.js +21 -0
  200. package/dist/cjs/src/generated/waterx_prediction/deps/sui/balance.d.ts +12 -0
  201. package/dist/cjs/src/generated/waterx_prediction/deps/sui/balance.js +17 -0
  202. package/dist/cjs/src/generated/waterx_prediction/deps/sui/table.d.ts +29 -0
  203. package/dist/cjs/src/generated/waterx_prediction/deps/sui/table.js +34 -0
  204. package/dist/cjs/src/generated/waterx_prediction/deps/sui/vec_set.d.ts +16 -0
  205. package/dist/cjs/src/generated/waterx_prediction/deps/sui/vec_set.js +22 -0
  206. package/dist/cjs/src/generated/waterx_prediction/events.d.ts +288 -0
  207. package/dist/cjs/src/generated/waterx_prediction/events.js +254 -0
  208. package/dist/cjs/src/generated/waterx_prediction/global_config.d.ts +121 -0
  209. package/dist/cjs/src/generated/waterx_prediction/global_config.js +186 -0
  210. package/dist/cjs/src/generated/waterx_prediction/order.d.ts +233 -0
  211. package/dist/cjs/src/generated/waterx_prediction/order.js +339 -0
  212. package/dist/cjs/src/generated/waterx_prediction/outcome.d.ts +58 -0
  213. package/dist/cjs/src/generated/waterx_prediction/outcome.js +82 -0
  214. package/dist/cjs/src/generated/waterx_prediction/position.d.ts +175 -0
  215. package/dist/cjs/src/generated/waterx_prediction/position.js +232 -0
  216. package/dist/cjs/src/generated/waterx_prediction/version.d.ts +10 -0
  217. package/dist/cjs/src/generated/waterx_prediction/version.js +11 -0
  218. package/dist/cjs/src/generated/waterx_prediction/view.d.ts +418 -0
  219. package/dist/cjs/src/generated/waterx_prediction/view.js +492 -0
  220. package/dist/cjs/src/generated/waterx_prediction/waterx_prediction.d.ts +1858 -0
  221. package/dist/cjs/src/generated/waterx_prediction/waterx_prediction.js +1972 -0
  222. package/dist/cjs/src/generated/waterx_pyth_rule/deps/sui/vec_map.d.ts +36 -0
  223. package/dist/cjs/src/generated/waterx_pyth_rule/deps/sui/vec_map.js +31 -0
  224. package/dist/cjs/src/generated/waterx_pyth_rule/pyth_rule.d.ts +192 -0
  225. package/dist/cjs/src/generated/waterx_pyth_rule/pyth_rule.js +214 -0
  226. package/dist/cjs/src/generated/waterx_referral/deps/sui/table.d.ts +29 -0
  227. package/dist/cjs/src/generated/waterx_referral/deps/sui/table.js +34 -0
  228. package/dist/cjs/src/generated/waterx_referral/deps/sui/vec_set.d.ts +16 -0
  229. package/dist/cjs/src/generated/waterx_referral/deps/sui/vec_set.js +22 -0
  230. package/dist/cjs/src/generated/waterx_referral/referral_table.d.ts +171 -0
  231. package/dist/cjs/src/generated/waterx_referral/referral_table.js +239 -0
  232. package/dist/cjs/src/generated/waterx_staking/deps/bucket_v2_framework/double.d.ts +8 -0
  233. package/dist/cjs/src/generated/waterx_staking/deps/bucket_v2_framework/double.js +13 -0
  234. package/dist/cjs/src/generated/waterx_staking/deps/sui/balance.d.ts +12 -0
  235. package/dist/cjs/src/generated/waterx_staking/deps/sui/balance.js +17 -0
  236. package/dist/cjs/src/generated/waterx_staking/deps/sui/table.d.ts +29 -0
  237. package/dist/cjs/src/generated/waterx_staking/deps/sui/table.js +34 -0
  238. package/dist/cjs/src/generated/waterx_staking/deps/sui/vec_set.d.ts +16 -0
  239. package/dist/cjs/src/generated/waterx_staking/deps/sui/vec_set.js +22 -0
  240. package/dist/cjs/src/generated/waterx_staking/waterx_staking.d.ts +746 -0
  241. package/dist/cjs/src/generated/waterx_staking/waterx_staking.js +797 -0
  242. package/dist/cjs/src/generated/waterx_staking/witness.d.ts +16 -0
  243. package/dist/cjs/src/generated/waterx_staking/witness.js +21 -0
  244. package/dist/cjs/src/generated/waterx_supra_rule/deps/sui/vec_map.d.ts +36 -0
  245. package/dist/cjs/src/generated/waterx_supra_rule/deps/sui/vec_map.js +31 -0
  246. package/dist/cjs/src/generated/waterx_supra_rule/supra_rule.d.ts +158 -0
  247. package/dist/cjs/src/generated/waterx_supra_rule/supra_rule.js +189 -0
  248. package/dist/cjs/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.d.ts +8 -0
  249. package/dist/cjs/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.js +13 -0
  250. package/dist/cjs/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.d.ts +8 -0
  251. package/dist/cjs/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.js +21 -0
  252. package/dist/cjs/src/generated/withdrawal_queue/deps/std/type_name.d.ts +17 -0
  253. package/dist/cjs/src/generated/withdrawal_queue/deps/std/type_name.js +22 -0
  254. package/dist/cjs/src/generated/withdrawal_queue/deps/sui/balance.d.ts +12 -0
  255. package/dist/cjs/src/generated/withdrawal_queue/deps/sui/balance.js +17 -0
  256. package/dist/cjs/src/generated/withdrawal_queue/deps/sui/vec_map.d.ts +36 -0
  257. package/dist/cjs/src/generated/withdrawal_queue/deps/sui/vec_map.js +31 -0
  258. package/dist/cjs/src/generated/withdrawal_queue/deps/sui/vec_set.d.ts +16 -0
  259. package/dist/cjs/src/generated/withdrawal_queue/deps/sui/vec_set.js +22 -0
  260. package/dist/cjs/src/generated/withdrawal_queue/withdrawal_queue.d.ts +923 -0
  261. package/dist/cjs/src/generated/withdrawal_queue/withdrawal_queue.js +965 -0
  262. package/dist/cjs/src/generated/wlp/wlp.d.ts +28 -0
  263. package/dist/cjs/src/generated/wlp/wlp.js +37 -0
  264. package/dist/cjs/src/generated/wormhole_bridge/deps/sui/table.d.ts +29 -0
  265. package/dist/cjs/src/generated/wormhole_bridge/deps/sui/table.js +34 -0
  266. package/dist/cjs/src/generated/wormhole_bridge/deps/sui/vec_map.d.ts +36 -0
  267. package/dist/cjs/src/generated/wormhole_bridge/deps/sui/vec_map.js +31 -0
  268. package/dist/cjs/src/generated/wormhole_bridge/deps/sui/vec_set.d.ts +16 -0
  269. package/dist/cjs/src/generated/wormhole_bridge/deps/sui/vec_set.js +22 -0
  270. package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.d.ts +12 -0
  271. package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.js +45 -0
  272. package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.d.ts +14 -0
  273. package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.js +19 -0
  274. package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/set.d.ts +16 -0
  275. package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/set.js +51 -0
  276. package/dist/cjs/src/generated/wormhole_bridge/events.d.ts +32 -0
  277. package/dist/cjs/src/generated/wormhole_bridge/events.js +31 -0
  278. package/dist/cjs/src/generated/wormhole_bridge/wormhole_bridge.d.ts +638 -0
  279. package/dist/cjs/src/generated/wormhole_bridge/wormhole_bridge.js +692 -0
  280. package/dist/cjs/src/oracle/aggregate.d.ts +74 -0
  281. package/dist/cjs/src/oracle/aggregate.js +118 -0
  282. package/dist/cjs/src/oracle/config.d.ts +99 -0
  283. package/dist/cjs/src/oracle/config.js +26 -0
  284. package/dist/cjs/src/oracle/host.d.ts +32 -0
  285. package/dist/cjs/src/oracle/host.js +11 -0
  286. package/dist/cjs/src/oracle/index.d.ts +16 -0
  287. package/dist/cjs/src/oracle/index.js +31 -0
  288. package/dist/cjs/src/oracle/pyth.d.ts +52 -0
  289. package/dist/cjs/src/oracle/pyth.js +227 -0
  290. package/dist/cjs/src/oracle/rules/constant-rule.d.ts +9 -0
  291. package/dist/cjs/src/oracle/rules/constant-rule.js +17 -0
  292. package/dist/cjs/src/oracle/rules/pyth-rule.d.ts +11 -0
  293. package/dist/cjs/src/oracle/rules/pyth-rule.js +23 -0
  294. package/dist/cjs/src/oracle/rules/sponsor.d.ts +28 -0
  295. package/dist/cjs/src/oracle/rules/sponsor.js +52 -0
  296. package/dist/cjs/src/oracle/rules/supra-rule.d.ts +11 -0
  297. package/dist/cjs/src/oracle/rules/supra-rule.js +25 -0
  298. package/dist/cjs/src/perp/client.d.ts +78 -0
  299. package/dist/cjs/src/perp/client.js +112 -0
  300. package/dist/cjs/src/perp/config-view.d.ts +102 -0
  301. package/dist/cjs/src/perp/config-view.js +178 -0
  302. package/dist/cjs/src/perp/config.d.ts +126 -0
  303. package/dist/cjs/src/perp/config.js +119 -0
  304. package/dist/cjs/src/perp/constants.d.ts +49 -0
  305. package/dist/cjs/src/perp/constants.js +79 -0
  306. package/dist/cjs/src/perp/fetch/account.d.ts +43 -0
  307. package/dist/cjs/src/perp/fetch/account.js +69 -0
  308. package/dist/cjs/src/perp/fetch/bridge.d.ts +90 -0
  309. package/dist/cjs/src/perp/fetch/bridge.js +131 -0
  310. package/dist/cjs/src/perp/fetch/custody.d.ts +32 -0
  311. package/dist/cjs/src/perp/fetch/custody.js +66 -0
  312. package/dist/cjs/src/perp/fetch/market.d.ts +30 -0
  313. package/dist/cjs/src/perp/fetch/market.js +75 -0
  314. package/dist/cjs/src/perp/fetch/positions.d.ts +70 -0
  315. package/dist/cjs/src/perp/fetch/positions.js +195 -0
  316. package/dist/cjs/src/perp/fetch/simulate.d.ts +12 -0
  317. package/dist/cjs/src/perp/fetch/simulate.js +21 -0
  318. package/dist/cjs/src/perp/fetch.d.ts +23 -0
  319. package/dist/cjs/src/perp/fetch.js +39 -0
  320. package/dist/cjs/src/perp/index.d.ts +29 -0
  321. package/dist/cjs/src/perp/index.js +183 -0
  322. package/dist/cjs/src/perp/tx-builders/common.d.ts +83 -0
  323. package/dist/cjs/src/perp/tx-builders/common.js +76 -0
  324. package/dist/cjs/src/perp/tx-builders/credit.d.ts +65 -0
  325. package/dist/cjs/src/perp/tx-builders/credit.js +67 -0
  326. package/dist/cjs/src/perp/tx-builders/rewards.d.ts +30 -0
  327. package/dist/cjs/src/perp/tx-builders/rewards.js +37 -0
  328. package/dist/cjs/src/perp/tx-builders/trading.d.ts +51 -0
  329. package/dist/cjs/src/perp/tx-builders/trading.js +71 -0
  330. package/dist/cjs/src/perp/tx-builders/wlp.d.ts +90 -0
  331. package/dist/cjs/src/perp/tx-builders/wlp.js +126 -0
  332. package/dist/cjs/src/perp/tx-builders.d.ts +23 -0
  333. package/dist/cjs/src/perp/tx-builders.js +45 -0
  334. package/dist/cjs/src/perp/user/index.d.ts +8 -0
  335. package/dist/cjs/src/perp/user/index.js +24 -0
  336. package/dist/cjs/src/perp/user/order.d.ts +89 -0
  337. package/dist/cjs/src/perp/user/order.js +175 -0
  338. package/dist/cjs/src/perp/user/staking.d.ts +54 -0
  339. package/dist/cjs/src/perp/user/staking.js +147 -0
  340. package/dist/cjs/src/perp/user/trading.d.ts +119 -0
  341. package/dist/cjs/src/perp/user/trading.js +310 -0
  342. package/dist/cjs/src/perp/user/wlp.d.ts +58 -0
  343. package/dist/cjs/src/perp/user/wlp.js +139 -0
  344. package/dist/cjs/src/prediction/account.d.ts +96 -0
  345. package/dist/cjs/src/prediction/account.js +212 -0
  346. package/dist/cjs/src/prediction/admin.d.ts +47 -0
  347. package/dist/cjs/src/prediction/admin.js +116 -0
  348. package/dist/cjs/src/prediction/bcs.d.ts +28 -0
  349. package/dist/cjs/src/prediction/bcs.js +189 -0
  350. package/dist/cjs/src/prediction/client.d.ts +45 -0
  351. package/dist/cjs/src/prediction/client.js +112 -0
  352. package/dist/cjs/src/prediction/config.d.ts +74 -0
  353. package/dist/cjs/src/prediction/config.js +86 -0
  354. package/dist/cjs/src/prediction/constants.d.ts +44 -0
  355. package/dist/cjs/src/prediction/constants.js +49 -0
  356. package/dist/cjs/src/prediction/fetch.d.ts +82 -0
  357. package/dist/cjs/src/prediction/fetch.js +294 -0
  358. package/dist/cjs/src/prediction/gift-link.d.ts +6 -0
  359. package/dist/cjs/src/prediction/gift-link.js +16 -0
  360. package/dist/cjs/src/prediction/gift.d.ts +223 -0
  361. package/dist/cjs/src/prediction/gift.js +465 -0
  362. package/dist/cjs/src/prediction/index.d.ts +29 -0
  363. package/dist/cjs/src/prediction/index.js +154 -0
  364. package/dist/cjs/src/prediction/prediction.d.ts +149 -0
  365. package/dist/cjs/src/prediction/prediction.js +410 -0
  366. package/dist/cjs/src/prediction/tx-builders.d.ts +44 -0
  367. package/dist/cjs/src/prediction/tx-builders.js +56 -0
  368. package/dist/cjs/src/prediction/types.d.ts +95 -0
  369. package/dist/cjs/src/prediction/types.js +2 -0
  370. package/dist/cjs/src/prediction/user/account.d.ts +2 -0
  371. package/dist/cjs/src/prediction/user/account.js +17 -0
  372. package/dist/cjs/src/prediction/user/admin.d.ts +6 -0
  373. package/dist/cjs/src/prediction/user/admin.js +19 -0
  374. package/dist/cjs/src/prediction/user/gift.d.ts +2 -0
  375. package/dist/cjs/src/prediction/user/gift.js +24 -0
  376. package/dist/cjs/src/prediction/user/index.d.ts +5 -0
  377. package/dist/cjs/src/prediction/user/index.js +60 -0
  378. package/dist/cjs/src/prediction/user/keeper.d.ts +2 -0
  379. package/dist/cjs/src/prediction/user/keeper.js +13 -0
  380. package/dist/cjs/src/prediction/user/order.d.ts +2 -0
  381. package/dist/cjs/src/prediction/user/order.js +6 -0
  382. package/dist/cjs/src/prediction/user/position.d.ts +2 -0
  383. package/dist/cjs/src/prediction/user/position.js +11 -0
  384. package/dist/cjs/src/prediction/utils/bcs.d.ts +6 -0
  385. package/dist/cjs/src/prediction/utils/bcs.js +29 -0
  386. package/dist/cjs/src/prediction/utils/index.d.ts +8 -0
  387. package/dist/cjs/src/prediction/utils/index.js +31 -0
  388. package/dist/cjs/src/prediction/utils.d.ts +30 -0
  389. package/dist/cjs/src/prediction/utils.js +200 -0
  390. package/dist/cjs/src/sdk.d.ts +22 -0
  391. package/dist/cjs/src/sdk.js +62 -0
  392. package/dist/cjs/src/unified-client.d.ts +402 -0
  393. package/dist/cjs/src/unified-client.js +218 -0
  394. package/dist/cjs/src/utils/config.d.ts +11 -0
  395. package/dist/cjs/src/utils/config.js +19 -0
  396. package/dist/cjs/src/utils/math.d.ts +287 -0
  397. package/dist/cjs/src/utils/math.js +469 -0
  398. package/package.json +119 -31
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Perp config-schema views — read-only lookups over the parsed `waterx-config`
3
+ * JSON, with no transport dependency.
4
+ *
5
+ * Split off the transport client (`PerpClient`) so the two responsibilities stay
6
+ * separate: `BaseLineClient` owns the gRPC half, this class owns the
7
+ * canonical-schema half. `PerpClient` composes one of these and delegates, so
8
+ * callers keep calling `client.getMarket(...)` / `client.wlpType()` unchanged.
9
+ * Tested in isolation against a plain config object — no network needed.
10
+ */
11
+ import type { NativeCustodyAsset, WaterXConfig, WormholeInfraConfig } from "./config.ts";
12
+ export declare class PerpConfigView {
13
+ private readonly getConfig;
14
+ private readonly getWormhole;
15
+ constructor(getConfig: () => WaterXConfig, getWormhole: () => WormholeInfraConfig);
16
+ private get config();
17
+ private get wormhole();
18
+ /** `waterx_perp.markets[ticker]`, throws if unknown. */
19
+ getMarket(ticker: string): import("./config.ts").WaterxPerpMarketEntry;
20
+ /** `waterx_oracle.aggregators[ticker]`, throws if unknown. */
21
+ getAggregator(ticker: string): string;
22
+ /** `pyth_rule.feeds[ticker]`, throws if unknown. */
23
+ getPythFeed(ticker: string): {
24
+ feed_id: string;
25
+ price_info_object: string;
26
+ };
27
+ /**
28
+ * True when `ticker` is priced by `constant_rule` (a constant pin,
29
+ * e.g. `USDCUSD → $1`) rather than Pyth. Such tickers are fed via
30
+ * `constant_rule::feed` and need no Pyth update; see {@link refreshOraclePrices}.
31
+ *
32
+ * All-or-nothing, mirroring {@link getSupraRule} and the keeper: only routes a
33
+ * ticker to the constant rule when the rule is FULLY wired (`published_at` +
34
+ * `config` present). A half-populated block — a `feeds` entry listed before the
35
+ * rule is deployed, a realistic mid-rollout state — would otherwise make this
36
+ * true while {@link aggregateTicker} throws, aborting the whole price-refresh PTB
37
+ * instead of safely falling back to Pyth.
38
+ *
39
+ * Whether a constant ticker is *also* Pyth-fed (the dual-feed transition state)
40
+ * or constant-only is not a separate flag — it falls out of whether the ticker
41
+ * still has a `pyth_rule.feeds` entry. {@link aggregateTicker} feeds each rule the
42
+ * ticker is configured for, so no `isDualFeed` / `isConstantOnly` predicate is needed.
43
+ */
44
+ isConstantTicker(ticker: string): boolean;
45
+ /**
46
+ * The `supra_rule` config when it is deployed, enabled, and fully wired
47
+ * (`config` + `oracle_holder`), else `undefined`. When present, callers feed
48
+ * `supra_rule::feed` as a second weighted rule alongside Pyth on the same
49
+ * collector; see {@link refreshOraclePrices}. Default-off, so a Pyth-only
50
+ * deployment returns `undefined` here.
51
+ */
52
+ getSupraRule(): {
53
+ published_at: string;
54
+ config: string;
55
+ oracle_holder: string;
56
+ } | undefined;
57
+ /**
58
+ * Resolve a WLP pool token's fully-qualified Move type.
59
+ *
60
+ * `wlp.pool_tokens` is keyed by **oracle ticker** (e.g. `"USDCUSD"`) — the
61
+ * Rust keeper requires this, since it reuses each key to look up the token's
62
+ * aggregator + pyth feed. For ergonomics this also accepts the coin symbol
63
+ * (the trailing `::Struct` segment, e.g. `"USD"` → `…::usd::USD`): an exact
64
+ * ticker hit wins, otherwise we match by coin name. Throws if neither hits.
65
+ */
66
+ getPoolTokenType(tickerOrName: string): string;
67
+ /** Fully-qualified WLP coin type derived from `wlp.original_id`. */
68
+ wlpType(): string;
69
+ /**
70
+ * List of rewarders registered for a staking pool alias, e.g. `"WLP"`.
71
+ * Returns an empty array if the deployment has no rewarders configured.
72
+ * Each entry carries the rewarder shared object ID + the fully-qualified
73
+ * reward coin type, so callers don't need a separate alias-to-type lookup.
74
+ */
75
+ getRewarders(stakeAlias: string): {
76
+ alias: string;
77
+ rewarder_id: string;
78
+ coin_type: string;
79
+ decimals: number;
80
+ }[];
81
+ /** Type list of every reward coin for a stake pool — convenience for stake/unstake/claim. */
82
+ getRewarderTypes(stakeAlias: string): string[];
83
+ /** `waterx_credit` package entry, throws if the deployment has no bridge. */
84
+ getCredit(): import("./config.ts").WaterxCreditPackage;
85
+ /**
86
+ * Fully-qualified CREDIT coin Move type, taken verbatim from
87
+ * `waterx_credit.credit_type` (e.g. `0x..::usd::USD`). Throws if absent —
88
+ * the deprecated `usdx` OTW package is intentionally not consulted.
89
+ */
90
+ creditType(): string;
91
+ /** `wormhole_bridge` package entry, throws if absent. */
92
+ getBridge(): import("./config.ts").WormholeBridgePackage;
93
+ /**
94
+ * Sui Wormhole `State` object id — prefers the per-deployment
95
+ * `wormhole_bridge.wormhole_state`, falls back to the line's `wormhole` infra.
96
+ */
97
+ wormholeStateId(): string;
98
+ /** All native-custody backing-asset rows (throws if no custody vault). */
99
+ getNativeAssets(): readonly NativeCustodyAsset[];
100
+ /** A native-custody asset row by its fully-qualified Move type, throws if unknown. */
101
+ getNativeAsset(moveType: string): NativeCustodyAsset;
102
+ }
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ /**
3
+ * Perp config-schema views — read-only lookups over the parsed `waterx-config`
4
+ * JSON, with no transport dependency.
5
+ *
6
+ * Split off the transport client (`PerpClient`) so the two responsibilities stay
7
+ * separate: `BaseLineClient` owns the gRPC half, this class owns the
8
+ * canonical-schema half. `PerpClient` composes one of these and delegates, so
9
+ * callers keep calling `client.getMarket(...)` / `client.wlpType()` unchanged.
10
+ * Tested in isolation against a plain config object — no network needed.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.PerpConfigView = void 0;
14
+ class PerpConfigView {
15
+ getConfig;
16
+ getWormhole;
17
+ // Config/wormhole are read through providers, not captured by value, so a later
18
+ // `client.config = …` reassignment stays live (matches the pre-split behaviour
19
+ // where every lookup read `this.config` fresh).
20
+ constructor(getConfig, getWormhole) {
21
+ this.getConfig = getConfig;
22
+ this.getWormhole = getWormhole;
23
+ }
24
+ get config() {
25
+ return this.getConfig();
26
+ }
27
+ get wormhole() {
28
+ return this.getWormhole();
29
+ }
30
+ /** `waterx_perp.markets[ticker]`, throws if unknown. */
31
+ getMarket(ticker) {
32
+ const m = this.config.packages.waterx_perp?.markets?.[ticker];
33
+ if (!m)
34
+ throw new Error(`Unknown market ticker: ${ticker}`);
35
+ return m;
36
+ }
37
+ /** `waterx_oracle.aggregators[ticker]`, throws if unknown. */
38
+ getAggregator(ticker) {
39
+ const a = this.config.packages.waterx_oracle?.aggregators?.[ticker];
40
+ if (!a)
41
+ throw new Error(`No aggregator listed for ticker: ${ticker}`);
42
+ return a;
43
+ }
44
+ /** `pyth_rule.feeds[ticker]`, throws if unknown. */
45
+ getPythFeed(ticker) {
46
+ const f = this.config.packages.pyth_rule?.feeds?.[ticker];
47
+ if (!f)
48
+ throw new Error(`No pyth feed listed for ticker: ${ticker}`);
49
+ return f;
50
+ }
51
+ /**
52
+ * True when `ticker` is priced by `constant_rule` (a constant pin,
53
+ * e.g. `USDCUSD → $1`) rather than Pyth. Such tickers are fed via
54
+ * `constant_rule::feed` and need no Pyth update; see {@link refreshOraclePrices}.
55
+ *
56
+ * All-or-nothing, mirroring {@link getSupraRule} and the keeper: only routes a
57
+ * ticker to the constant rule when the rule is FULLY wired (`published_at` +
58
+ * `config` present). A half-populated block — a `feeds` entry listed before the
59
+ * rule is deployed, a realistic mid-rollout state — would otherwise make this
60
+ * true while {@link aggregateTicker} throws, aborting the whole price-refresh PTB
61
+ * instead of safely falling back to Pyth.
62
+ *
63
+ * Whether a constant ticker is *also* Pyth-fed (the dual-feed transition state)
64
+ * or constant-only is not a separate flag — it falls out of whether the ticker
65
+ * still has a `pyth_rule.feeds` entry. {@link aggregateTicker} feeds each rule the
66
+ * ticker is configured for, so no `isDualFeed` / `isConstantOnly` predicate is needed.
67
+ */
68
+ isConstantTicker(ticker) {
69
+ const c = this.config.packages.constant_rule;
70
+ if (!c?.published_at || !c.config)
71
+ return false;
72
+ return c.feeds?.[ticker] !== undefined;
73
+ }
74
+ /**
75
+ * The `supra_rule` config when it is deployed, enabled, and fully wired
76
+ * (`config` + `oracle_holder`), else `undefined`. When present, callers feed
77
+ * `supra_rule::feed` as a second weighted rule alongside Pyth on the same
78
+ * collector; see {@link refreshOraclePrices}. Default-off, so a Pyth-only
79
+ * deployment returns `undefined` here.
80
+ */
81
+ getSupraRule() {
82
+ const s = this.config.packages.supra_rule;
83
+ if (!s?.enabled || !s.published_at || !s.config || !s.oracle_holder)
84
+ return undefined;
85
+ return { published_at: s.published_at, config: s.config, oracle_holder: s.oracle_holder };
86
+ }
87
+ /**
88
+ * Resolve a WLP pool token's fully-qualified Move type.
89
+ *
90
+ * `wlp.pool_tokens` is keyed by **oracle ticker** (e.g. `"USDCUSD"`) — the
91
+ * Rust keeper requires this, since it reuses each key to look up the token's
92
+ * aggregator + pyth feed. For ergonomics this also accepts the coin symbol
93
+ * (the trailing `::Struct` segment, e.g. `"USD"` → `…::usd::USD`): an exact
94
+ * ticker hit wins, otherwise we match by coin name. Throws if neither hits.
95
+ */
96
+ getPoolTokenType(tickerOrName) {
97
+ const poolTokens = this.config.packages.wlp?.pool_tokens ?? {};
98
+ const exact = poolTokens[tickerOrName];
99
+ if (exact)
100
+ return exact;
101
+ for (const t of Object.values(poolTokens)) {
102
+ if (typeof t === "string" && t.split("::").pop() === tickerOrName)
103
+ return t;
104
+ }
105
+ throw new Error(`No pool token registered for ticker/name: ${tickerOrName}`);
106
+ }
107
+ /** Fully-qualified WLP coin type derived from `wlp.original_id`. */
108
+ wlpType() {
109
+ const w = this.config.packages.wlp;
110
+ if (!w?.original_id)
111
+ throw new Error("wlp.original_id missing from config");
112
+ return `${w.original_id}::wlp::WLP`;
113
+ }
114
+ /**
115
+ * List of rewarders registered for a staking pool alias, e.g. `"WLP"`.
116
+ * Returns an empty array if the deployment has no rewarders configured.
117
+ * Each entry carries the rewarder shared object ID + the fully-qualified
118
+ * reward coin type, so callers don't need a separate alias-to-type lookup.
119
+ */
120
+ getRewarders(stakeAlias) {
121
+ const map = this.config.packages.waterx_staking?.rewarders?.[stakeAlias];
122
+ if (!map)
123
+ return [];
124
+ return Object.entries(map).map(([alias, entry]) => ({ alias, ...entry }));
125
+ }
126
+ /** Type list of every reward coin for a stake pool — convenience for stake/unstake/claim. */
127
+ getRewarderTypes(stakeAlias) {
128
+ return this.getRewarders(stakeAlias).map((r) => r.coin_type);
129
+ }
130
+ /** `waterx_credit` package entry, throws if the deployment has no bridge. */
131
+ getCredit() {
132
+ const c = this.config.packages.waterx_credit;
133
+ if (!c)
134
+ throw new Error("waterx_credit not configured for this deployment");
135
+ return c;
136
+ }
137
+ /**
138
+ * Fully-qualified CREDIT coin Move type, taken verbatim from
139
+ * `waterx_credit.credit_type` (e.g. `0x..::usd::USD`). Throws if absent —
140
+ * the deprecated `usdx` OTW package is intentionally not consulted.
141
+ */
142
+ creditType() {
143
+ const t = this.config.packages.waterx_credit?.credit_type;
144
+ if (!t) {
145
+ throw new Error("creditType: packages.waterx_credit.credit_type missing from config");
146
+ }
147
+ return t;
148
+ }
149
+ /** `wormhole_bridge` package entry, throws if absent. */
150
+ getBridge() {
151
+ const b = this.config.packages.wormhole_bridge;
152
+ if (!b)
153
+ throw new Error("wormhole_bridge not configured for this deployment");
154
+ return b;
155
+ }
156
+ /**
157
+ * Sui Wormhole `State` object id — prefers the per-deployment
158
+ * `wormhole_bridge.wormhole_state`, falls back to the line's `wormhole` infra.
159
+ */
160
+ wormholeStateId() {
161
+ return this.config.packages.wormhole_bridge?.wormhole_state ?? this.wormhole.state_id;
162
+ }
163
+ /** All native-custody backing-asset rows (throws if no custody vault). */
164
+ getNativeAssets() {
165
+ const nc = this.config.packages.native_custody;
166
+ if (!nc)
167
+ throw new Error("native_custody not configured for this deployment");
168
+ return nc.assets;
169
+ }
170
+ /** A native-custody asset row by its fully-qualified Move type, throws if unknown. */
171
+ getNativeAsset(moveType) {
172
+ const row = this.getNativeAssets().find((a) => a.type === moveType);
173
+ if (!row)
174
+ throw new Error(`No native custody asset registered for type: ${moveType}`);
175
+ return row;
176
+ }
177
+ }
178
+ exports.PerpConfigView = PerpConfigView;
@@ -0,0 +1,126 @@
1
+ /**
2
+ * WaterX deployment config — fetched at client init from the canonical
3
+ * `waterx-config` repo (default: GitHub raw).
4
+ *
5
+ * The schema mirrors the canonical JSON layout one-to-one (each package
6
+ * groups its own object IDs + per-ticker maps). External chain infra
7
+ * (Pyth state, Wormhole state/core, Hermes & Wormholescan endpoints) is
8
+ * **not** in the JSON — it lives in `PYTH_DEFAULTS` / `WORMHOLE_DEFAULTS`
9
+ * below, keyed by network.
10
+ */
11
+ import type { AccountPackages, BasePackageEntry, WormholeInfraConfig } from "../account/config.ts";
12
+ import type { OraclePackages, PythInfraConfig } from "../oracle/config.ts";
13
+ import type { Network } from "./constants.ts";
14
+ export type { AccountConfig, AccountPackages, BasePackageEntry, NativeCustodyAsset, NativeCustodyPackage, TrustedEmitterRow, WaterxCreditPackage, WaterxReferralPackage, WithdrawalQueuePackage, WormholeBridgePackage, WormholeInfraConfig, WxaAccountPackage, } from "../account/config.ts";
15
+ export type { ConstantFeedEntry, OracleConfig, OraclePackages, PythInfraConfig, PythRulePackage, PythSponsorRulePackage, SupraFeedEntry, SupraRulePackage, WaterxConstantRulePackage, WaterxOraclePackage, } from "../oracle/config.ts";
16
+ export { PYTH_DEFAULTS } from "../oracle/config.ts";
17
+ export interface WaterxPerpMarketEntry {
18
+ market: string;
19
+ config: string;
20
+ }
21
+ export interface WaterxPerpPackage extends BasePackageEntry {
22
+ admin_cap: string;
23
+ global_config: string;
24
+ market_registry_wlp: string;
25
+ markets: Record<string, WaterxPerpMarketEntry>;
26
+ }
27
+ export interface RewarderEntry {
28
+ /** `Rewarder<STAKE, R>` shared object ID. */
29
+ rewarder_id: string;
30
+ /** Fully-qualified reward coin Move type (e.g. `0x2::sui::SUI`). */
31
+ coin_type: string;
32
+ /** Reward coin display decimals. */
33
+ decimals: number;
34
+ }
35
+ export interface WaterxStakingPackage extends BasePackageEntry {
36
+ admin_cap?: string;
37
+ /** Map of stake-type alias (e.g. `"WLP"`) → `StakingPool<STAKE>` shared object ID. */
38
+ pools?: Record<string, string>;
39
+ /**
40
+ * Map of stake-type alias → reward-token alias → rewarder metadata.
41
+ * Reward-token alias is display-only (e.g. `"SUI"`, `"MOCK_SUI"`); the
42
+ * fully-qualified coin Move type lives on the {@link RewarderEntry}.
43
+ */
44
+ rewarders?: Record<string, Record<string, RewarderEntry>>;
45
+ }
46
+ export interface WlpPackage extends BasePackageEntry {
47
+ metadata_cap?: string;
48
+ currency?: string;
49
+ wlp_pool: string;
50
+ /** Optional `WlpAum<LP>` shared object; required by `mint_wlp` / `settle_redeem`. */
51
+ wlp_aum?: string;
52
+ /** Map of oracle ticker → fully-qualified Move type registered via `lp_pool::add_token`. */
53
+ pool_tokens: Record<string, string>;
54
+ }
55
+ export interface MockCoinPackage extends BasePackageEntry {
56
+ currency?: string;
57
+ treasury_cap?: string;
58
+ metadata_cap?: string;
59
+ }
60
+ export interface TestnetFaucetPackage {
61
+ published_at: string;
62
+ whitelist?: string[];
63
+ faucet?: string;
64
+ }
65
+ export interface WaterXPackages extends AccountPackages, OraclePackages {
66
+ waterx_perp: WaterxPerpPackage;
67
+ waterx_perp_view: BasePackageEntry;
68
+ waterx_staking?: WaterxStakingPackage;
69
+ wlp: WlpPackage;
70
+ testnet_faucet?: TestnetFaucetPackage;
71
+ mock_usdc?: MockCoinPackage;
72
+ mock_usdsui?: MockCoinPackage;
73
+ mock_sui?: MockCoinPackage;
74
+ waterx_rule?: BasePackageEntry;
75
+ waterx_rule_nautilus_enclave?: BasePackageEntry;
76
+ }
77
+ export declare const WORMHOLE_DEFAULTS: Record<Network, WormholeInfraConfig>;
78
+ export interface WaterXConfig {
79
+ /** Absent on credit-only deployment files. */
80
+ network?: "mainnet" | "testnet";
81
+ chain_id?: string | number | null;
82
+ /** Sui gRPC base URL (default: public Mysten fullnode for the network). */
83
+ grpcUrl?: string;
84
+ packages: WaterXPackages;
85
+ /** Pyth infra override (defaults from `PYTH_DEFAULTS[network]`). */
86
+ pyth?: PythInfraConfig;
87
+ /** Wormhole infra override (defaults from `WORMHOLE_DEFAULTS[network]`). */
88
+ wormhole?: WormholeInfraConfig;
89
+ /** Sui `CoinRegistry` shared object (credit deployments). */
90
+ coin_registry?: string;
91
+ /** Per-module credit supply caps (credit deployments). */
92
+ credit_caps?: Record<string, string>;
93
+ /** Deploy-script phase completion flags (credit deployments). */
94
+ done?: Record<string, boolean>;
95
+ }
96
+ export interface LoadConfigOptions {
97
+ /**
98
+ * Override the default config URL. Use this to point at a staging branch
99
+ * (`?ref=staging`) or a local mirror during development. Takes precedence
100
+ * over {@link configRef}.
101
+ */
102
+ configUrl?: string;
103
+ /**
104
+ * Pin the canonical config to a specific git ref — a commit SHA, branch,
105
+ * or tag — instead of the default `main` branch. Resolves to
106
+ * `https://raw.githubusercontent.com/WaterXProtocol/waterx-config/<ref>/<network>.json`.
107
+ * Ignored when {@link configUrl} is set.
108
+ */
109
+ configRef?: string;
110
+ /**
111
+ * Reuse a previously-fetched config from the in-memory cache (keyed by
112
+ * the effective URL). Default: false (always fetch fresh).
113
+ */
114
+ cache?: boolean;
115
+ /** Optional fetch implementation (for tests or environments without global `fetch`). */
116
+ fetchImpl?: typeof fetch;
117
+ /** Optional request timeout in ms. Default 10_000. */
118
+ timeoutMs?: number;
119
+ }
120
+ /**
121
+ * Build the canonical config URL for `network`, optionally pinned to a
122
+ * specific git `ref` (commit SHA, branch, or tag). Defaults to `main`.
123
+ */
124
+ export declare function defaultConfigUrl(network: Network, ref?: string): string;
125
+ export declare function clearConfigCache(): void;
126
+ export declare function loadConfig(network: Network, opts?: LoadConfigOptions): Promise<WaterXConfig>;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ /**
3
+ * WaterX deployment config — fetched at client init from the canonical
4
+ * `waterx-config` repo (default: GitHub raw).
5
+ *
6
+ * The schema mirrors the canonical JSON layout one-to-one (each package
7
+ * groups its own object IDs + per-ticker maps). External chain infra
8
+ * (Pyth state, Wormhole state/core, Hermes & Wormholescan endpoints) is
9
+ * **not** in the JSON — it lives in `PYTH_DEFAULTS` / `WORMHOLE_DEFAULTS`
10
+ * below, keyed by network.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.WORMHOLE_DEFAULTS = exports.PYTH_DEFAULTS = void 0;
14
+ exports.defaultConfigUrl = defaultConfigUrl;
15
+ exports.clearConfigCache = clearConfigCache;
16
+ exports.loadConfig = loadConfig;
17
+ var config_ts_1 = require("../oracle/config.js");
18
+ Object.defineProperty(exports, "PYTH_DEFAULTS", { enumerable: true, get: function () { return config_ts_1.PYTH_DEFAULTS; } });
19
+ // ============================================================================
20
+ // Wormhole / Hermes — external chain infra, defaults by network
21
+ // ============================================================================
22
+ //
23
+ // `PythInfraConfig` + `PYTH_DEFAULTS` live in `oracle/config.ts` (shared infra)
24
+ // and are re-exported at the top of this file.
25
+ // `WormholeInfraConfig` is defined in `account/config.ts` (funding base) and
26
+ // re-exported at the top of this file. `state_id` is the same shared Sui
27
+ // Wormhole `State` object Pyth uses (kept in sync with
28
+ // `PYTH_DEFAULTS[*].wormhole_state_id`).
29
+ exports.WORMHOLE_DEFAULTS = {
30
+ MAINNET: {
31
+ state_id: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",
32
+ core_package: "0x5306f64e312b581766351c07af79c72fcb1cd25147157fdc2f8ad76de9a3fb6a",
33
+ sui_chain_id: 21,
34
+ wormholescan_api: "https://api.wormholescan.io/api/v1",
35
+ },
36
+ TESTNET: {
37
+ state_id: "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",
38
+ core_package: "0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94",
39
+ sui_chain_id: 21,
40
+ wormholescan_api: "https://api.testnet.wormholescan.io/api/v1",
41
+ },
42
+ };
43
+ const CONFIG_REPO_RAW_BASE = "https://raw.githubusercontent.com/WaterXProtocol/waterx-config";
44
+ /** Default git ref for the canonical config when none is pinned. */
45
+ const DEFAULT_CONFIG_REF = "main";
46
+ /**
47
+ * Build the canonical config URL for `network`, optionally pinned to a
48
+ * specific git `ref` (commit SHA, branch, or tag). Defaults to `main`.
49
+ */
50
+ function defaultConfigUrl(network, ref = DEFAULT_CONFIG_REF) {
51
+ return `${CONFIG_REPO_RAW_BASE}/${ref}/${network.toLowerCase()}.json`;
52
+ }
53
+ const cache = new Map();
54
+ function clearConfigCache() {
55
+ cache.clear();
56
+ }
57
+ async function loadConfig(network, opts = {}) {
58
+ const url = opts.configUrl ?? defaultConfigUrl(network, opts.configRef);
59
+ if (opts.cache && cache.has(url)) {
60
+ return cache.get(url);
61
+ }
62
+ const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
63
+ if (!fetchImpl) {
64
+ throw new Error("loadConfig: no global `fetch` available; pass opts.fetchImpl");
65
+ }
66
+ const controller = new AbortController();
67
+ const timer = setTimeout(() => controller.abort(), opts.timeoutMs ?? 10_000);
68
+ let response;
69
+ try {
70
+ response = await fetchImpl(url, { signal: controller.signal });
71
+ }
72
+ finally {
73
+ clearTimeout(timer);
74
+ }
75
+ if (!response.ok) {
76
+ throw new Error(`loadConfig: HTTP ${response.status} fetching ${url}`);
77
+ }
78
+ const raw = (await response.json());
79
+ validateConfig(raw, network, url);
80
+ if (opts.cache)
81
+ cache.set(url, raw);
82
+ return raw;
83
+ }
84
+ function validateConfig(cfg, expected, url) {
85
+ // `network` is only present on perp deployment files; credit-only files
86
+ // omit it. Enforce the guard only when the field is present.
87
+ if (cfg.network !== undefined && cfg.network !== expected.toLowerCase()) {
88
+ throw new Error(`loadConfig: config at ${url} declares network=${cfg.network} but caller asked for ${expected}`);
89
+ }
90
+ if (!cfg.packages || typeof cfg.packages !== "object") {
91
+ throw new Error(`loadConfig: config at ${url} has no packages object`);
92
+ }
93
+ const hasPublishedAt = (k) => {
94
+ const entry = cfg.packages[k];
95
+ return !!entry && typeof entry === "object" && !!entry.published_at;
96
+ };
97
+ // Validate by deployment kind. A perp config must carry the perp set; a
98
+ // credit config the credit set. `waterx_account` is common to both.
99
+ const isPerp = "waterx_perp" in cfg.packages;
100
+ const isCredit = "waterx_credit" in cfg.packages || "wormhole_bridge" in cfg.packages;
101
+ const required = isPerp
102
+ ? [
103
+ "bucket_framework",
104
+ "pyth_rule",
105
+ "waterx_account",
106
+ "waterx_oracle",
107
+ "waterx_perp",
108
+ "waterx_perp_view",
109
+ "wlp",
110
+ ]
111
+ : isCredit
112
+ ? ["bucket_framework", "waterx_account", "waterx_credit"]
113
+ : ["bucket_framework", "waterx_account"];
114
+ for (const k of required) {
115
+ if (!hasPublishedAt(k)) {
116
+ throw new Error(`loadConfig: config at ${url} missing packages.${k}.published_at`);
117
+ }
118
+ }
119
+ }
@@ -0,0 +1,49 @@
1
+ export * from "../constants.ts";
2
+ /** Default crypto market trading fee rate (3 bps). Per-market value lives in MarketConfig. */
3
+ export declare const CRYPTO_FEE_RATE = 0.0003;
4
+ /** Default stock / commodity market trading fee rate (5 bps). Per-market value lives in MarketConfig. */
5
+ export declare const STOCK_FEE_RATE = 0.0005;
6
+ /** Default maintenance margin rate (150 bps = 1.5%). Per-market value lives in MarketConfig. */
7
+ export declare const MAINTENANCE_MARGIN_RATE = 0.015;
8
+ export declare const PERM_OPEN_POSITION = 1;
9
+ export declare const PERM_CLOSE_POSITION = 2;
10
+ export declare const PERM_INCREASE_POSITION = 4;
11
+ export declare const PERM_DECREASE_POSITION = 8;
12
+ export declare const PERM_PLACE_ORDER = 16;
13
+ export declare const PERM_CANCEL_ORDER = 32;
14
+ export declare const PERM_DEPOSIT_COLLATERAL = 64;
15
+ export declare const PERM_WITHDRAW_COLLATERAL = 128;
16
+ export declare const PERM_MINT_WLP = 256;
17
+ export declare const PERM_REDEEM_WLP = 512;
18
+ export declare const PERM_ALL_TRADING = 255;
19
+ export declare const PERM_ALL = 65535;
20
+ export declare const STAKING_PERM_DEPOSIT_STAKE: number;
21
+ export declare const STAKING_PERM_REDEEM_STAKE: number;
22
+ export declare const STAKING_PERM_CLAIM_REWARD: number;
23
+ export declare const STAKING_PERM_ALL: number;
24
+ export declare const ORDER_LIMIT_BUY = 0;
25
+ export declare const ORDER_LIMIT_SELL = 1;
26
+ export declare const ORDER_STOP_BUY = 2;
27
+ export declare const ORDER_STOP_SELL = 3;
28
+ /** Wildcard tag accepted by `cancel_order_request` — scans all 4 books. */
29
+ export declare const ORDER_TAG_WILDCARD = 255;
30
+ export declare const ACTION_OPEN_POSITION = 0;
31
+ export declare const ACTION_CLOSE_POSITION = 1;
32
+ export declare const ACTION_PLACE_ORDER = 2;
33
+ export declare const ACTION_CANCEL_ORDER = 3;
34
+ export declare const ACTION_DEPOSIT_COLLATERAL = 4;
35
+ export declare const ACTION_WITHDRAW_COLLATERAL = 5;
36
+ export declare const ACTION_LIQUIDATE = 6;
37
+ export declare const ACTION_INCREASE_POSITION = 7;
38
+ export declare const ACTION_DECREASE_POSITION = 8;
39
+ export declare const ACTION_UPDATE_ORDER = 9;
40
+ export declare const ACTION_CANCEL_PRE_ORDER = 10;
41
+ export declare const ACTION_ADD_PRE_ORDER = 11;
42
+ /**
43
+ * Well-known address of Sui's native funds-accumulator root shared object
44
+ * (`@0xacc` in the framework). Pass this to `request_deposit_from_funds<T>`
45
+ * to drain `Balance<T>` parked at an account's address. Defined in
46
+ * `account/constants.ts` (account-framework constant); re-exported here for
47
+ * back-compat.
48
+ */
49
+ export { ACCUMULATOR_ROOT } from "../account/constants.ts";
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ // Perp-line domain constants (trading permissions / order tags / action codes /
3
+ // fee rates / well-known addresses). Re-exports the shared primitives from
4
+ // `../constants.ts` so perp code and the `./perp` barrel get the full set from
5
+ // a single import.
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ACCUMULATOR_ROOT = exports.ACTION_ADD_PRE_ORDER = exports.ACTION_CANCEL_PRE_ORDER = exports.ACTION_UPDATE_ORDER = exports.ACTION_DECREASE_POSITION = exports.ACTION_INCREASE_POSITION = exports.ACTION_LIQUIDATE = exports.ACTION_WITHDRAW_COLLATERAL = exports.ACTION_DEPOSIT_COLLATERAL = exports.ACTION_CANCEL_ORDER = exports.ACTION_PLACE_ORDER = exports.ACTION_CLOSE_POSITION = exports.ACTION_OPEN_POSITION = exports.ORDER_TAG_WILDCARD = exports.ORDER_STOP_SELL = exports.ORDER_STOP_BUY = exports.ORDER_LIMIT_SELL = exports.ORDER_LIMIT_BUY = exports.STAKING_PERM_ALL = exports.STAKING_PERM_CLAIM_REWARD = exports.STAKING_PERM_REDEEM_STAKE = exports.STAKING_PERM_DEPOSIT_STAKE = exports.PERM_ALL = exports.PERM_ALL_TRADING = exports.PERM_REDEEM_WLP = exports.PERM_MINT_WLP = exports.PERM_WITHDRAW_COLLATERAL = exports.PERM_DEPOSIT_COLLATERAL = exports.PERM_CANCEL_ORDER = exports.PERM_PLACE_ORDER = exports.PERM_DECREASE_POSITION = exports.PERM_INCREASE_POSITION = exports.PERM_CLOSE_POSITION = exports.PERM_OPEN_POSITION = exports.MAINTENANCE_MARGIN_RATE = exports.STOCK_FEE_RATE = exports.CRYPTO_FEE_RATE = void 0;
22
+ __exportStar(require("../constants.js"), exports);
23
+ // ======== Fee rates & risk parameters ========
24
+ /** Default crypto market trading fee rate (3 bps). Per-market value lives in MarketConfig. */
25
+ exports.CRYPTO_FEE_RATE = 0.0003;
26
+ /** Default stock / commodity market trading fee rate (5 bps). Per-market value lives in MarketConfig. */
27
+ exports.STOCK_FEE_RATE = 0.0005;
28
+ /** Default maintenance margin rate (150 bps = 1.5%). Per-market value lives in MarketConfig. */
29
+ exports.MAINTENANCE_MARGIN_RATE = 0.015;
30
+ // ======== Permission Bitmasks (matches account_data.move) ========
31
+ exports.PERM_OPEN_POSITION = 1;
32
+ exports.PERM_CLOSE_POSITION = 2;
33
+ exports.PERM_INCREASE_POSITION = 4;
34
+ exports.PERM_DECREASE_POSITION = 8;
35
+ exports.PERM_PLACE_ORDER = 16;
36
+ exports.PERM_CANCEL_ORDER = 32;
37
+ exports.PERM_DEPOSIT_COLLATERAL = 64;
38
+ exports.PERM_WITHDRAW_COLLATERAL = 128;
39
+ exports.PERM_MINT_WLP = 256;
40
+ exports.PERM_REDEEM_WLP = 512;
41
+ exports.PERM_ALL_TRADING = 0xff;
42
+ exports.PERM_ALL = 0xffff;
43
+ // ======== Staking Permission Bitmasks (matches waterx_staking.move) ========
44
+ exports.STAKING_PERM_DEPOSIT_STAKE = 1 << 0;
45
+ exports.STAKING_PERM_REDEEM_STAKE = 1 << 1;
46
+ exports.STAKING_PERM_CLAIM_REWARD = 1 << 2;
47
+ exports.STAKING_PERM_ALL = exports.STAKING_PERM_DEPOSIT_STAKE | exports.STAKING_PERM_REDEEM_STAKE | exports.STAKING_PERM_CLAIM_REWARD;
48
+ // ======== Order Type Tags ========
49
+ exports.ORDER_LIMIT_BUY = 0;
50
+ exports.ORDER_LIMIT_SELL = 1;
51
+ exports.ORDER_STOP_BUY = 2;
52
+ exports.ORDER_STOP_SELL = 3;
53
+ /** Wildcard tag accepted by `cancel_order_request` — scans all 4 books. */
54
+ exports.ORDER_TAG_WILDCARD = 255;
55
+ // ======== Action Type Constants (request.move) ========
56
+ exports.ACTION_OPEN_POSITION = 0;
57
+ exports.ACTION_CLOSE_POSITION = 1;
58
+ exports.ACTION_PLACE_ORDER = 2;
59
+ exports.ACTION_CANCEL_ORDER = 3;
60
+ exports.ACTION_DEPOSIT_COLLATERAL = 4;
61
+ exports.ACTION_WITHDRAW_COLLATERAL = 5;
62
+ exports.ACTION_LIQUIDATE = 6;
63
+ exports.ACTION_INCREASE_POSITION = 7;
64
+ exports.ACTION_DECREASE_POSITION = 8;
65
+ exports.ACTION_UPDATE_ORDER = 9;
66
+ exports.ACTION_CANCEL_PRE_ORDER = 10;
67
+ exports.ACTION_ADD_PRE_ORDER = 11;
68
+ // ======== Misc ========
69
+ // `DRY_RUN_SENDER` (zero-address simulate sender) is a shared primitive defined
70
+ // in `../constants.ts` and re-exported via the `export *` above.
71
+ /**
72
+ * Well-known address of Sui's native funds-accumulator root shared object
73
+ * (`@0xacc` in the framework). Pass this to `request_deposit_from_funds<T>`
74
+ * to drain `Balance<T>` parked at an account's address. Defined in
75
+ * `account/constants.ts` (account-framework constant); re-exported here for
76
+ * back-compat.
77
+ */
78
+ var constants_ts_1 = require("../account/constants.js");
79
+ Object.defineProperty(exports, "ACCUMULATOR_ROOT", { enumerable: true, get: function () { return constants_ts_1.ACCUMULATOR_ROOT; } });