@waterx/sdk 2.1.0 → 2.3.1-dev.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 (231) hide show
  1. package/README.md +75 -169
  2. package/dist/src/client.d.ts +52 -2
  3. package/dist/src/client.js +76 -6
  4. package/dist/src/config.d.ts +57 -3
  5. package/dist/src/config.js +10 -4
  6. package/dist/src/constants.d.ts +6 -0
  7. package/dist/src/constants.js +6 -0
  8. package/dist/src/core/waterx-account.d.ts +31 -0
  9. package/dist/src/core/waterx-account.js +26 -0
  10. package/dist/src/fetch.d.ts +110 -0
  11. package/dist/src/fetch.js +149 -4
  12. package/dist/src/generated/bucket_v2_framework/account.d.ts +5 -5
  13. package/dist/src/generated/bucket_v2_framework/double.d.ts +77 -77
  14. package/dist/src/generated/bucket_v2_framework/float.d.ts +73 -73
  15. package/dist/src/generated/bucket_v2_framework/liability.d.ts +33 -33
  16. package/dist/src/generated/bucket_v2_framework/linked_table.d.ts +5 -5
  17. package/dist/src/generated/bucket_v2_framework/linked_table.js +2 -2
  18. package/dist/src/generated/bucket_v2_framework/sheet.d.ts +57 -57
  19. package/dist/src/generated/bucket_v2_framework/sheet.js +5 -11
  20. package/dist/src/generated/native_custody/custody_vault.d.ts +46 -32
  21. package/dist/src/generated/native_custody/custody_vault.js +19 -10
  22. package/dist/src/generated/native_custody/deps/bucket_v2_framework/sheet.js +1 -3
  23. package/dist/src/generated/native_custody/events.js +1 -2
  24. package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +7 -7
  25. package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +1 -2
  26. package/dist/src/generated/utils/index.d.ts +7 -7
  27. package/dist/src/generated/utils/index.js +9 -6
  28. package/dist/src/generated/waterx_account/account.d.ts +124 -71
  29. package/dist/src/generated/waterx_account/account.js +64 -29
  30. package/dist/src/generated/waterx_account/deps/bucket_v2_framework/sheet.js +1 -3
  31. package/dist/src/generated/waterx_account/direct_rule.d.ts +5 -5
  32. package/dist/src/generated/waterx_account/events.d.ts +10 -0
  33. package/dist/src/generated/waterx_account/events.js +31 -50
  34. package/dist/src/generated/waterx_constant_rule/constant_rule.d.ts +68 -0
  35. package/dist/src/generated/waterx_constant_rule/constant_rule.js +59 -0
  36. package/dist/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.d.ts +8 -0
  37. package/dist/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.js +10 -0
  38. package/dist/src/generated/waterx_constant_rule/deps/sui/vec_map.d.ts +36 -0
  39. package/dist/src/generated/waterx_constant_rule/deps/sui/vec_map.js +27 -0
  40. package/dist/src/generated/waterx_credit/credit_registry.d.ts +9 -9
  41. package/dist/src/generated/waterx_credit/credit_registry.js +1 -2
  42. package/dist/src/generated/waterx_credit/limited_supply.d.ts +17 -17
  43. package/dist/src/generated/waterx_oracle/aggregator.js +1 -2
  44. package/dist/src/generated/waterx_oracle/collector.d.ts +17 -17
  45. package/dist/src/generated/waterx_oracle/collector.js +1 -1
  46. package/dist/src/generated/waterx_oracle/oracle.d.ts +5 -5
  47. package/dist/src/generated/waterx_perp/account_data.d.ts +5 -5
  48. package/dist/src/generated/waterx_perp/account_data.js +1 -2
  49. package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.js +1 -3
  50. package/dist/src/generated/waterx_perp/events.d.ts +181 -181
  51. package/dist/src/generated/waterx_perp/events.js +87 -173
  52. package/dist/src/generated/waterx_perp/global_config.d.ts +3 -3
  53. package/dist/src/generated/waterx_perp/global_config.js +6 -12
  54. package/dist/src/generated/waterx_perp/keyed_big_vector.d.ts +9 -9
  55. package/dist/src/generated/waterx_perp/keyed_big_vector.js +1 -2
  56. package/dist/src/generated/waterx_perp/lp_pool.d.ts +115 -115
  57. package/dist/src/generated/waterx_perp/lp_pool.js +11 -22
  58. package/dist/src/generated/waterx_perp/market_config.d.ts +61 -43
  59. package/dist/src/generated/waterx_perp/market_config.js +29 -22
  60. package/dist/src/generated/waterx_perp/math.d.ts +7 -7
  61. package/dist/src/generated/waterx_perp/order_book.d.ts +47 -47
  62. package/dist/src/generated/waterx_perp/position.d.ts +99 -99
  63. package/dist/src/generated/waterx_perp/position.js +6 -12
  64. package/dist/src/generated/waterx_perp/request.d.ts +67 -67
  65. package/dist/src/generated/waterx_perp/request.js +2 -3
  66. package/dist/src/generated/waterx_perp/response.d.ts +35 -35
  67. package/dist/src/generated/waterx_perp/response.js +1 -2
  68. package/dist/src/generated/waterx_perp/trading.d.ts +303 -179
  69. package/dist/src/generated/waterx_perp/trading.js +99 -14
  70. package/dist/src/generated/waterx_perp_view/view.js +5 -10
  71. package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +5 -5
  72. package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +1 -2
  73. package/dist/src/generated/waterx_referral/referral_table.d.ts +5 -5
  74. package/dist/src/generated/waterx_referral/referral_table.js +1 -2
  75. package/dist/src/generated/waterx_staking/waterx_staking.d.ts +19 -19
  76. package/dist/src/generated/waterx_staking/waterx_staking.js +10 -20
  77. package/dist/src/generated/waterx_supra_rule/deps/sui/vec_map.d.ts +36 -0
  78. package/dist/src/generated/waterx_supra_rule/deps/sui/vec_map.js +27 -0
  79. package/dist/src/generated/waterx_supra_rule/supra_rule.d.ts +158 -0
  80. package/dist/src/generated/waterx_supra_rule/supra_rule.js +148 -0
  81. package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.d.ts +8 -0
  82. package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.js +10 -0
  83. package/dist/src/generated/withdrawal_queue/deps/sui/vec_map.d.ts +36 -0
  84. package/dist/src/generated/withdrawal_queue/deps/sui/vec_map.js +27 -0
  85. package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +444 -4
  86. package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +417 -4
  87. package/dist/src/generated/wormhole_bridge/wormhole_bridge.d.ts +214 -74
  88. package/dist/src/generated/wormhole_bridge/wormhole_bridge.js +158 -29
  89. package/dist/src/index.d.ts +4 -3
  90. package/dist/src/index.js +3 -2
  91. package/dist/src/prediction/account.d.ts +96 -0
  92. package/dist/src/prediction/account.js +230 -0
  93. package/dist/src/prediction/admin.d.ts +47 -0
  94. package/dist/src/prediction/admin.js +105 -0
  95. package/dist/src/prediction/bcs.d.ts +22 -0
  96. package/dist/src/prediction/bcs.js +240 -0
  97. package/dist/src/prediction/client.d.ts +75 -0
  98. package/dist/src/prediction/client.js +164 -0
  99. package/dist/src/prediction/config.d.ts +60 -0
  100. package/dist/src/prediction/config.js +75 -0
  101. package/dist/src/prediction/constants.d.ts +44 -0
  102. package/dist/src/prediction/constants.js +46 -0
  103. package/dist/src/prediction/fetch.d.ts +82 -0
  104. package/dist/src/prediction/fetch.js +270 -0
  105. package/dist/src/prediction/generated/bucket_v2_framework/account.d.ts +100 -0
  106. package/dist/src/prediction/generated/bucket_v2_framework/account.js +129 -0
  107. package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.d.ts +6 -0
  108. package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.js +19 -0
  109. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.d.ts +10 -0
  110. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.js +14 -0
  111. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
  112. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.js +27 -0
  113. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
  114. package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_set.js +19 -0
  115. package/dist/src/prediction/generated/bucket_v2_framework/double.d.ts +382 -0
  116. package/dist/src/prediction/generated/bucket_v2_framework/double.js +466 -0
  117. package/dist/src/prediction/generated/bucket_v2_framework/float.d.ts +362 -0
  118. package/dist/src/prediction/generated/bucket_v2_framework/float.js +440 -0
  119. package/dist/src/prediction/generated/bucket_v2_framework/liability.d.ts +193 -0
  120. package/dist/src/prediction/generated/bucket_v2_framework/liability.js +205 -0
  121. package/dist/src/prediction/generated/bucket_v2_framework/linked_table.d.ts +384 -0
  122. package/dist/src/prediction/generated/bucket_v2_framework/linked_table.js +382 -0
  123. package/dist/src/prediction/generated/bucket_v2_framework/sheet.d.ts +344 -0
  124. package/dist/src/prediction/generated/bucket_v2_framework/sheet.js +338 -0
  125. package/dist/src/prediction/generated/utils/index.d.ts +30 -0
  126. package/dist/src/prediction/generated/utils/index.js +160 -0
  127. package/dist/src/prediction/generated/waterx_account/account.d.ts +1589 -0
  128. package/dist/src/prediction/generated/waterx_account/account.js +1758 -0
  129. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +7 -0
  130. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.js +13 -0
  131. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +7 -0
  132. package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.js +16 -0
  133. package/dist/src/prediction/generated/waterx_account/deps/std/type_name.d.ts +6 -0
  134. package/dist/src/prediction/generated/waterx_account/deps/std/type_name.js +19 -0
  135. package/dist/src/prediction/generated/waterx_account/deps/sui/balance.d.ts +10 -0
  136. package/dist/src/prediction/generated/waterx_account/deps/sui/balance.js +14 -0
  137. package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.d.ts +12 -0
  138. package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.js +19 -0
  139. package/dist/src/prediction/generated/waterx_account/deps/sui/table.d.ts +24 -0
  140. package/dist/src/prediction/generated/waterx_account/deps/sui/table.js +31 -0
  141. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
  142. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.js +27 -0
  143. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
  144. package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.js +19 -0
  145. package/dist/src/prediction/generated/waterx_account/direct_rule.d.ts +75 -0
  146. package/dist/src/prediction/generated/waterx_account/direct_rule.js +78 -0
  147. package/dist/src/prediction/generated/waterx_account/events.d.ts +33 -0
  148. package/dist/src/prediction/generated/waterx_account/events.js +137 -0
  149. package/dist/src/prediction/generated/waterx_account/version.d.ts +10 -0
  150. package/dist/src/prediction/generated/waterx_account/version.js +8 -0
  151. package/dist/src/prediction/generated/waterx_prediction/account_data.d.ts +327 -0
  152. package/dist/src/prediction/generated/waterx_prediction/account_data.js +405 -0
  153. package/dist/src/prediction/generated/waterx_prediction/admin.d.ts +5 -0
  154. package/dist/src/prediction/generated/waterx_prediction/admin.js +9 -0
  155. package/dist/src/prediction/generated/waterx_prediction/bet_sharing.d.ts +60 -0
  156. package/dist/src/prediction/generated/waterx_prediction/bet_sharing.js +83 -0
  157. package/dist/src/prediction/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +8 -0
  158. package/dist/src/prediction/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.js +18 -0
  159. package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.d.ts +10 -0
  160. package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.js +14 -0
  161. package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.d.ts +24 -0
  162. package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.js +31 -0
  163. package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.d.ts +16 -0
  164. package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.js +19 -0
  165. package/dist/src/prediction/generated/waterx_prediction/events.d.ts +22 -0
  166. package/dist/src/prediction/generated/waterx_prediction/events.js +179 -0
  167. package/dist/src/prediction/generated/waterx_prediction/global_config.d.ts +116 -0
  168. package/dist/src/prediction/generated/waterx_prediction/global_config.js +141 -0
  169. package/dist/src/prediction/generated/waterx_prediction/order.d.ts +200 -0
  170. package/dist/src/prediction/generated/waterx_prediction/order.js +284 -0
  171. package/dist/src/prediction/generated/waterx_prediction/outcome.d.ts +58 -0
  172. package/dist/src/prediction/generated/waterx_prediction/outcome.js +73 -0
  173. package/dist/src/prediction/generated/waterx_prediction/position.d.ts +160 -0
  174. package/dist/src/prediction/generated/waterx_prediction/position.js +214 -0
  175. package/dist/src/prediction/generated/waterx_prediction/version.d.ts +10 -0
  176. package/dist/src/prediction/generated/waterx_prediction/version.js +8 -0
  177. package/dist/src/prediction/generated/waterx_prediction/view.d.ts +353 -0
  178. package/dist/src/prediction/generated/waterx_prediction/view.js +432 -0
  179. package/dist/src/prediction/generated/waterx_prediction/waterx_prediction.d.ts +1698 -0
  180. package/dist/src/prediction/generated/waterx_prediction/waterx_prediction.js +1733 -0
  181. package/dist/src/prediction/gift-link.d.ts +6 -0
  182. package/dist/src/prediction/gift-link.js +5 -0
  183. package/dist/src/prediction/gift.d.ts +223 -0
  184. package/dist/src/prediction/gift.js +451 -0
  185. package/dist/src/prediction/index.d.ts +29 -0
  186. package/dist/src/prediction/index.js +21 -0
  187. package/dist/src/prediction/prediction.d.ts +104 -0
  188. package/dist/src/prediction/prediction.js +317 -0
  189. package/dist/src/prediction/tx-builders.d.ts +44 -0
  190. package/dist/src/prediction/tx-builders.js +52 -0
  191. package/dist/src/prediction/types.d.ts +93 -0
  192. package/dist/src/prediction/types.js +1 -0
  193. package/dist/src/prediction/user/account.d.ts +2 -0
  194. package/dist/src/prediction/user/account.js +1 -0
  195. package/dist/src/prediction/user/admin.d.ts +6 -0
  196. package/dist/src/prediction/user/admin.js +3 -0
  197. package/dist/src/prediction/user/gift.d.ts +2 -0
  198. package/dist/src/prediction/user/gift.js +1 -0
  199. package/dist/src/prediction/user/index.d.ts +5 -0
  200. package/dist/src/prediction/user/index.js +3 -0
  201. package/dist/src/prediction/user/keeper.d.ts +2 -0
  202. package/dist/src/prediction/user/keeper.js +1 -0
  203. package/dist/src/prediction/user/order.d.ts +2 -0
  204. package/dist/src/prediction/user/order.js +1 -0
  205. package/dist/src/prediction/user/position.d.ts +2 -0
  206. package/dist/src/prediction/user/position.js +1 -0
  207. package/dist/src/prediction/utils/bcs.d.ts +1 -0
  208. package/dist/src/prediction/utils/bcs.js +1 -0
  209. package/dist/src/prediction/utils/index.d.ts +1 -0
  210. package/dist/src/prediction/utils/index.js +1 -0
  211. package/dist/src/prediction/utils.d.ts +30 -0
  212. package/dist/src/prediction/utils.js +177 -0
  213. package/dist/src/sdk.d.ts +18 -0
  214. package/dist/src/sdk.js +17 -0
  215. package/dist/src/tx-builders.d.ts +54 -0
  216. package/dist/src/tx-builders.js +141 -0
  217. package/dist/src/unified-client.d.ts +407 -0
  218. package/dist/src/unified-client.js +123 -0
  219. package/dist/src/user/account.d.ts +27 -0
  220. package/dist/src/user/account.js +34 -8
  221. package/dist/src/user/credit.d.ts +8 -14
  222. package/dist/src/user/credit.js +9 -23
  223. package/dist/src/user/custody.d.ts +4 -18
  224. package/dist/src/user/custody.js +14 -25
  225. package/dist/src/utils/consolidate-balance.d.ts +37 -0
  226. package/dist/src/utils/consolidate-balance.js +89 -0
  227. package/dist/src/utils/math.d.ts +86 -0
  228. package/dist/src/utils/math.js +100 -0
  229. package/dist/src/utils/pyth.d.ts +35 -3
  230. package/dist/src/utils/pyth.js +145 -14
  231. package/package.json +129 -34
@@ -8,6 +8,10 @@ import * as balance from "./deps/sui/balance.js";
8
8
  import * as linked_table from "./deps/bucket_v2_framework/linked_table.js";
9
9
  import * as vec_set from "./deps/sui/vec_set.js";
10
10
  import * as vec_set_1 from "./deps/sui/vec_set.js";
11
+ import * as float from "./deps/bucket_v2_framework/float.js";
12
+ import * as vec_map from "./deps/sui/vec_map.js";
13
+ import * as float_1 from "./deps/bucket_v2_framework/float.js";
14
+ import * as vec_map_1 from "./deps/sui/vec_map.js";
11
15
  const $moduleName = '@waterx/withdrawal-queue::withdrawal_queue';
12
16
  export const WithdrawQueue = new MoveStruct({ name: `${$moduleName}::WithdrawQueue`, fields: {
13
17
  dummy_field: bcs.bool()
@@ -18,7 +22,14 @@ export const WormholeRoute = new MoveStruct({ name: `${$moduleName}::WormholeRou
18
22
  evm_token: bcs.vector(bcs.u8())
19
23
  } });
20
24
  export const NativeRoute = new MoveStruct({ name: `${$moduleName}::NativeRoute`, fields: {
21
- asset_type: type_name.TypeName
25
+ asset_type: type_name.TypeName,
26
+ /**
27
+ * User-supplied minimum acceptable `Coin<T>` output (after the burn fee).
28
+ * Snapshotted into `extra_data` at withdraw time and enforced in `execute_native`,
29
+ * so an admin burn-fee change between enqueue and execute cannot silently reprice
30
+ * an already-debited withdrawal (audit M15).
31
+ */
32
+ min_output: bcs.u64()
22
33
  } });
23
34
  export const Entry = new MoveStruct({ name: `${$moduleName}::Entry<phantom CREDIT>`, fields: {
24
35
  balance: balance.Balance,
@@ -54,6 +65,37 @@ export const Queue = new MoveStruct({ name: `${$moduleName}::Queue<phantom CREDI
54
65
  */
55
66
  allowed_versions: vec_set_1.VecSet(bcs.u16())
56
67
  } });
68
+ export const BridgeFeeKey = new MoveStruct({ name: `${$moduleName}::BridgeFeeKey`, fields: {
69
+ dummy_field: bcs.bool()
70
+ } });
71
+ export const BridgeFeeConfig = new MoveStruct({ name: `${$moduleName}::BridgeFeeConfig`, fields: {
72
+ default_rate: float.Float,
73
+ chain_rates: vec_map.VecMap(bcs.u16(), float_1.Float)
74
+ } });
75
+ export const BridgeMinFeeKey = new MoveStruct({ name: `${$moduleName}::BridgeMinFeeKey`, fields: {
76
+ dummy_field: bcs.bool()
77
+ } });
78
+ export const BridgeMinFeeConfig = new MoveStruct({ name: `${$moduleName}::BridgeMinFeeConfig`, fields: {
79
+ default_min_fee: bcs.u64(),
80
+ chain_min_fees: vec_map_1.VecMap(bcs.u16(), bcs.u64())
81
+ } });
82
+ export const BridgeFeeUpdated = new MoveStruct({ name: `${$moduleName}::BridgeFeeUpdated<phantom CREDIT>`, fields: {
83
+ /** 1e9-scaled default fee rate now in effect. */
84
+ fee_rate: bcs.u128()
85
+ } });
86
+ export const ChainBridgeFeeUpdated = new MoveStruct({ name: `${$moduleName}::ChainBridgeFeeUpdated<phantom CREDIT>`, fields: {
87
+ evm_destination_chain: bcs.u16(),
88
+ fee_rate: bcs.u128(),
89
+ removed: bcs.bool()
90
+ } });
91
+ export const BridgeMinFeeUpdated = new MoveStruct({ name: `${$moduleName}::BridgeMinFeeUpdated<phantom CREDIT>`, fields: {
92
+ min_fee: bcs.u64()
93
+ } });
94
+ export const ChainBridgeMinFeeUpdated = new MoveStruct({ name: `${$moduleName}::ChainBridgeMinFeeUpdated<phantom CREDIT>`, fields: {
95
+ evm_destination_chain: bcs.u16(),
96
+ min_fee: bcs.u64(),
97
+ removed: bcs.bool()
98
+ } });
57
99
  export const Enqueued = new MoveStruct({ name: `${$moduleName}::Enqueued<phantom CREDIT>`, fields: {
58
100
  key: bcs.u64(),
59
101
  account_id: bcs.Address,
@@ -66,6 +108,12 @@ export const ExecutedWormhole = new MoveStruct({ name: `${$moduleName}::Executed
66
108
  evm_destination_chain: bcs.u16(),
67
109
  amount: bcs.u64()
68
110
  } });
111
+ export const BridgeFeeCharged = new MoveStruct({ name: `${$moduleName}::BridgeFeeCharged<phantom CREDIT>`, fields: {
112
+ key: bcs.u64(),
113
+ evm_destination_chain: bcs.u16(),
114
+ amount: bcs.u64(),
115
+ fee_amount: bcs.u64()
116
+ } });
69
117
  export const ExecutedNative = new MoveStruct({ name: `${$moduleName}::ExecutedNative<phantom CREDIT, phantom T>`, fields: {
70
118
  key: bcs.u64(),
71
119
  recipient: bcs.Address,
@@ -107,14 +155,22 @@ export function routeWormhole(options) {
107
155
  }
108
156
  /**
109
157
  * User helper: encode a Native-bound route as `extra_data` bytes. `T` is the
110
- * backing asset of the destination `SingleVault<T>`.
158
+ * backing asset of the destination `SingleVault<T>`. `min_output` is the minimum
159
+ * `Coin<T>` the user will accept after the native burn fee; `execute_native`
160
+ * aborts `EOutputBelowMin` if a later fee change would deliver less (audit M15).
161
+ * Pass 0 to opt out.
111
162
  */
112
163
  export function routeNative(options) {
113
164
  const packageAddress = options.package ?? '@waterx/withdrawal-queue';
165
+ const argumentsTypes = [
166
+ 'u64'
167
+ ];
168
+ const parameterNames = ["minOutput"];
114
169
  return (tx) => tx.moveCall({
115
170
  package: packageAddress,
116
171
  module: 'withdrawal_queue',
117
172
  function: 'route_native',
173
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
118
174
  typeArguments: options.typeArguments
119
175
  });
120
176
  }
@@ -222,6 +278,158 @@ export function removeVersion(options) {
222
278
  typeArguments: options.typeArguments
223
279
  });
224
280
  }
281
+ /**
282
+ * Admin: set the **default** bridge-withdrawal fee charged on the
283
+ * `execute_wormhole` exit for every destination chain that has no explicit
284
+ * per-chain override. `fee_rate` is the 1e9-scaled `Float` value (`0` disables;
285
+ * capped at 10% = `MAX_BRIDGE_FEE_RATE_SCALED`, rejected with `EFeeRateAboveCap`
286
+ * above that — audit L4). Stored in a dynamic field on `Queue.id` so it could be
287
+ * introduced as a package upgrade without touching the published `Queue<CREDIT>`
288
+ * layout. Idempotent. Mirrors the `Float`-as-`u128` public-ABI convention used by
289
+ * `native_custody::custody_vault::set_fee_config`.
290
+ */
291
+ export function setBridgeFee(options) {
292
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
293
+ const argumentsTypes = [
294
+ null,
295
+ null,
296
+ 'u128'
297
+ ];
298
+ const parameterNames = ["queue", "_", "feeRate"];
299
+ return (tx) => tx.moveCall({
300
+ package: packageAddress,
301
+ module: 'withdrawal_queue',
302
+ function: 'set_bridge_fee',
303
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
304
+ typeArguments: options.typeArguments
305
+ });
306
+ }
307
+ /**
308
+ * Admin: set (or overwrite) a per-chain bridge-fee override for
309
+ * `evm_destination_chain`. Takes precedence over `default_rate` for wormhole exits
310
+ * to that chain. Same `Float`-as-`u128` rate convention and 10% `EFeeRateAboveCap`
311
+ * ceiling as `set_bridge_fee`. To make a chain fee-free while the default is
312
+ * non-zero, set its override to `0` (an override of `0` is distinct from "no
313
+ * override" — the latter falls back to the default). Use `unset_chain_bridge_fee`
314
+ * to drop back to default.
315
+ */
316
+ export function setChainBridgeFee(options) {
317
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
318
+ const argumentsTypes = [
319
+ null,
320
+ null,
321
+ 'u16',
322
+ 'u128'
323
+ ];
324
+ const parameterNames = ["queue", "_", "evmDestinationChain", "feeRate"];
325
+ return (tx) => tx.moveCall({
326
+ package: packageAddress,
327
+ module: 'withdrawal_queue',
328
+ function: 'set_chain_bridge_fee',
329
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
330
+ typeArguments: options.typeArguments
331
+ });
332
+ }
333
+ /**
334
+ * Admin: drop a per-chain override so `evm_destination_chain` falls back to
335
+ * `default_rate`. Always emits `ChainBridgeFeeUpdated` (audit L3) with `removed`
336
+ * reflecting whether an override was actually present and `fee_rate` set to the
337
+ * resulting **effective** rate for the chain (audit L2) — i.e. the default after a
338
+ * real removal, so indexers don't have to cross-reference
339
+ * `bridge_default_fee_rate`. Functionally a no-op when no override existed.
340
+ */
341
+ export function unsetChainBridgeFee(options) {
342
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
343
+ const argumentsTypes = [
344
+ null,
345
+ null,
346
+ 'u16'
347
+ ];
348
+ const parameterNames = ["queue", "_", "evmDestinationChain"];
349
+ return (tx) => tx.moveCall({
350
+ package: packageAddress,
351
+ module: 'withdrawal_queue',
352
+ function: 'unset_chain_bridge_fee',
353
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
354
+ typeArguments: options.typeArguments
355
+ });
356
+ }
357
+ /**
358
+ * Admin: set the **default** minimum-fee floor (absolute CREDIT units) charged on
359
+ * the `execute_wormhole` exit for every destination chain that has no explicit
360
+ * per-chain min-fee override. The charged fee is
361
+ * `max(ceil(rate * amount), min_fee)`, so a non-zero floor with a zero rate is a
362
+ * flat per-exit fee. `0` disables the floor. **No cap** (unlike the rate's 10%
363
+ * `MAX_BRIDGE_FEE_RATE_SCALED`): the floor is an absolute amount, so on small
364
+ * withdrawals it can exceed 10% of the amount by design — and if it meets/exceeds
365
+ * the entry amount, `execute_wormhole`'s net-zero guard aborts
366
+ * `EFeeConsumesEntireAmount` (recoverable via `cancel_entry`). Idempotent.
367
+ */
368
+ export function setBridgeMinFee(options) {
369
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
370
+ const argumentsTypes = [
371
+ null,
372
+ null,
373
+ 'u64'
374
+ ];
375
+ const parameterNames = ["queue", "_", "minFee"];
376
+ return (tx) => tx.moveCall({
377
+ package: packageAddress,
378
+ module: 'withdrawal_queue',
379
+ function: 'set_bridge_min_fee',
380
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
381
+ typeArguments: options.typeArguments
382
+ });
383
+ }
384
+ /**
385
+ * Admin: set (or overwrite) a per-chain minimum-fee-floor override for
386
+ * `evm_destination_chain`. Takes precedence over `default_min_fee` for wormhole
387
+ * exits to that chain — on an axis independent of the rate override. Set its
388
+ * override to `0` to exempt a chain from the floor while `default_min_fee` still
389
+ * floors others (distinct from "no override", which falls back to the default).
390
+ * Use `unset_chain_bridge_min_fee` to drop back to the default. Same no-cap
391
+ * semantics as `set_bridge_min_fee`.
392
+ */
393
+ export function setChainBridgeMinFee(options) {
394
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
395
+ const argumentsTypes = [
396
+ null,
397
+ null,
398
+ 'u16',
399
+ 'u64'
400
+ ];
401
+ const parameterNames = ["queue", "_", "evmDestinationChain", "minFee"];
402
+ return (tx) => tx.moveCall({
403
+ package: packageAddress,
404
+ module: 'withdrawal_queue',
405
+ function: 'set_chain_bridge_min_fee',
406
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
407
+ typeArguments: options.typeArguments
408
+ });
409
+ }
410
+ /**
411
+ * Admin: drop a per-chain min-fee override so `evm_destination_chain` falls back
412
+ * to `default_min_fee`. Always emits `ChainBridgeMinFeeUpdated` with `removed`
413
+ * reflecting whether an override was actually present and `min_fee` set to the
414
+ * resulting **effective** floor for the chain (the default after a real removal).
415
+ * Functionally a no-op when no override existed.
416
+ */
417
+ export function unsetChainBridgeMinFee(options) {
418
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
419
+ const argumentsTypes = [
420
+ null,
421
+ null,
422
+ 'u16'
423
+ ];
424
+ const parameterNames = ["queue", "_", "evmDestinationChain"];
425
+ return (tx) => tx.moveCall({
426
+ package: packageAddress,
427
+ module: 'withdrawal_queue',
428
+ function: 'unset_chain_bridge_min_fee',
429
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
430
+ typeArguments: options.typeArguments
431
+ });
432
+ }
225
433
  /**
226
434
  * Refund a parked entry's `Balance<CREDIT>` back to the **originating wxa
227
435
  * account** when the entry can no longer be executed — e.g. the `extra_data` body
@@ -310,8 +518,8 @@ export function executeWormhole(options) {
310
518
  });
311
519
  }
312
520
  /**
313
- * Execute a queued entry via `native_custody::custody_vault::burn<T>`. Verifies
314
- * that `extra_data` byte-equals `route_native<T>()` — if `T` was not the
521
+ * Execute a queued entry via `native_custody::custody_vault::burn<T>`. Decodes the
522
+ * native route, verifying its `asset_type` matches `T` — if `T` was not the
315
523
  * asset_type the user specified, aborts with `ERouteMismatch`.
316
524
  */
317
525
  export function executeNative(options) {
@@ -478,3 +686,208 @@ export function routeTag(options) {
478
686
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
479
687
  });
480
688
  }
689
+ /**
690
+ * The **effective** bridge-fee rate for `evm_destination_chain` as a 1e9-scaled
691
+ * `u128`: the per-chain override if one is set, else the default rate, else `0`
692
+ * when no fee config exists. Mirrors the `Float`-as-`u128` ABI convention.
693
+ */
694
+ export function bridgeFeeRate(options) {
695
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
696
+ const argumentsTypes = [
697
+ null,
698
+ 'u16'
699
+ ];
700
+ const parameterNames = ["queue", "evmDestinationChain"];
701
+ return (tx) => tx.moveCall({
702
+ package: packageAddress,
703
+ module: 'withdrawal_queue',
704
+ function: 'bridge_fee_rate',
705
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
706
+ typeArguments: options.typeArguments
707
+ });
708
+ }
709
+ /**
710
+ * The configured **default** rate (all-chains-without-override) as a 1e9-scaled
711
+ * `u128`; `0` when no fee config exists.
712
+ */
713
+ export function bridgeDefaultFeeRate(options) {
714
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
715
+ const argumentsTypes = [
716
+ null
717
+ ];
718
+ const parameterNames = ["queue"];
719
+ return (tx) => tx.moveCall({
720
+ package: packageAddress,
721
+ module: 'withdrawal_queue',
722
+ function: 'bridge_default_fee_rate',
723
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
724
+ typeArguments: options.typeArguments
725
+ });
726
+ }
727
+ /**
728
+ * Whether `evm_destination_chain` has an explicit per-chain override (distinct
729
+ * from falling back to the default).
730
+ */
731
+ export function hasChainBridgeFee(options) {
732
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
733
+ const argumentsTypes = [
734
+ null,
735
+ 'u16'
736
+ ];
737
+ const parameterNames = ["queue", "evmDestinationChain"];
738
+ return (tx) => tx.moveCall({
739
+ package: packageAddress,
740
+ module: 'withdrawal_queue',
741
+ function: 'has_chain_bridge_fee',
742
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
743
+ typeArguments: options.typeArguments
744
+ });
745
+ }
746
+ /**
747
+ * The bridge fee that would be charged on a wormhole exit of `amount` CREDIT to
748
+ * `evm_destination_chain` —
749
+ * `max(ceil(effective_rate * amount), effective_min_fee)`, or `0` when both the
750
+ * effective rate and floor are zero (and always `0` on `amount == 0`). NOTE: this
751
+ * is the _raw_ fee; it can equal or exceed `amount` (`ceil` rounding on a 1-unit
752
+ * dust entry, or a min-fee floor larger than the entry), in which case
753
+ * `execute_wormhole` would abort the net-zero guard. SDKs surfacing an "estimated
754
+ * fee" should gate on `would_execute_wormhole` (audit L1).
755
+ */
756
+ export function bridgeFeeAmount(options) {
757
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
758
+ const argumentsTypes = [
759
+ null,
760
+ 'u16',
761
+ 'u64'
762
+ ];
763
+ const parameterNames = ["queue", "evmDestinationChain", "amount"];
764
+ return (tx) => tx.moveCall({
765
+ package: packageAddress,
766
+ module: 'withdrawal_queue',
767
+ function: 'bridge_fee_amount',
768
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
769
+ typeArguments: options.typeArguments
770
+ });
771
+ }
772
+ /**
773
+ * Whether `execute_wormhole` would clear the net-zero guard for an exit of
774
+ * `amount` to `evm_destination_chain` — i.e. a strictly positive amount remains
775
+ * after the fee. `false` ⇒ `execute_wormhole` would abort
776
+ * `EFeeConsumesEntireAmount` (and `amount == 0` is also `false`). SDKs should gate
777
+ * "estimated fee" UI on this rather than `bridge_fee_amount` alone (audit L1).
778
+ */
779
+ export function wouldExecuteWormhole(options) {
780
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
781
+ const argumentsTypes = [
782
+ null,
783
+ 'u16',
784
+ 'u64'
785
+ ];
786
+ const parameterNames = ["queue", "evmDestinationChain", "amount"];
787
+ return (tx) => tx.moveCall({
788
+ package: packageAddress,
789
+ module: 'withdrawal_queue',
790
+ function: 'would_execute_wormhole',
791
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
792
+ typeArguments: options.typeArguments
793
+ });
794
+ }
795
+ /**
796
+ * Enumerate the per-chain overrides as parallel vectors of
797
+ * `(evm_destination_chain, 1e9-scaled rate)`, in insertion order. Empty when no
798
+ * overrides are set (or no fee config exists). The default rate is separate — see
799
+ * `bridge_default_fee_rate` (audit N1). Lets off-chain config tooling discover
800
+ * which chains carry overrides without probing every chain id.
801
+ */
802
+ export function bridgeChainRates(options) {
803
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
804
+ const argumentsTypes = [
805
+ null
806
+ ];
807
+ const parameterNames = ["queue"];
808
+ return (tx) => tx.moveCall({
809
+ package: packageAddress,
810
+ module: 'withdrawal_queue',
811
+ function: 'bridge_chain_rates',
812
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
813
+ typeArguments: options.typeArguments
814
+ });
815
+ }
816
+ /**
817
+ * The **effective** minimum-fee floor (absolute CREDIT units) for
818
+ * `evm_destination_chain`: the per-chain override if one is set, else the default
819
+ * floor, else `0` when no fee config exists.
820
+ */
821
+ export function bridgeMinFee(options) {
822
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
823
+ const argumentsTypes = [
824
+ null,
825
+ 'u16'
826
+ ];
827
+ const parameterNames = ["queue", "evmDestinationChain"];
828
+ return (tx) => tx.moveCall({
829
+ package: packageAddress,
830
+ module: 'withdrawal_queue',
831
+ function: 'bridge_min_fee',
832
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
833
+ typeArguments: options.typeArguments
834
+ });
835
+ }
836
+ /**
837
+ * The configured **default** minimum-fee floor (all-chains-without-override) in
838
+ * CREDIT units; `0` when no fee config exists.
839
+ */
840
+ export function bridgeDefaultMinFee(options) {
841
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
842
+ const argumentsTypes = [
843
+ null
844
+ ];
845
+ const parameterNames = ["queue"];
846
+ return (tx) => tx.moveCall({
847
+ package: packageAddress,
848
+ module: 'withdrawal_queue',
849
+ function: 'bridge_default_min_fee',
850
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
851
+ typeArguments: options.typeArguments
852
+ });
853
+ }
854
+ /**
855
+ * Whether `evm_destination_chain` has an explicit per-chain min-fee override
856
+ * (distinct from falling back to the default floor).
857
+ */
858
+ export function hasChainBridgeMinFee(options) {
859
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
860
+ const argumentsTypes = [
861
+ null,
862
+ 'u16'
863
+ ];
864
+ const parameterNames = ["queue", "evmDestinationChain"];
865
+ return (tx) => tx.moveCall({
866
+ package: packageAddress,
867
+ module: 'withdrawal_queue',
868
+ function: 'has_chain_bridge_min_fee',
869
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
870
+ typeArguments: options.typeArguments
871
+ });
872
+ }
873
+ /**
874
+ * Enumerate the per-chain min-fee overrides as parallel vectors of
875
+ * `(evm_destination_chain, min_fee)`, in insertion order. Empty when none are set
876
+ * (or no fee config exists). The default floor is separate — see
877
+ * `bridge_default_min_fee`. Lets off-chain config tooling discover which chains
878
+ * carry min-fee overrides without probing every chain id.
879
+ */
880
+ export function bridgeChainMinFees(options) {
881
+ const packageAddress = options.package ?? '@waterx/withdrawal-queue';
882
+ const argumentsTypes = [
883
+ null
884
+ ];
885
+ const parameterNames = ["queue"];
886
+ return (tx) => tx.moveCall({
887
+ package: packageAddress,
888
+ module: 'withdrawal_queue',
889
+ function: 'bridge_chain_min_fees',
890
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
891
+ typeArguments: options.typeArguments
892
+ });
893
+ }