@waterx/sdk 2.4.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/README.md +25 -21
  2. package/dist/src/{utils → account}/account-request.d.ts +2 -2
  3. package/dist/src/{user → account}/account.d.ts +23 -21
  4. package/dist/src/{user → account}/account.js +5 -5
  5. package/dist/src/account/client.d.ts +42 -0
  6. package/dist/src/account/client.js +17 -0
  7. package/dist/src/account/config.d.ts +151 -0
  8. package/dist/src/account/config.js +8 -0
  9. package/dist/src/account/constants.d.ts +5 -0
  10. package/dist/src/account/constants.js +5 -0
  11. package/dist/src/account/fetch/referral.d.ts +15 -0
  12. package/dist/src/account/fetch/referral.js +51 -0
  13. package/dist/src/account/fetch/simulate.d.ts +34 -0
  14. package/dist/src/account/fetch/simulate.js +43 -0
  15. package/dist/src/{utils/consolidate-balance.d.ts → account/funding/balance.d.ts} +3 -8
  16. package/dist/src/{utils/consolidate-balance.js → account/funding/balance.js} +6 -1
  17. package/dist/src/account/funding/consolidate.d.ts +46 -0
  18. package/dist/src/account/funding/consolidate.js +137 -0
  19. package/dist/src/{user → account/funding}/credit.d.ts +10 -10
  20. package/dist/src/{user → account/funding}/credit.js +6 -6
  21. package/dist/src/{user → account/funding}/custody.d.ts +4 -4
  22. package/dist/src/{user → account/funding}/custody.js +2 -2
  23. package/dist/src/{utils → account/funding}/wormhole.d.ts +4 -4
  24. package/dist/src/{utils → account/funding}/wormhole.js +1 -1
  25. package/dist/src/account/index.d.ts +29 -0
  26. package/dist/src/account/index.js +29 -0
  27. package/dist/src/{user → account}/referral.d.ts +3 -3
  28. package/dist/src/{user → account}/referral.js +1 -1
  29. package/dist/src/base-client.d.ts +74 -0
  30. package/dist/src/base-client.js +97 -0
  31. package/dist/src/constants.d.ts +4 -46
  32. package/dist/src/constants.js +8 -52
  33. package/dist/src/generated/bucket_v2_framework/liability.d.ts +0 -26
  34. package/dist/src/generated/bucket_v2_framework/liability.js +0 -28
  35. package/dist/src/generated/waterx_account/account.d.ts +50 -15
  36. package/dist/src/generated/waterx_account/account.js +51 -15
  37. package/dist/src/generated/waterx_oracle/oracle.d.ts +7 -1
  38. package/dist/src/generated/waterx_oracle/oracle.js +7 -2
  39. package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.d.ts +19 -2
  40. package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.d.ts +3 -1
  41. package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/sui/balance.d.ts +3 -1
  42. package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.d.ts +6 -1
  43. package/dist/src/generated/waterx_prediction/events.d.ts +288 -0
  44. package/dist/src/{prediction/generated → generated}/waterx_prediction/events.js +39 -0
  45. package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.d.ts +6 -1
  46. package/dist/src/{prediction/generated → generated}/waterx_prediction/order.d.ts +34 -1
  47. package/dist/src/{prediction/generated → generated}/waterx_prediction/position.d.ts +16 -1
  48. package/dist/src/{prediction/generated → generated}/waterx_prediction/view.d.ts +69 -4
  49. package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.d.ts +162 -2
  50. package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.js +99 -0
  51. package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +102 -0
  52. package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +99 -0
  53. package/dist/src/generated/waterx_supra_rule/supra_rule.d.ts +5 -5
  54. package/dist/src/generated/waterx_supra_rule/supra_rule.js +1 -2
  55. package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +23 -23
  56. package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +3 -6
  57. package/dist/src/oracle/aggregate.d.ts +74 -0
  58. package/dist/src/oracle/aggregate.js +112 -0
  59. package/dist/src/oracle/config.d.ts +99 -0
  60. package/dist/src/oracle/config.js +23 -0
  61. package/dist/src/oracle/host.d.ts +32 -0
  62. package/dist/src/oracle/host.js +10 -0
  63. package/dist/src/oracle/index.d.ts +16 -0
  64. package/dist/src/oracle/index.js +18 -0
  65. package/dist/src/oracle/pyth.d.ts +52 -0
  66. package/dist/src/oracle/pyth.js +220 -0
  67. package/dist/src/oracle/rules/constant-rule.d.ts +9 -0
  68. package/dist/src/oracle/rules/constant-rule.js +14 -0
  69. package/dist/src/oracle/rules/pyth-rule.d.ts +11 -0
  70. package/dist/src/oracle/rules/pyth-rule.js +20 -0
  71. package/dist/src/oracle/rules/sponsor.d.ts +28 -0
  72. package/dist/src/oracle/rules/sponsor.js +48 -0
  73. package/dist/src/oracle/rules/supra-rule.d.ts +11 -0
  74. package/dist/src/oracle/rules/supra-rule.js +22 -0
  75. package/dist/src/perp/client.d.ts +78 -0
  76. package/dist/src/perp/client.js +108 -0
  77. package/dist/src/{client.d.ts → perp/config-view.d.ts} +15 -60
  78. package/dist/src/{client.js → perp/config-view.js} +23 -95
  79. package/dist/src/perp/config.d.ts +126 -0
  80. package/dist/src/{config.js → perp/config.js} +11 -12
  81. package/dist/src/perp/constants.d.ts +49 -0
  82. package/dist/src/perp/constants.js +61 -0
  83. package/dist/src/perp/fetch/account.d.ts +43 -0
  84. package/dist/src/perp/fetch/account.js +64 -0
  85. package/dist/src/perp/fetch/bridge.d.ts +90 -0
  86. package/dist/src/perp/fetch/bridge.js +127 -0
  87. package/dist/src/perp/fetch/custody.d.ts +32 -0
  88. package/dist/src/perp/fetch/custody.js +62 -0
  89. package/dist/src/perp/fetch/market.d.ts +30 -0
  90. package/dist/src/perp/fetch/market.js +68 -0
  91. package/dist/src/perp/fetch/positions.d.ts +70 -0
  92. package/dist/src/perp/fetch/positions.js +185 -0
  93. package/dist/src/perp/fetch/simulate.d.ts +12 -0
  94. package/dist/src/perp/fetch/simulate.js +13 -0
  95. package/dist/src/perp/fetch.d.ts +23 -0
  96. package/dist/src/perp/fetch.js +23 -0
  97. package/dist/src/{index.d.ts → perp/index.d.ts} +21 -21
  98. package/dist/src/{index.js → perp/index.js} +21 -21
  99. package/dist/src/perp/tx-builders/common.d.ts +83 -0
  100. package/dist/src/perp/tx-builders/common.js +70 -0
  101. package/dist/src/perp/tx-builders/credit.d.ts +65 -0
  102. package/dist/src/perp/tx-builders/credit.js +62 -0
  103. package/dist/src/perp/tx-builders/rewards.d.ts +30 -0
  104. package/dist/src/perp/tx-builders/rewards.js +34 -0
  105. package/dist/src/perp/tx-builders/trading.d.ts +51 -0
  106. package/dist/src/perp/tx-builders/trading.js +59 -0
  107. package/dist/src/perp/tx-builders/wlp.d.ts +90 -0
  108. package/dist/src/perp/tx-builders/wlp.js +120 -0
  109. package/dist/src/perp/tx-builders.d.ts +23 -0
  110. package/dist/src/perp/tx-builders.js +23 -0
  111. package/dist/src/perp/user/index.d.ts +8 -0
  112. package/dist/src/perp/user/index.js +8 -0
  113. package/dist/src/{user → perp/user}/order.d.ts +7 -7
  114. package/dist/src/{user → perp/user}/order.js +3 -3
  115. package/dist/src/{user → perp/user}/staking.d.ts +4 -4
  116. package/dist/src/{user → perp/user}/staking.js +2 -2
  117. package/dist/src/{user → perp/user}/trading.d.ts +13 -13
  118. package/dist/src/{user → perp/user}/trading.js +2 -2
  119. package/dist/src/{user → perp/user}/wlp.d.ts +7 -7
  120. package/dist/src/{user → perp/user}/wlp.js +3 -3
  121. package/dist/src/prediction/account.js +40 -76
  122. package/dist/src/prediction/bcs.d.ts +15 -9
  123. package/dist/src/prediction/bcs.js +17 -81
  124. package/dist/src/prediction/client.d.ts +8 -38
  125. package/dist/src/prediction/client.js +11 -67
  126. package/dist/src/prediction/config.d.ts +16 -2
  127. package/dist/src/prediction/config.js +10 -4
  128. package/dist/src/prediction/gift.js +2 -10
  129. package/dist/src/prediction/index.d.ts +11 -11
  130. package/dist/src/prediction/index.js +10 -10
  131. package/dist/src/prediction/prediction.d.ts +45 -0
  132. package/dist/src/prediction/prediction.js +71 -0
  133. package/dist/src/prediction/tx-builders.d.ts +4 -4
  134. package/dist/src/prediction/tx-builders.js +2 -2
  135. package/dist/src/prediction/types.d.ts +2 -0
  136. package/dist/src/prediction/user/index.d.ts +2 -2
  137. package/dist/src/prediction/user/index.js +1 -1
  138. package/dist/src/prediction/user/position.d.ts +2 -2
  139. package/dist/src/prediction/user/position.js +1 -1
  140. package/dist/src/prediction/utils/bcs.d.ts +5 -0
  141. package/dist/src/prediction/utils/bcs.js +5 -0
  142. package/dist/src/prediction/utils/index.d.ts +7 -0
  143. package/dist/src/prediction/utils/index.js +7 -0
  144. package/dist/src/sdk.d.ts +10 -6
  145. package/dist/src/sdk.js +9 -5
  146. package/dist/src/unified-client.d.ts +140 -145
  147. package/dist/src/unified-client.js +98 -40
  148. package/dist/src/utils/config.d.ts +1 -1
  149. package/package.json +22 -5
  150. package/dist/src/config.d.ts +0 -292
  151. package/dist/src/fetch.d.ts +0 -254
  152. package/dist/src/fetch.js +0 -564
  153. package/dist/src/prediction/generated/bucket_v2_framework/account.d.ts +0 -100
  154. package/dist/src/prediction/generated/bucket_v2_framework/account.js +0 -129
  155. package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.d.ts +0 -6
  156. package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.js +0 -19
  157. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.d.ts +0 -10
  158. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +0 -36
  159. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.js +0 -27
  160. package/dist/src/prediction/generated/bucket_v2_framework/double.d.ts +0 -382
  161. package/dist/src/prediction/generated/bucket_v2_framework/double.js +0 -466
  162. package/dist/src/prediction/generated/bucket_v2_framework/float.d.ts +0 -362
  163. package/dist/src/prediction/generated/bucket_v2_framework/float.js +0 -440
  164. package/dist/src/prediction/generated/bucket_v2_framework/liability.d.ts +0 -193
  165. package/dist/src/prediction/generated/bucket_v2_framework/liability.js +0 -205
  166. package/dist/src/prediction/generated/bucket_v2_framework/linked_table.d.ts +0 -384
  167. package/dist/src/prediction/generated/bucket_v2_framework/linked_table.js +0 -382
  168. package/dist/src/prediction/generated/bucket_v2_framework/sheet.d.ts +0 -344
  169. package/dist/src/prediction/generated/bucket_v2_framework/sheet.js +0 -338
  170. package/dist/src/prediction/generated/utils/index.d.ts +0 -30
  171. package/dist/src/prediction/generated/utils/index.js +0 -160
  172. package/dist/src/prediction/generated/waterx_account/account.d.ts +0 -1589
  173. package/dist/src/prediction/generated/waterx_account/account.js +0 -1758
  174. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +0 -7
  175. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.js +0 -13
  176. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +0 -7
  177. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.js +0 -16
  178. package/dist/src/prediction/generated/waterx_account/deps/std/type_name.d.ts +0 -6
  179. package/dist/src/prediction/generated/waterx_account/deps/std/type_name.js +0 -19
  180. package/dist/src/prediction/generated/waterx_account/deps/sui/balance.d.ts +0 -10
  181. package/dist/src/prediction/generated/waterx_account/deps/sui/balance.js +0 -14
  182. package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.d.ts +0 -12
  183. package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.js +0 -19
  184. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.d.ts +0 -36
  185. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.js +0 -27
  186. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.d.ts +0 -16
  187. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.js +0 -19
  188. package/dist/src/prediction/generated/waterx_account/direct_rule.d.ts +0 -75
  189. package/dist/src/prediction/generated/waterx_account/direct_rule.js +0 -78
  190. package/dist/src/prediction/generated/waterx_account/events.d.ts +0 -33
  191. package/dist/src/prediction/generated/waterx_account/events.js +0 -137
  192. package/dist/src/prediction/generated/waterx_account/version.js +0 -8
  193. package/dist/src/prediction/generated/waterx_prediction/bet_sharing.d.ts +0 -60
  194. package/dist/src/prediction/generated/waterx_prediction/bet_sharing.js +0 -83
  195. package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.js +0 -14
  196. package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.d.ts +0 -24
  197. package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.js +0 -31
  198. package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.d.ts +0 -16
  199. package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.js +0 -19
  200. package/dist/src/prediction/generated/waterx_prediction/events.d.ts +0 -22
  201. package/dist/src/prediction/generated/waterx_prediction/version.d.ts +0 -10
  202. package/dist/src/tx-builders.d.ts +0 -296
  203. package/dist/src/tx-builders.js +0 -461
  204. package/dist/src/user/index.d.ts +0 -8
  205. package/dist/src/user/index.js +0 -8
  206. package/dist/src/utils/pyth.d.ts +0 -124
  207. package/dist/src/utils/pyth.js +0 -392
  208. /package/dist/src/{utils → account}/account-request.js +0 -0
  209. /package/dist/src/{core → account}/waterx-account.d.ts +0 -0
  210. /package/dist/src/{core → account}/waterx-account.js +0 -0
  211. /package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.js +0 -0
  212. /package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.js +0 -0
  213. /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +0 -0
  214. /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.js +0 -0
  215. /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/balance.js +0 -0
  216. /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.js +0 -0
  217. /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.d.ts +0 -0
  218. /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.js +0 -0
  219. /package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.js +0 -0
  220. /package/dist/src/{prediction/generated → generated}/waterx_prediction/order.js +0 -0
  221. /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.d.ts +0 -0
  222. /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.js +0 -0
  223. /package/dist/src/{prediction/generated → generated}/waterx_prediction/position.js +0 -0
  224. /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/version.d.ts +0 -0
  225. /package/dist/src/{prediction/generated → generated}/waterx_prediction/version.js +0 -0
  226. /package/dist/src/{prediction/generated → generated}/waterx_prediction/view.js +0 -0
@@ -1,83 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * On-chain audit trail for `place_order_for`: payer (host) fronts funds while the
6
- * beneficiary `waterx_account` owns order / position indexing and payouts.
7
- */
8
- import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
9
- import { bcs } from '@mysten/sui/bcs';
10
- const $moduleName = '@waterx/prediction::bet_sharing';
11
- export const BetSharing = new MoveStruct({ name: `${$moduleName}::BetSharing`, fields: {
12
- id: bcs.Address,
13
- host_account_id: bcs.Address,
14
- beneficiary_account_id: bcs.Address,
15
- order_id: bcs.u64(),
16
- market_key: bcs.u64(),
17
- created_at_ms: bcs.u64()
18
- } });
19
- export function hostAccountId(options) {
20
- const packageAddress = options.package ?? '@waterx/prediction';
21
- const argumentsTypes = [
22
- null
23
- ];
24
- const parameterNames = ["bs"];
25
- return (tx) => tx.moveCall({
26
- package: packageAddress,
27
- module: 'bet_sharing',
28
- function: 'host_account_id',
29
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
30
- });
31
- }
32
- export function beneficiaryAccountId(options) {
33
- const packageAddress = options.package ?? '@waterx/prediction';
34
- const argumentsTypes = [
35
- null
36
- ];
37
- const parameterNames = ["bs"];
38
- return (tx) => tx.moveCall({
39
- package: packageAddress,
40
- module: 'bet_sharing',
41
- function: 'beneficiary_account_id',
42
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
43
- });
44
- }
45
- export function orderId(options) {
46
- const packageAddress = options.package ?? '@waterx/prediction';
47
- const argumentsTypes = [
48
- null
49
- ];
50
- const parameterNames = ["bs"];
51
- return (tx) => tx.moveCall({
52
- package: packageAddress,
53
- module: 'bet_sharing',
54
- function: 'order_id',
55
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
56
- });
57
- }
58
- export function marketKey(options) {
59
- const packageAddress = options.package ?? '@waterx/prediction';
60
- const argumentsTypes = [
61
- null
62
- ];
63
- const parameterNames = ["bs"];
64
- return (tx) => tx.moveCall({
65
- package: packageAddress,
66
- module: 'bet_sharing',
67
- function: 'market_key',
68
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
69
- });
70
- }
71
- export function createdAtMs(options) {
72
- const packageAddress = options.package ?? '@waterx/prediction';
73
- const argumentsTypes = [
74
- null
75
- ];
76
- const parameterNames = ["bs"];
77
- return (tx) => tx.moveCall({
78
- package: packageAddress,
79
- module: 'bet_sharing',
80
- function: 'created_at_ms',
81
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
82
- });
83
- }
@@ -1,14 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * A storable handler for Balances in general. Is used in the `Coin` module to
6
- * allow balance operations and can be used to implement custom coins with `Supply`
7
- * and `Balance`s.
8
- */
9
- import { MoveStruct } from "../../../utils/index.js";
10
- import { bcs } from '@mysten/sui/bcs';
11
- const $moduleName = '0x2::balance';
12
- export const Balance = new MoveStruct({ name: `${$moduleName}::Balance<phantom T>`, fields: {
13
- value: bcs.u64()
14
- } });
@@ -1,24 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * A table is a map-like collection. But unlike a traditional collection, it's keys
6
- * and values are not stored within the `Table` value, but instead are stored using
7
- * Sui's object system. The `Table` struct acts only as a handle into the object
8
- * system to retrieve those keys and values. Note that this means that `Table`
9
- * values with exactly the same key-value mapping will not be equal, with `==`, at
10
- * runtime. For example
11
- *
12
- * ```
13
- * let table1 = table::new<u64, bool>();
14
- * let table2 = table::new<u64, bool>();
15
- * table::add(&mut table1, 0, false);
16
- * table::add(&mut table1, 1, true);
17
- * table::add(&mut table2, 0, false);
18
- * table::add(&mut table2, 1, true);
19
- * // table1 does not equal table2, despite having the same entries
20
- * assert!(&table1 != &table2);
21
- * ```
22
- */
23
- import { MoveStruct } from '../../../utils/index.ts';
24
- export declare const Table: MoveStruct<any, any>;
@@ -1,31 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * A table is a map-like collection. But unlike a traditional collection, it's keys
6
- * and values are not stored within the `Table` value, but instead are stored using
7
- * Sui's object system. The `Table` struct acts only as a handle into the object
8
- * system to retrieve those keys and values. Note that this means that `Table`
9
- * values with exactly the same key-value mapping will not be equal, with `==`, at
10
- * runtime. For example
11
- *
12
- * ```
13
- * let table1 = table::new<u64, bool>();
14
- * let table2 = table::new<u64, bool>();
15
- * table::add(&mut table1, 0, false);
16
- * table::add(&mut table1, 1, true);
17
- * table::add(&mut table2, 0, false);
18
- * table::add(&mut table2, 1, true);
19
- * // table1 does not equal table2, despite having the same entries
20
- * assert!(&table1 != &table2);
21
- * ```
22
- */
23
- import { MoveStruct } from "../../../utils/index.js";
24
- import { bcs } from '@mysten/sui/bcs';
25
- const $moduleName = '0x2::table';
26
- export const Table = new MoveStruct({ name: `${$moduleName}::Table<phantom K, phantom V>`, fields: {
27
- /** the ID of this table */
28
- id: bcs.Address,
29
- /** the number of key-value pairs in the table */
30
- size: bcs.u64()
31
- } });
@@ -1,16 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { type BcsType } from '@mysten/sui/bcs';
5
- import { MoveStruct } from '../../../utils/index.ts';
6
- /**
7
- * A set data structure backed by a vector. The set is guaranteed not to contain
8
- * duplicate keys. All operations are O(N) in the size of the set
9
- *
10
- * - the intention of this data structure is only to provide the convenience of
11
- * programming against a set API. Sets that need sorted iteration rather than
12
- * insertion order iteration should be handwritten.
13
- */
14
- export declare function VecSet<K extends BcsType<any>>(...typeParameters: [
15
- K
16
- ]): MoveStruct<any, any>;
@@ -1,19 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { bcs } from '@mysten/sui/bcs';
5
- import { MoveStruct } from "../../../utils/index.js";
6
- const $moduleName = '0x2::vec_set';
7
- /**
8
- * A set data structure backed by a vector. The set is guaranteed not to contain
9
- * duplicate keys. All operations are O(N) in the size of the set
10
- *
11
- * - the intention of this data structure is only to provide the convenience of
12
- * programming against a set API. Sets that need sorted iteration rather than
13
- * insertion order iteration should be handwritten.
14
- */
15
- export function VecSet(...typeParameters) {
16
- return new MoveStruct({ name: `${$moduleName}::VecSet<${typeParameters[0].name}>`, fields: {
17
- contents: bcs.vector(typeParameters[0])
18
- } });
19
- }
@@ -1,22 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct } from '../utils/index.ts';
5
- export declare const KeeperAdded: MoveStruct<any, any>;
6
- export declare const KeeperRemoved: MoveStruct<any, any>;
7
- export declare const MarketCreated: MoveStruct<any, any>;
8
- export declare const OrderPlaced: MoveStruct<any, any>;
9
- export declare const OrderFilled: MoveStruct<any, any>;
10
- export declare const OrderCancelled: MoveStruct<any, any>;
11
- export declare const MarketResolved: MoveStruct<any, any>;
12
- export declare const PositionClaimed: MoveStruct<any, any>;
13
- export declare const PositionTransferred: MoveStruct<any, any>;
14
- export declare const PositionSplit: MoveStruct<any, any>;
15
- export declare const CloseRequested: MoveStruct<any, any>;
16
- export declare const CloseConfirmed: MoveStruct<any, any>;
17
- export declare const CloseCancelled: MoveStruct<any, any>;
18
- export declare const MarketPaused: MoveStruct<any, any>;
19
- export declare const MarketUnpaused: MoveStruct<any, any>;
20
- export declare const MarketRegistryWithdrawn: MoveStruct<any, any>;
21
- export declare const MinReserveUpdated: MoveStruct<any, any>;
22
- export declare const OrderCancelCooldownUpdated: MoveStruct<any, any>;
@@ -1,10 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { type Transaction } from '@mysten/sui/transactions';
5
- export interface PackageVersionOptions {
6
- package?: string;
7
- arguments?: [
8
- ];
9
- }
10
- export declare function packageVersion(options?: PackageVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -1,296 +0,0 @@
1
- /**
2
- * High-level transaction builders that compose oracle refresh + the
3
- * appropriate `*_request` + `execute` for a single user-side action.
4
- *
5
- * Each top-level builder:
6
- * 1. Creates a fresh `Transaction` (or appends to one you pass in).
7
- * 2. Refreshes the on-chain `Oracle` for the base + collateral tickers
8
- * via Pyth (uses `utils/pyth.ts`).
9
- * 3. Calls the request builder.
10
- * 4. If `useSponsor` (default true on testnet): opens a Fund via
11
- * `pyth_sponsor_rule::request`, then closes it with `reimburse`
12
- * which attaches the `PythSponsorRule` witness to the
13
- * TradingRequest so the market's `request_checklist` is satisfied.
14
- * 5. Executes the trading request via `trading::execute`.
15
- */
16
- import { Transaction, type TransactionArgument } from "@mysten/sui/transactions";
17
- import type { WaterXClient } from "./client.ts";
18
- import { type RedeemVaaParams, type RouteWormholeParams } from "./user/credit.ts";
19
- import { type AddPreOrderRequestParams, type CancelOrderRequestParams, type CancelPreOrderRequestParams, type PlaceOrderRequestParams, type UpdateOrderRequestParams } from "./user/order.ts";
20
- import { type ClosePositionRequestParams, type DecreasePositionRequestParams, type DepositCollateralRequestParams, type IncreasePositionRequestParams, type WithdrawCollateralRequestParams } from "./user/trading.ts";
21
- import { type CancelRedeemWlpParams, type MintWlpParams, type RequestRedeemWlpParams } from "./user/wlp.ts";
22
- import { openPythSponsorFund, PythCache, refreshOraclePrices, reimbursePythSponsor, updatePythPrices } from "./utils/pyth.ts";
23
- export interface CommonBuildOpts {
24
- /** Append to an existing PTB instead of creating a new one. */
25
- tx?: Transaction;
26
- /** Skip oracle refresh entirely (caller manages freshness). Default: false. */
27
- skipOraclePriceRefresh?: boolean;
28
- /** Share a `PythCache` across builders to avoid redundant pyth_state reads. */
29
- pythCache?: PythCache;
30
- /**
31
- * Wire the `pyth_sponsor_rule` flow:
32
- * - open a Fund via `pyth_sponsor_rule::request(sponsor)`
33
- * - pay Pyth update fees from the Fund (instead of `tx.gas`)
34
- * - reimburse leftover into the sponsor pool + attach
35
- * `PythSponsorRule` witness to the TradingRequest so markets
36
- * whose `request_checklist` contains `PythSponsorRule` accept it
37
- * Default: true (matches the testnet/mainnet checklist config).
38
- * Pass `false` only when the market checklist is empty.
39
- */
40
- useSponsor?: boolean;
41
- /**
42
- * Pre-sweep parked backing assets (USDC, USDsui, …) at the wxa account's
43
- * address into USD credit, plus any CREDIT coins/funds at the address into
44
- * the internal wxa slot — see {@link appendConsolidateForSpend}. Skips empty
45
- * buckets via gRPC probes so it's safe on any account.
46
- *
47
- * Default: `true`. Set to `false` to skip (e.g. caller already swept,
48
- * deployment lacks `native_custody`, or the gRPC reads aren't worth
49
- * the latency).
50
- *
51
- * Each enabled call adds 2 gRPC reads per configured backing asset
52
- * (`getBalance` + `listCoins`).
53
- *
54
- * Only honored by async builders (this is an async sweep). Sync
55
- * builders never auto-prepend the sweep — for those, call
56
- * {@link buildConsolidateToUsdTx} separately.
57
- */
58
- consolidateToUsd?: boolean;
59
- }
60
- /**
61
- * For every backing asset registered on `native_custody`, append two drain
62
- * legs to `tx`:
63
- *
64
- * `requestDepositFromFunds<T>` → `mintCreditFromRequest<T, USD>` → `consumeDepositDirect<USD>`
65
- * `requestDepositFromReceivings<T>` → `mintCreditFromRequest<T, USD>` → `consumeDepositDirect<USD>`
66
- *
67
- * Empty legs are skipped — the on-chain `mint` rejects zero-amount deposits.
68
- * Returns the number of drain legs added (useful for logging / early-out).
69
- *
70
- * Silently no-ops when `native_custody` / `waterx_credit` aren't configured
71
- * for the loaded deployment.
72
- */
73
- export declare function appendConsolidateToUsd(client: WaterXClient, tx: Transaction, accountId: string): Promise<number>;
74
- /**
75
- * Drain CREDIT parked at `accountId`'s Sui address (funds accumulator +
76
- * owned `Coin<CREDIT>`) into the wxa internal slot via
77
- * `consumeDepositDirect<CREDIT>`. Complements {@link appendConsolidateToUsd}
78
- * for address-owned wxUSD that predict / perp actions debit from the internal
79
- * balance.
80
- */
81
- export declare function appendConsolidateAddressCredit(client: WaterXClient, tx: Transaction, accountId: string): Promise<number>;
82
- /**
83
- * Full pre-action sweep: backing assets → wxUSD credit (PSM) plus address
84
- * CREDIT → internal slot. Used by async tx-builders when `consolidateToUsd`
85
- * is enabled (default).
86
- */
87
- export declare function appendConsolidateForSpend(client: WaterXClient, tx: Transaction, accountId: string): Promise<number>;
88
- /**
89
- * Standalone PTB that drains every backing asset parked at the account's
90
- * address into USD credit under the account — see {@link appendConsolidateToUsd}.
91
- *
92
- * Returns an empty `Transaction` when nothing is parked. Callers can
93
- * `client.simulate(tx)` to detect a no-op before submitting.
94
- */
95
- export declare function buildConsolidateToUsdTx(client: WaterXClient, accountId: string, tx?: Transaction): Promise<Transaction>;
96
- export interface BuildClosePositionParams extends ClosePositionRequestParams, CommonBuildOpts {
97
- collateralTicker?: string;
98
- }
99
- export declare function buildClosePositionTx(client: WaterXClient, params: BuildClosePositionParams): Promise<Transaction>;
100
- export interface BuildIncreasePositionParams extends IncreasePositionRequestParams, CommonBuildOpts {
101
- collateralTicker?: string;
102
- }
103
- export declare function buildIncreasePositionTx(client: WaterXClient, params: BuildIncreasePositionParams): Promise<Transaction>;
104
- export interface BuildDecreasePositionParams extends DecreasePositionRequestParams, CommonBuildOpts {
105
- collateralTicker?: string;
106
- }
107
- export declare function buildDecreasePositionTx(client: WaterXClient, params: BuildDecreasePositionParams): Promise<Transaction>;
108
- export interface BuildDepositCollateralParams extends DepositCollateralRequestParams, CommonBuildOpts {
109
- collateralTicker?: string;
110
- }
111
- export declare function buildDepositCollateralTx(client: WaterXClient, params: BuildDepositCollateralParams): Promise<Transaction>;
112
- export interface BuildWithdrawCollateralParams extends WithdrawCollateralRequestParams, CommonBuildOpts {
113
- collateralTicker?: string;
114
- }
115
- export declare function buildWithdrawCollateralTx(client: WaterXClient, params: BuildWithdrawCollateralParams): Promise<Transaction>;
116
- export interface BuildPlaceOrderParams extends PlaceOrderRequestParams, CommonBuildOpts {
117
- collateralTicker?: string;
118
- }
119
- export declare function buildPlaceOrderTx(client: WaterXClient, params: BuildPlaceOrderParams): Promise<Transaction>;
120
- export interface BuildCancelOrderParams extends CancelOrderRequestParams, CommonBuildOpts {
121
- collateralTicker?: string;
122
- }
123
- export declare function buildCancelOrderTx(client: WaterXClient, params: BuildCancelOrderParams): Promise<Transaction>;
124
- export interface BuildUpdateOrderParams extends UpdateOrderRequestParams, CommonBuildOpts {
125
- collateralTicker?: string;
126
- }
127
- export declare function buildUpdateOrderTx(client: WaterXClient, params: BuildUpdateOrderParams): Promise<Transaction>;
128
- export interface BuildCancelPreOrderParams extends CancelPreOrderRequestParams, CommonBuildOpts {
129
- collateralTicker?: string;
130
- }
131
- export declare function buildCancelPreOrderTx(client: WaterXClient, params: BuildCancelPreOrderParams): Promise<Transaction>;
132
- export interface BuildAddPreOrderParams extends AddPreOrderRequestParams, CommonBuildOpts {
133
- collateralTicker?: string;
134
- }
135
- export declare function buildAddPreOrderTx(client: WaterXClient, params: BuildAddPreOrderParams): Promise<Transaction>;
136
- export interface BuildMintWlpParams extends MintWlpParams, CommonBuildOpts {
137
- /** Oracle ticker for the deposited token (must be a registered pool token). */
138
- depositTicker: string;
139
- }
140
- /**
141
- * Mints WLP from a deposit asset already in the wxa account's stored
142
- * balance. Refreshes every pool-token oracle + bumps each pool token's
143
- * `last_price_refresh_timestamp` so `assert_prices_fresh` inside
144
- * `mint_wlp` passes.
145
- *
146
- * Does NOT use the pyth_sponsor flow — `mint_wlp` produces no
147
- * `TradingRequest`, so there's nothing for the sponsor to attach its
148
- * witness to. Pyth update fees come from `tx.gas`.
149
- */
150
- export declare function buildMintWlpTx(client: WaterXClient, params: BuildMintWlpParams): Promise<Transaction>;
151
- export interface BuildMintAndStakeWlpParams extends BuildMintWlpParams {
152
- /**
153
- * Staking pool alias (key into `waterx_staking.pools`). Defaults to `"WLP"`.
154
- */
155
- stakeAlias?: string;
156
- /**
157
- * Rewarder coin types to settle on the stake deposit. Order must match the
158
- * pool's on-chain `rewarder_ids`. Defaults to every rewarder configured for
159
- * the stake pool in `waterx_staking.rewarders[stakeAlias]`.
160
- */
161
- rewarderTypes?: string[];
162
- }
163
- /**
164
- * Mints WLP and immediately stakes the minted amount into the WLP staking pool
165
- * in the same PTB. The mint's `lp_amount` return is piped directly into the
166
- * `stake` call so no precision loss / dust can occur.
167
- *
168
- * Use this instead of `buildMintWlpTx` when the product flow is "deposit USD
169
- * and earn rewards" — un-staked WLP sitting in the wxa account's `Balance<WLP>`
170
- * slot earns nothing.
171
- */
172
- export declare function buildMintAndStakeWlpTx(client: WaterXClient, params: BuildMintAndStakeWlpParams): Promise<Transaction>;
173
- export interface BuildUnstakeAndRequestRedeemWlpParams extends Omit<RequestRedeemWlpParams, "lpAmount">, CommonBuildOpts {
174
- /** Amount of staked WLP to unstake and enqueue for redemption. */
175
- withdrawalAmount: bigint | number;
176
- /** Staking pool alias. Defaults to `"WLP"`. */
177
- stakeAlias?: string;
178
- /**
179
- * Rewarder coin types to settle on unstake. Defaults to every rewarder
180
- * configured for the stake pool in `waterx_staking.rewarders[stakeAlias]`.
181
- */
182
- rewarderTypes?: string[];
183
- }
184
- /**
185
- * Unstakes WLP from the staking pool and immediately enqueues a redeem request
186
- * in the same PTB. Mirror of `buildMintAndStakeWlpTx` for withdrawals.
187
- *
188
- * Refreshes every WLP pool-token oracle by default — `request_redeem` runs
189
- * `assert_prices_fresh` internally, so a stale oracle would abort the PTB.
190
- * Pass `skipOraclePriceRefresh: true` only when the caller is composing this
191
- * into a larger PTB that already pre-pumps prices.
192
- */
193
- export declare function buildUnstakeAndRequestRedeemWlpTx(client: WaterXClient, params: BuildUnstakeAndRequestRedeemWlpParams): Promise<Transaction>;
194
- export interface BuildCancelRedeemAndStakeWlpParams extends CancelRedeemWlpParams, CommonBuildOpts {
195
- accountId: string;
196
- /**
197
- * WLP amount (base units) that was originally enqueued by `request_redeem`
198
- * and is being returned to the wxa account by `cancel_redeem` — gets
199
- * re-staked into the WLP staking pool in the same PTB.
200
- */
201
- stakeAmount: bigint | number;
202
- /** Staking pool alias. Defaults to `"WLP"`. */
203
- stakeAlias?: string;
204
- /**
205
- * Rewarder coin types to settle on stake. Defaults to every rewarder
206
- * configured for the stake pool in `waterx_staking.rewarders[stakeAlias]`.
207
- */
208
- rewarderTypes?: string[];
209
- }
210
- /**
211
- * Cancels a pending WLP redeem request and re-stakes the returned WLP in the
212
- * same PTB. Third partner of `buildMintAndStakeWlpTx` /
213
- * `buildUnstakeAndRequestRedeemWlpTx`; together they keep the product
214
- * invariant that user-held WLP is always staked.
215
- */
216
- export declare function buildCancelRedeemAndStakeWlpTx(client: WaterXClient, params: BuildCancelRedeemAndStakeWlpParams): Transaction;
217
- export interface BuildClaimRewardsToAccountParams extends CommonBuildOpts {
218
- accountId: string;
219
- /** Staking pool alias. Defaults to `"WLP"`. */
220
- stakeAlias?: string;
221
- /** Fully-qualified stake coin type. Defaults to `client.wlpType()`. */
222
- stakeType?: string;
223
- /**
224
- * Reward coin types to claim. Defaults to every rewarder configured for the
225
- * stake pool in `waterx_staking.rewarders[stakeAlias]`.
226
- */
227
- rewarderTypes?: string[];
228
- bucketAccount?: string | TransactionArgument;
229
- }
230
- /**
231
- * Claims every accrued reward for `accountId` on the given stake pool. Each
232
- * resulting `Coin<R>` is TTO'd to the wxa account's UID address via
233
- * `wxa_account::transfer_coin<R>` (the default behaviour of the Move
234
- * `staking::claim` entry — no deposit-policy registration required for the
235
- * reward token). The account owner collects each coin via
236
- * `wxa_account::receive` in a separate user action.
237
- */
238
- export declare function buildClaimRewardsToAccountTx(client: WaterXClient, params: BuildClaimRewardsToAccountParams): Transaction;
239
- export interface BuildRedeemVaaParams extends RedeemVaaParams {
240
- /** Append to an existing PTB instead of creating a new one. */
241
- tx?: Transaction;
242
- }
243
- /**
244
- * Mint (EVM → Sui): `redeem_vaa<CREDIT>` + consume the resulting
245
- * `DepositRequest<CREDIT>` via the configured wxa deposit policy, in one
246
- * PTB. The recipient wxa account is encoded in the VAA payload.
247
- */
248
- export declare function buildRedeemVaaTx(client: WaterXClient, params: BuildRedeemVaaParams): Transaction;
249
- export type CreditWithdrawRoute = ({
250
- kind: "wormhole";
251
- } & RouteWormholeParams) | {
252
- kind: "native";
253
- assetType: string;
254
- };
255
- export interface BuildRequestCreditWithdrawParams {
256
- accountId: string;
257
- amount: bigint | number;
258
- /** Sui-side recipient (honored for native payouts; ignored for wormhole). */
259
- recipient: string;
260
- route: CreditWithdrawRoute;
261
- creditType?: string;
262
- bucketAccount?: string | TransactionArgument;
263
- tx?: Transaction;
264
- }
265
- /**
266
- * Withdraw (user side): encode the route, `account::request_withdraw<CREDIT>`,
267
- * then `withdrawal_queue::enqueue<CREDIT>` — all in one PTB. A keeper later
268
- * drains the parked entry via {@link buildExecuteWithdrawalTx}.
269
- */
270
- export declare function buildRequestCreditWithdrawTx(client: WaterXClient, params: BuildRequestCreditWithdrawParams): Transaction;
271
- export type ExecuteWithdrawalRoute = {
272
- kind: "wormhole";
273
- /**
274
- * `Coin<SUI>` paying the Wormhole message fee. Omit to mint a zero-value
275
- * coin via `0x2::coin::zero<SUI>` — sponsor-safe (never touches `tx.gas`,
276
- * so Shinami-style gas stations don't reject the PTB) and free as long as
277
- * `WormholeState.message_fee == 0`. Pass an explicit coin (e.g.
278
- * `tx.object(...)`) once Wormhole raises the message fee.
279
- */
280
- wormholeFeeCoin?: TransactionArgument;
281
- } | {
282
- kind: "native";
283
- assetType: string;
284
- };
285
- export interface BuildExecuteWithdrawalParams {
286
- /** Queue entry key (from the `Enqueued` event). */
287
- key: bigint | number;
288
- route: ExecuteWithdrawalRoute;
289
- creditType?: string;
290
- /** Executor identity (must be on the queue allowlist). Defaults to tx sender. */
291
- bucketAccount?: string | TransactionArgument;
292
- tx?: Transaction;
293
- }
294
- /** Keeper: drain one parked queue entry. */
295
- export declare function buildExecuteWithdrawalTx(client: WaterXClient, params: BuildExecuteWithdrawalParams): Transaction;
296
- export { openPythSponsorFund, PythCache, refreshOraclePrices, reimbursePythSponsor, updatePythPrices, };