@waterx/sdk 2.1.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 (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -0
  3. package/dist/src/client.d.ts +109 -0
  4. package/dist/src/client.js +197 -0
  5. package/dist/src/config.d.ts +229 -0
  6. package/dist/src/config.js +107 -0
  7. package/dist/src/constants.d.ts +64 -0
  8. package/dist/src/constants.js +71 -0
  9. package/dist/src/fetch.d.ts +144 -0
  10. package/dist/src/fetch.js +419 -0
  11. package/dist/src/generated/bucket_v2_framework/account.d.ts +107 -0
  12. package/dist/src/generated/bucket_v2_framework/account.js +129 -0
  13. package/dist/src/generated/bucket_v2_framework/deps/std/type_name.d.ts +17 -0
  14. package/dist/src/generated/bucket_v2_framework/deps/std/type_name.js +19 -0
  15. package/dist/src/generated/bucket_v2_framework/deps/sui/balance.d.ts +12 -0
  16. package/dist/src/generated/bucket_v2_framework/deps/sui/balance.js +14 -0
  17. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
  18. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.js +27 -0
  19. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
  20. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.js +19 -0
  21. package/dist/src/generated/bucket_v2_framework/double.d.ts +384 -0
  22. package/dist/src/generated/bucket_v2_framework/double.js +466 -0
  23. package/dist/src/generated/bucket_v2_framework/float.d.ts +364 -0
  24. package/dist/src/generated/bucket_v2_framework/float.js +440 -0
  25. package/dist/src/generated/bucket_v2_framework/liability.d.ts +197 -0
  26. package/dist/src/generated/bucket_v2_framework/liability.js +205 -0
  27. package/dist/src/generated/bucket_v2_framework/linked_table.d.ts +384 -0
  28. package/dist/src/generated/bucket_v2_framework/linked_table.js +382 -0
  29. package/dist/src/generated/bucket_v2_framework/sheet.d.ts +424 -0
  30. package/dist/src/generated/bucket_v2_framework/sheet.js +344 -0
  31. package/dist/src/generated/native_custody/custody_vault.d.ts +572 -0
  32. package/dist/src/generated/native_custody/custody_vault.js +483 -0
  33. package/dist/src/generated/native_custody/deps/bucket_v2_framework/float.d.ts +8 -0
  34. package/dist/src/generated/native_custody/deps/bucket_v2_framework/float.js +10 -0
  35. package/dist/src/generated/native_custody/deps/bucket_v2_framework/liability.d.ts +11 -0
  36. package/dist/src/generated/native_custody/deps/bucket_v2_framework/liability.js +13 -0
  37. package/dist/src/generated/native_custody/deps/bucket_v2_framework/sheet.d.ts +49 -0
  38. package/dist/src/generated/native_custody/deps/bucket_v2_framework/sheet.js +18 -0
  39. package/dist/src/generated/native_custody/deps/std/type_name.d.ts +17 -0
  40. package/dist/src/generated/native_custody/deps/std/type_name.js +19 -0
  41. package/dist/src/generated/native_custody/deps/sui/balance.d.ts +12 -0
  42. package/dist/src/generated/native_custody/deps/sui/balance.js +14 -0
  43. package/dist/src/generated/native_custody/deps/sui/vec_map.d.ts +36 -0
  44. package/dist/src/generated/native_custody/deps/sui/vec_map.js +27 -0
  45. package/dist/src/generated/native_custody/deps/sui/vec_set.d.ts +16 -0
  46. package/dist/src/generated/native_custody/deps/sui/vec_set.js +19 -0
  47. package/dist/src/generated/native_custody/events.d.ts +36 -0
  48. package/dist/src/generated/native_custody/events.js +36 -0
  49. package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.d.ts +12 -0
  50. package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.js +14 -0
  51. package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +68 -0
  52. package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +74 -0
  53. package/dist/src/generated/utils/index.d.ts +30 -0
  54. package/dist/src/generated/utils/index.js +157 -0
  55. package/dist/src/generated/waterx_account/account.d.ts +1818 -0
  56. package/dist/src/generated/waterx_account/account.js +1723 -0
  57. package/dist/src/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +11 -0
  58. package/dist/src/generated/waterx_account/deps/bucket_v2_framework/liability.js +13 -0
  59. package/dist/src/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +49 -0
  60. package/dist/src/generated/waterx_account/deps/bucket_v2_framework/sheet.js +18 -0
  61. package/dist/src/generated/waterx_account/deps/std/type_name.d.ts +17 -0
  62. package/dist/src/generated/waterx_account/deps/std/type_name.js +19 -0
  63. package/dist/src/generated/waterx_account/deps/sui/balance.d.ts +12 -0
  64. package/dist/src/generated/waterx_account/deps/sui/balance.js +14 -0
  65. package/dist/src/generated/waterx_account/deps/sui/object_table.d.ts +17 -0
  66. package/dist/src/generated/waterx_account/deps/sui/object_table.js +19 -0
  67. package/dist/src/generated/waterx_account/deps/sui/table.d.ts +29 -0
  68. package/dist/src/generated/waterx_account/deps/sui/table.js +31 -0
  69. package/dist/src/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
  70. package/dist/src/generated/waterx_account/deps/sui/vec_map.js +27 -0
  71. package/dist/src/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
  72. package/dist/src/generated/waterx_account/deps/sui/vec_set.js +19 -0
  73. package/dist/src/generated/waterx_account/direct_rule.d.ts +77 -0
  74. package/dist/src/generated/waterx_account/direct_rule.js +78 -0
  75. package/dist/src/generated/waterx_account/events.d.ts +180 -0
  76. package/dist/src/generated/waterx_account/events.js +156 -0
  77. package/dist/src/generated/waterx_account/version.d.ts +10 -0
  78. package/dist/src/generated/waterx_account/version.js +8 -0
  79. package/dist/src/generated/waterx_credit/credit_registry.d.ts +708 -0
  80. package/dist/src/generated/waterx_credit/credit_registry.js +658 -0
  81. package/dist/src/generated/waterx_credit/deps/std/type_name.d.ts +17 -0
  82. package/dist/src/generated/waterx_credit/deps/std/type_name.js +19 -0
  83. package/dist/src/generated/waterx_credit/deps/sui/table.d.ts +29 -0
  84. package/dist/src/generated/waterx_credit/deps/sui/table.js +31 -0
  85. package/dist/src/generated/waterx_credit/deps/sui/vec_map.d.ts +36 -0
  86. package/dist/src/generated/waterx_credit/deps/sui/vec_map.js +27 -0
  87. package/dist/src/generated/waterx_credit/deps/sui/vec_set.d.ts +16 -0
  88. package/dist/src/generated/waterx_credit/deps/sui/vec_set.js +19 -0
  89. package/dist/src/generated/waterx_credit/limited_supply.d.ts +107 -0
  90. package/dist/src/generated/waterx_credit/limited_supply.js +131 -0
  91. package/dist/src/generated/waterx_oracle/aggregator.d.ts +211 -0
  92. package/dist/src/generated/waterx_oracle/aggregator.js +213 -0
  93. package/dist/src/generated/waterx_oracle/collector.d.ts +119 -0
  94. package/dist/src/generated/waterx_oracle/collector.js +105 -0
  95. package/dist/src/generated/waterx_oracle/deps/bucket_v2_framework/float.d.ts +8 -0
  96. package/dist/src/generated/waterx_oracle/deps/bucket_v2_framework/float.js +10 -0
  97. package/dist/src/generated/waterx_oracle/deps/std/type_name.d.ts +17 -0
  98. package/dist/src/generated/waterx_oracle/deps/std/type_name.js +19 -0
  99. package/dist/src/generated/waterx_oracle/deps/sui/vec_map.d.ts +36 -0
  100. package/dist/src/generated/waterx_oracle/deps/sui/vec_map.js +27 -0
  101. package/dist/src/generated/waterx_oracle/deps/sui/vec_set.d.ts +16 -0
  102. package/dist/src/generated/waterx_oracle/deps/sui/vec_set.js +19 -0
  103. package/dist/src/generated/waterx_oracle/oracle.d.ts +298 -0
  104. package/dist/src/generated/waterx_oracle/oracle.js +323 -0
  105. package/dist/src/generated/waterx_oracle/version.d.ts +10 -0
  106. package/dist/src/generated/waterx_oracle/version.js +8 -0
  107. package/dist/src/generated/waterx_perp/account_data.d.ts +269 -0
  108. package/dist/src/generated/waterx_perp/account_data.js +284 -0
  109. package/dist/src/generated/waterx_perp/admin.d.ts +19 -0
  110. package/dist/src/generated/waterx_perp/admin.js +22 -0
  111. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/double.d.ts +8 -0
  112. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/double.js +10 -0
  113. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/float.d.ts +8 -0
  114. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/float.js +10 -0
  115. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/liability.d.ts +11 -0
  116. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/liability.js +13 -0
  117. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.d.ts +8 -0
  118. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.js +18 -0
  119. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.d.ts +49 -0
  120. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.js +18 -0
  121. package/dist/src/generated/waterx_perp/deps/std/type_name.d.ts +17 -0
  122. package/dist/src/generated/waterx_perp/deps/std/type_name.js +19 -0
  123. package/dist/src/generated/waterx_perp/deps/sui/balance.d.ts +15 -0
  124. package/dist/src/generated/waterx_perp/deps/sui/balance.js +17 -0
  125. package/dist/src/generated/waterx_perp/deps/sui/coin.d.ts +14 -0
  126. package/dist/src/generated/waterx_perp/deps/sui/coin.js +15 -0
  127. package/dist/src/generated/waterx_perp/deps/sui/vec_map.d.ts +36 -0
  128. package/dist/src/generated/waterx_perp/deps/sui/vec_map.js +27 -0
  129. package/dist/src/generated/waterx_perp/deps/sui/vec_set.d.ts +16 -0
  130. package/dist/src/generated/waterx_perp/deps/sui/vec_set.js +19 -0
  131. package/dist/src/generated/waterx_perp/events.d.ts +1283 -0
  132. package/dist/src/generated/waterx_perp/events.js +1018 -0
  133. package/dist/src/generated/waterx_perp/global_config.d.ts +775 -0
  134. package/dist/src/generated/waterx_perp/global_config.js +836 -0
  135. package/dist/src/generated/waterx_perp/keyed_big_vector.d.ts +553 -0
  136. package/dist/src/generated/waterx_perp/keyed_big_vector.js +554 -0
  137. package/dist/src/generated/waterx_perp/lp_pool.d.ts +1648 -0
  138. package/dist/src/generated/waterx_perp/lp_pool.js +1521 -0
  139. package/dist/src/generated/waterx_perp/market_config.d.ts +715 -0
  140. package/dist/src/generated/waterx_perp/market_config.js +780 -0
  141. package/dist/src/generated/waterx_perp/math.d.ts +63 -0
  142. package/dist/src/generated/waterx_perp/math.js +64 -0
  143. package/dist/src/generated/waterx_perp/memo.d.ts +251 -0
  144. package/dist/src/generated/waterx_perp/memo.js +323 -0
  145. package/dist/src/generated/waterx_perp/order_book.d.ts +290 -0
  146. package/dist/src/generated/waterx_perp/order_book.js +329 -0
  147. package/dist/src/generated/waterx_perp/position.d.ts +1005 -0
  148. package/dist/src/generated/waterx_perp/position.js +1103 -0
  149. package/dist/src/generated/waterx_perp/request.d.ts +544 -0
  150. package/dist/src/generated/waterx_perp/request.js +541 -0
  151. package/dist/src/generated/waterx_perp/response.d.ts +247 -0
  152. package/dist/src/generated/waterx_perp/response.js +280 -0
  153. package/dist/src/generated/waterx_perp/trading.d.ts +2821 -0
  154. package/dist/src/generated/waterx_perp/trading.js +2372 -0
  155. package/dist/src/generated/waterx_perp/version.d.ts +10 -0
  156. package/dist/src/generated/waterx_perp/version.js +8 -0
  157. package/dist/src/generated/waterx_perp/witness.d.ts +18 -0
  158. package/dist/src/generated/waterx_perp/witness.js +21 -0
  159. package/dist/src/generated/waterx_perp_view/deps/std/type_name.d.ts +17 -0
  160. package/dist/src/generated/waterx_perp_view/deps/std/type_name.js +19 -0
  161. package/dist/src/generated/waterx_perp_view/view.d.ts +447 -0
  162. package/dist/src/generated/waterx_perp_view/view.js +414 -0
  163. package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.d.ts +36 -0
  164. package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.js +27 -0
  165. package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +90 -0
  166. package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +72 -0
  167. package/dist/src/generated/waterx_referral/deps/sui/table.d.ts +29 -0
  168. package/dist/src/generated/waterx_referral/deps/sui/table.js +31 -0
  169. package/dist/src/generated/waterx_referral/deps/sui/vec_set.d.ts +16 -0
  170. package/dist/src/generated/waterx_referral/deps/sui/vec_set.js +19 -0
  171. package/dist/src/generated/waterx_referral/referral_table.d.ts +171 -0
  172. package/dist/src/generated/waterx_referral/referral_table.js +192 -0
  173. package/dist/src/generated/waterx_staking/deps/bucket_v2_framework/double.d.ts +8 -0
  174. package/dist/src/generated/waterx_staking/deps/bucket_v2_framework/double.js +10 -0
  175. package/dist/src/generated/waterx_staking/deps/sui/balance.d.ts +12 -0
  176. package/dist/src/generated/waterx_staking/deps/sui/balance.js +14 -0
  177. package/dist/src/generated/waterx_staking/deps/sui/table.d.ts +29 -0
  178. package/dist/src/generated/waterx_staking/deps/sui/table.js +31 -0
  179. package/dist/src/generated/waterx_staking/deps/sui/vec_set.d.ts +16 -0
  180. package/dist/src/generated/waterx_staking/deps/sui/vec_set.js +19 -0
  181. package/dist/src/generated/waterx_staking/waterx_staking.d.ts +746 -0
  182. package/dist/src/generated/waterx_staking/waterx_staking.js +731 -0
  183. package/dist/src/generated/waterx_staking/witness.d.ts +16 -0
  184. package/dist/src/generated/waterx_staking/witness.js +18 -0
  185. package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.d.ts +8 -0
  186. package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.js +18 -0
  187. package/dist/src/generated/withdrawal_queue/deps/std/type_name.d.ts +17 -0
  188. package/dist/src/generated/withdrawal_queue/deps/std/type_name.js +19 -0
  189. package/dist/src/generated/withdrawal_queue/deps/sui/balance.d.ts +12 -0
  190. package/dist/src/generated/withdrawal_queue/deps/sui/balance.js +14 -0
  191. package/dist/src/generated/withdrawal_queue/deps/sui/vec_set.d.ts +16 -0
  192. package/dist/src/generated/withdrawal_queue/deps/sui/vec_set.js +19 -0
  193. package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +483 -0
  194. package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +480 -0
  195. package/dist/src/generated/wlp/wlp.d.ts +28 -0
  196. package/dist/src/generated/wlp/wlp.js +32 -0
  197. package/dist/src/generated/wormhole_bridge/deps/sui/table.d.ts +29 -0
  198. package/dist/src/generated/wormhole_bridge/deps/sui/table.js +31 -0
  199. package/dist/src/generated/wormhole_bridge/deps/sui/vec_map.d.ts +36 -0
  200. package/dist/src/generated/wormhole_bridge/deps/sui/vec_map.js +27 -0
  201. package/dist/src/generated/wormhole_bridge/deps/sui/vec_set.d.ts +16 -0
  202. package/dist/src/generated/wormhole_bridge/deps/sui/vec_set.js +19 -0
  203. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.d.ts +12 -0
  204. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.js +9 -0
  205. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.d.ts +14 -0
  206. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.js +16 -0
  207. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/set.d.ts +16 -0
  208. package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/set.js +15 -0
  209. package/dist/src/generated/wormhole_bridge/events.d.ts +32 -0
  210. package/dist/src/generated/wormhole_bridge/events.js +28 -0
  211. package/dist/src/generated/wormhole_bridge/wormhole_bridge.d.ts +498 -0
  212. package/dist/src/generated/wormhole_bridge/wormhole_bridge.js +494 -0
  213. package/dist/src/index.d.ts +28 -0
  214. package/dist/src/index.js +34 -0
  215. package/dist/src/tx-builders.d.ts +242 -0
  216. package/dist/src/tx-builders.js +320 -0
  217. package/dist/src/user/account.d.ts +129 -0
  218. package/dist/src/user/account.js +166 -0
  219. package/dist/src/user/credit.d.ts +135 -0
  220. package/dist/src/user/credit.js +255 -0
  221. package/dist/src/user/custody.d.ts +71 -0
  222. package/dist/src/user/custody.js +112 -0
  223. package/dist/src/user/index.d.ts +8 -0
  224. package/dist/src/user/index.js +8 -0
  225. package/dist/src/user/order.d.ts +89 -0
  226. package/dist/src/user/order.js +134 -0
  227. package/dist/src/user/referral.d.ts +21 -0
  228. package/dist/src/user/referral.js +41 -0
  229. package/dist/src/user/staking.d.ts +54 -0
  230. package/dist/src/user/staking.js +109 -0
  231. package/dist/src/user/trading.d.ts +119 -0
  232. package/dist/src/user/trading.js +262 -0
  233. package/dist/src/user/wlp.d.ts +58 -0
  234. package/dist/src/user/wlp.js +99 -0
  235. package/dist/src/utils/account-request.d.ts +9 -0
  236. package/dist/src/utils/account-request.js +17 -0
  237. package/dist/src/utils/config.d.ts +11 -0
  238. package/dist/src/utils/config.js +15 -0
  239. package/dist/src/utils/math.d.ts +201 -0
  240. package/dist/src/utils/math.js +343 -0
  241. package/dist/src/utils/pyth.d.ts +89 -0
  242. package/dist/src/utils/pyth.js +316 -0
  243. package/dist/src/utils/wormhole.d.ts +86 -0
  244. package/dist/src/utils/wormhole.js +154 -0
  245. package/package.json +66 -0
@@ -0,0 +1,63 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * Math utilities for WaterX Perp using bucket_v2_framework::float. All price/rate
6
+ * calculations use Float (1e9) or Double (1e18).
7
+ */
8
+ import { type Transaction } from '@mysten/sui/transactions';
9
+ import { type RawTransactionArgument } from '../utils/index.ts';
10
+ export interface AmountToUsdArguments {
11
+ amount: RawTransactionArgument<number | bigint>;
12
+ tokenDecimal: RawTransactionArgument<number>;
13
+ price: RawTransactionArgument<string>;
14
+ }
15
+ export interface AmountToUsdOptions {
16
+ package?: string;
17
+ arguments: AmountToUsdArguments | [
18
+ amount: RawTransactionArgument<number | bigint>,
19
+ tokenDecimal: RawTransactionArgument<number>,
20
+ price: RawTransactionArgument<string>
21
+ ];
22
+ }
23
+ /**
24
+ * Converts a token amount to USD value as Float. amount: raw token amount (e.g.,
25
+ * 1_000_000 for 1 USDC) token_decimal: number of decimals the token uses price:
26
+ * Float price (USD per token)
27
+ */
28
+ export declare function amountToUsd(options: AmountToUsdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
29
+ export interface UsdToAmountArguments {
30
+ usd: RawTransactionArgument<string>;
31
+ tokenDecimal: RawTransactionArgument<number>;
32
+ price: RawTransactionArgument<string>;
33
+ }
34
+ export interface UsdToAmountOptions {
35
+ package?: string;
36
+ arguments: UsdToAmountArguments | [
37
+ usd: RawTransactionArgument<string>,
38
+ tokenDecimal: RawTransactionArgument<number>,
39
+ price: RawTransactionArgument<string>
40
+ ];
41
+ }
42
+ /** Converts a USD value (Float) to a token amount. Returns u64 raw amount. */
43
+ export declare function usdToAmount(options: UsdToAmountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
44
+ export interface BpScaleOptions {
45
+ package?: string;
46
+ arguments?: [
47
+ ];
48
+ }
49
+ /** Returns basis points scale. */
50
+ export declare function bpScale(options?: BpScaleOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
51
+ export interface SaturatingSubArguments {
52
+ a: RawTransactionArgument<number | bigint>;
53
+ b: RawTransactionArgument<number | bigint>;
54
+ }
55
+ export interface SaturatingSubOptions {
56
+ package?: string;
57
+ arguments: SaturatingSubArguments | [
58
+ a: RawTransactionArgument<number | bigint>,
59
+ b: RawTransactionArgument<number | bigint>
60
+ ];
61
+ }
62
+ /** Safe subtraction (saturates at 0). */
63
+ export declare function saturatingSub(options: SaturatingSubOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -0,0 +1,64 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { normalizeMoveArguments } from "../utils/index.js";
5
+ /**
6
+ * Converts a token amount to USD value as Float. amount: raw token amount (e.g.,
7
+ * 1_000_000 for 1 USDC) token_decimal: number of decimals the token uses price:
8
+ * Float price (USD per token)
9
+ */
10
+ export function amountToUsd(options) {
11
+ const packageAddress = options.package ?? '@waterx/perp';
12
+ const argumentsTypes = [
13
+ 'u64',
14
+ 'u8',
15
+ null
16
+ ];
17
+ const parameterNames = ["amount", "tokenDecimal", "price"];
18
+ return (tx) => tx.moveCall({
19
+ package: packageAddress,
20
+ module: 'math',
21
+ function: 'amount_to_usd',
22
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
23
+ });
24
+ }
25
+ /** Converts a USD value (Float) to a token amount. Returns u64 raw amount. */
26
+ export function usdToAmount(options) {
27
+ const packageAddress = options.package ?? '@waterx/perp';
28
+ const argumentsTypes = [
29
+ null,
30
+ 'u8',
31
+ null
32
+ ];
33
+ const parameterNames = ["usd", "tokenDecimal", "price"];
34
+ return (tx) => tx.moveCall({
35
+ package: packageAddress,
36
+ module: 'math',
37
+ function: 'usd_to_amount',
38
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
39
+ });
40
+ }
41
+ /** Returns basis points scale. */
42
+ export function bpScale(options = {}) {
43
+ const packageAddress = options.package ?? '@waterx/perp';
44
+ return (tx) => tx.moveCall({
45
+ package: packageAddress,
46
+ module: 'math',
47
+ function: 'bp_scale',
48
+ });
49
+ }
50
+ /** Safe subtraction (saturates at 0). */
51
+ export function saturatingSub(options) {
52
+ const packageAddress = options.package ?? '@waterx/perp';
53
+ const argumentsTypes = [
54
+ 'u64',
55
+ 'u64'
56
+ ];
57
+ const parameterNames = ["a", "b"];
58
+ return (tx) => tx.moveCall({
59
+ package: packageAddress,
60
+ module: 'math',
61
+ function: 'saturating_sub',
62
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
63
+ });
64
+ }
@@ -0,0 +1,251 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Standard event memo strings for WaterX Perp events. */
5
+ import { type Transaction } from '@mysten/sui/transactions';
6
+ import { type RawTransactionArgument } from '../utils/index.ts';
7
+ export interface PositionOpenedOptions {
8
+ package?: string;
9
+ arguments?: [
10
+ ];
11
+ }
12
+ export declare function positionOpened(options?: PositionOpenedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
13
+ export interface PositionClosedOptions {
14
+ package?: string;
15
+ arguments?: [
16
+ ];
17
+ }
18
+ export declare function positionClosed(options?: PositionClosedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
19
+ export interface PositionModifiedArguments {
20
+ isIncrease: RawTransactionArgument<boolean>;
21
+ }
22
+ export interface PositionModifiedOptions {
23
+ package?: string;
24
+ arguments: PositionModifiedArguments | [
25
+ isIncrease: RawTransactionArgument<boolean>
26
+ ];
27
+ }
28
+ export declare function positionModified(options: PositionModifiedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
29
+ export interface PositionLiquidatedOptions {
30
+ package?: string;
31
+ arguments?: [
32
+ ];
33
+ }
34
+ export declare function positionLiquidated(options?: PositionLiquidatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
35
+ export interface CollateralModifiedArguments {
36
+ isIncrease: RawTransactionArgument<boolean>;
37
+ }
38
+ export interface CollateralModifiedOptions {
39
+ package?: string;
40
+ arguments: CollateralModifiedArguments | [
41
+ isIncrease: RawTransactionArgument<boolean>
42
+ ];
43
+ }
44
+ export declare function collateralModified(options: CollateralModifiedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
45
+ export interface PositionLinkedOrderModifiedArguments {
46
+ isAdded: RawTransactionArgument<boolean>;
47
+ }
48
+ export interface PositionLinkedOrderModifiedOptions {
49
+ package?: string;
50
+ arguments: PositionLinkedOrderModifiedArguments | [
51
+ isAdded: RawTransactionArgument<boolean>
52
+ ];
53
+ }
54
+ export declare function positionLinkedOrderModified(options: PositionLinkedOrderModifiedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
55
+ export interface OrderCreatedOptions {
56
+ package?: string;
57
+ arguments?: [
58
+ ];
59
+ }
60
+ export declare function orderCreated(options?: OrderCreatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
61
+ export interface OrderFilledOptions {
62
+ package?: string;
63
+ arguments?: [
64
+ ];
65
+ }
66
+ export declare function orderFilled(options?: OrderFilledOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
67
+ export interface OrderUpdatedOptions {
68
+ package?: string;
69
+ arguments?: [
70
+ ];
71
+ }
72
+ export declare function orderUpdated(options?: OrderUpdatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
73
+ export interface PreOrderCreatedOptions {
74
+ package?: string;
75
+ arguments?: [
76
+ ];
77
+ }
78
+ export declare function preOrderCreated(options?: PreOrderCreatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
79
+ export interface PreOrderCancelledOptions {
80
+ package?: string;
81
+ arguments?: [
82
+ ];
83
+ }
84
+ export declare function preOrderCancelled(options?: PreOrderCancelledOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
85
+ export interface OrderCancelledByUserOptions {
86
+ package?: string;
87
+ arguments?: [
88
+ ];
89
+ }
90
+ export declare function orderCancelledByUser(options?: OrderCancelledByUserOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
91
+ export interface OrderCancelledMissingLinkedPositionOptions {
92
+ package?: string;
93
+ arguments?: [
94
+ ];
95
+ }
96
+ export declare function orderCancelledMissingLinkedPosition(options?: OrderCancelledMissingLinkedPositionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
97
+ export interface OrderCancelledTooManyFailedMatchesOptions {
98
+ package?: string;
99
+ arguments?: [
100
+ ];
101
+ }
102
+ export declare function orderCancelledTooManyFailedMatches(options?: OrderCancelledTooManyFailedMatchesOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
103
+ export interface OrderCancelledInvalidMatchOptions {
104
+ package?: string;
105
+ arguments?: [
106
+ ];
107
+ }
108
+ /**
109
+ * `match_orders` linked-reduce blocked: the order's linked position is on the same
110
+ * side (reduce-only can't grow), or a partial reduce would leave the position with
111
+ * a deficit / collateral below `min_coll_value`. Either way the order can never
112
+ * fill against the current position state.
113
+ */
114
+ export declare function orderCancelledInvalidMatch(options?: OrderCancelledInvalidMatchOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
115
+ export interface OrderCancelledSlippageExceededOptions {
116
+ package?: string;
117
+ arguments?: [
118
+ ];
119
+ }
120
+ /**
121
+ * `place_order` market-order shortcut: oracle price is on the wrong side of the
122
+ * caller-supplied `acceptable_price`. Cancel instead of aborting so the caller's
123
+ * PTB still settles (collateral returns to the wxa account).
124
+ */
125
+ export declare function orderCancelledSlippageExceeded(options?: OrderCancelledSlippageExceededOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
126
+ export interface OrderCancelledPositionClosedOptions {
127
+ package?: string;
128
+ arguments?: [
129
+ ];
130
+ }
131
+ export declare function orderCancelledPositionClosed(options?: OrderCancelledPositionClosedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
132
+ export interface OrderCancelledPositionLiquidatedOptions {
133
+ package?: string;
134
+ arguments?: [
135
+ ];
136
+ }
137
+ export declare function orderCancelledPositionLiquidated(options?: OrderCancelledPositionLiquidatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
138
+ export interface PositionClosedCodeOptions {
139
+ package?: string;
140
+ arguments?: [
141
+ ];
142
+ }
143
+ export declare function positionClosedCode(options?: PositionClosedCodeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
144
+ export interface PositionLiquidatedCodeOptions {
145
+ package?: string;
146
+ arguments?: [
147
+ ];
148
+ }
149
+ export declare function positionLiquidatedCode(options?: PositionLiquidatedCodeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
150
+ export interface OrderCancelledFromCodeArguments {
151
+ code: RawTransactionArgument<number>;
152
+ }
153
+ export interface OrderCancelledFromCodeOptions {
154
+ package?: string;
155
+ arguments: OrderCancelledFromCodeArguments | [
156
+ code: RawTransactionArgument<number>
157
+ ];
158
+ }
159
+ export declare function orderCancelledFromCode(options: OrderCancelledFromCodeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
160
+ export interface ProtocolFeeCollectedOptions {
161
+ package?: string;
162
+ arguments?: [
163
+ ];
164
+ }
165
+ export declare function protocolFeeCollected(options?: ProtocolFeeCollectedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
166
+ export interface WlpEquityFeeOptions {
167
+ package?: string;
168
+ arguments?: [
169
+ ];
170
+ }
171
+ export declare function wlpEquityFee(options?: WlpEquityFeeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
172
+ export interface WlpEquityWinOptions {
173
+ package?: string;
174
+ arguments?: [
175
+ ];
176
+ }
177
+ /**
178
+ * LP-wins side of a position close: trader's realized loss paid into the pool as
179
+ * LP equity (is_profit = true).
180
+ */
181
+ export declare function wlpEquityWin(options?: WlpEquityWinOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
182
+ export interface WlpEquityLossOptions {
183
+ package?: string;
184
+ arguments?: [
185
+ ];
186
+ }
187
+ /**
188
+ * LP-loses side: trader's realized profit paid out of the pool (is_profit =
189
+ * false).
190
+ */
191
+ export declare function wlpEquityLoss(options?: WlpEquityLossOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
192
+ export interface WlpEquityLeftoverOptions {
193
+ package?: string;
194
+ arguments?: [
195
+ ];
196
+ }
197
+ export declare function wlpEquityLeftover(options?: WlpEquityLeftoverOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
198
+ export interface WlpMintedOptions {
199
+ package?: string;
200
+ arguments?: [
201
+ ];
202
+ }
203
+ export declare function wlpMinted(options?: WlpMintedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
204
+ export interface WlpRedeemRequestedOptions {
205
+ package?: string;
206
+ arguments?: [
207
+ ];
208
+ }
209
+ export declare function wlpRedeemRequested(options?: WlpRedeemRequestedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
210
+ export interface WlpRedeemCancelledOptions {
211
+ package?: string;
212
+ arguments?: [
213
+ ];
214
+ }
215
+ export declare function wlpRedeemCancelled(options?: WlpRedeemCancelledOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
216
+ export interface WlpRedeemRejectedOptions {
217
+ package?: string;
218
+ arguments?: [
219
+ ];
220
+ }
221
+ export declare function wlpRedeemRejected(options?: WlpRedeemRejectedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
222
+ export interface WlpRedeemSettledOptions {
223
+ package?: string;
224
+ arguments?: [
225
+ ];
226
+ }
227
+ export declare function wlpRedeemSettled(options?: WlpRedeemSettledOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
228
+ export interface FundingRateUpdatedOptions {
229
+ package?: string;
230
+ arguments?: [
231
+ ];
232
+ }
233
+ export declare function fundingRateUpdated(options?: FundingRateUpdatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
234
+ export interface BorrowRateUpdatedOptions {
235
+ package?: string;
236
+ arguments?: [
237
+ ];
238
+ }
239
+ export declare function borrowRateUpdated(options?: BorrowRateUpdatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
240
+ export interface MarketConfigUpdatedOptions {
241
+ package?: string;
242
+ arguments?: [
243
+ ];
244
+ }
245
+ export declare function marketConfigUpdated(options?: MarketConfigUpdatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
246
+ export interface TokenPoolInfoUpdatedOptions {
247
+ package?: string;
248
+ arguments?: [
249
+ ];
250
+ }
251
+ export declare function tokenPoolInfoUpdated(options?: TokenPoolInfoUpdatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;