@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.
- package/LICENSE +21 -0
- package/README.md +204 -0
- package/dist/src/client.d.ts +109 -0
- package/dist/src/client.js +197 -0
- package/dist/src/config.d.ts +229 -0
- package/dist/src/config.js +107 -0
- package/dist/src/constants.d.ts +64 -0
- package/dist/src/constants.js +71 -0
- package/dist/src/fetch.d.ts +144 -0
- package/dist/src/fetch.js +419 -0
- package/dist/src/generated/bucket_v2_framework/account.d.ts +107 -0
- package/dist/src/generated/bucket_v2_framework/account.js +129 -0
- package/dist/src/generated/bucket_v2_framework/deps/std/type_name.d.ts +17 -0
- package/dist/src/generated/bucket_v2_framework/deps/std/type_name.js +19 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/balance.d.ts +12 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/balance.js +14 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/bucket_v2_framework/double.d.ts +384 -0
- package/dist/src/generated/bucket_v2_framework/double.js +466 -0
- package/dist/src/generated/bucket_v2_framework/float.d.ts +364 -0
- package/dist/src/generated/bucket_v2_framework/float.js +440 -0
- package/dist/src/generated/bucket_v2_framework/liability.d.ts +197 -0
- package/dist/src/generated/bucket_v2_framework/liability.js +205 -0
- package/dist/src/generated/bucket_v2_framework/linked_table.d.ts +384 -0
- package/dist/src/generated/bucket_v2_framework/linked_table.js +382 -0
- package/dist/src/generated/bucket_v2_framework/sheet.d.ts +424 -0
- package/dist/src/generated/bucket_v2_framework/sheet.js +344 -0
- package/dist/src/generated/native_custody/custody_vault.d.ts +572 -0
- package/dist/src/generated/native_custody/custody_vault.js +483 -0
- package/dist/src/generated/native_custody/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/src/generated/native_custody/deps/bucket_v2_framework/float.js +10 -0
- package/dist/src/generated/native_custody/deps/bucket_v2_framework/liability.d.ts +11 -0
- package/dist/src/generated/native_custody/deps/bucket_v2_framework/liability.js +13 -0
- package/dist/src/generated/native_custody/deps/bucket_v2_framework/sheet.d.ts +49 -0
- package/dist/src/generated/native_custody/deps/bucket_v2_framework/sheet.js +18 -0
- package/dist/src/generated/native_custody/deps/std/type_name.d.ts +17 -0
- package/dist/src/generated/native_custody/deps/std/type_name.js +19 -0
- package/dist/src/generated/native_custody/deps/sui/balance.d.ts +12 -0
- package/dist/src/generated/native_custody/deps/sui/balance.js +14 -0
- package/dist/src/generated/native_custody/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/native_custody/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/native_custody/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/native_custody/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/native_custody/events.d.ts +36 -0
- package/dist/src/generated/native_custody/events.js +36 -0
- package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.d.ts +12 -0
- package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.js +14 -0
- package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +68 -0
- package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +74 -0
- package/dist/src/generated/utils/index.d.ts +30 -0
- package/dist/src/generated/utils/index.js +157 -0
- package/dist/src/generated/waterx_account/account.d.ts +1818 -0
- package/dist/src/generated/waterx_account/account.js +1723 -0
- package/dist/src/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +11 -0
- package/dist/src/generated/waterx_account/deps/bucket_v2_framework/liability.js +13 -0
- package/dist/src/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +49 -0
- package/dist/src/generated/waterx_account/deps/bucket_v2_framework/sheet.js +18 -0
- package/dist/src/generated/waterx_account/deps/std/type_name.d.ts +17 -0
- package/dist/src/generated/waterx_account/deps/std/type_name.js +19 -0
- package/dist/src/generated/waterx_account/deps/sui/balance.d.ts +12 -0
- package/dist/src/generated/waterx_account/deps/sui/balance.js +14 -0
- package/dist/src/generated/waterx_account/deps/sui/object_table.d.ts +17 -0
- package/dist/src/generated/waterx_account/deps/sui/object_table.js +19 -0
- package/dist/src/generated/waterx_account/deps/sui/table.d.ts +29 -0
- package/dist/src/generated/waterx_account/deps/sui/table.js +31 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_account/direct_rule.d.ts +77 -0
- package/dist/src/generated/waterx_account/direct_rule.js +78 -0
- package/dist/src/generated/waterx_account/events.d.ts +180 -0
- package/dist/src/generated/waterx_account/events.js +156 -0
- package/dist/src/generated/waterx_account/version.d.ts +10 -0
- package/dist/src/generated/waterx_account/version.js +8 -0
- package/dist/src/generated/waterx_credit/credit_registry.d.ts +708 -0
- package/dist/src/generated/waterx_credit/credit_registry.js +658 -0
- package/dist/src/generated/waterx_credit/deps/std/type_name.d.ts +17 -0
- package/dist/src/generated/waterx_credit/deps/std/type_name.js +19 -0
- package/dist/src/generated/waterx_credit/deps/sui/table.d.ts +29 -0
- package/dist/src/generated/waterx_credit/deps/sui/table.js +31 -0
- package/dist/src/generated/waterx_credit/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_credit/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_credit/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_credit/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_credit/limited_supply.d.ts +107 -0
- package/dist/src/generated/waterx_credit/limited_supply.js +131 -0
- package/dist/src/generated/waterx_oracle/aggregator.d.ts +211 -0
- package/dist/src/generated/waterx_oracle/aggregator.js +213 -0
- package/dist/src/generated/waterx_oracle/collector.d.ts +119 -0
- package/dist/src/generated/waterx_oracle/collector.js +105 -0
- package/dist/src/generated/waterx_oracle/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/src/generated/waterx_oracle/deps/bucket_v2_framework/float.js +10 -0
- package/dist/src/generated/waterx_oracle/deps/std/type_name.d.ts +17 -0
- package/dist/src/generated/waterx_oracle/deps/std/type_name.js +19 -0
- package/dist/src/generated/waterx_oracle/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_oracle/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_oracle/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_oracle/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_oracle/oracle.d.ts +298 -0
- package/dist/src/generated/waterx_oracle/oracle.js +323 -0
- package/dist/src/generated/waterx_oracle/version.d.ts +10 -0
- package/dist/src/generated/waterx_oracle/version.js +8 -0
- package/dist/src/generated/waterx_perp/account_data.d.ts +269 -0
- package/dist/src/generated/waterx_perp/account_data.js +284 -0
- package/dist/src/generated/waterx_perp/admin.d.ts +19 -0
- package/dist/src/generated/waterx_perp/admin.js +22 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/double.d.ts +8 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/double.js +10 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/float.js +10 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/liability.d.ts +11 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/liability.js +13 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.d.ts +8 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.js +18 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.d.ts +49 -0
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.js +18 -0
- package/dist/src/generated/waterx_perp/deps/std/type_name.d.ts +17 -0
- package/dist/src/generated/waterx_perp/deps/std/type_name.js +19 -0
- package/dist/src/generated/waterx_perp/deps/sui/balance.d.ts +15 -0
- package/dist/src/generated/waterx_perp/deps/sui/balance.js +17 -0
- package/dist/src/generated/waterx_perp/deps/sui/coin.d.ts +14 -0
- package/dist/src/generated/waterx_perp/deps/sui/coin.js +15 -0
- package/dist/src/generated/waterx_perp/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_perp/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_perp/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_perp/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_perp/events.d.ts +1283 -0
- package/dist/src/generated/waterx_perp/events.js +1018 -0
- package/dist/src/generated/waterx_perp/global_config.d.ts +775 -0
- package/dist/src/generated/waterx_perp/global_config.js +836 -0
- package/dist/src/generated/waterx_perp/keyed_big_vector.d.ts +553 -0
- package/dist/src/generated/waterx_perp/keyed_big_vector.js +554 -0
- package/dist/src/generated/waterx_perp/lp_pool.d.ts +1648 -0
- package/dist/src/generated/waterx_perp/lp_pool.js +1521 -0
- package/dist/src/generated/waterx_perp/market_config.d.ts +715 -0
- package/dist/src/generated/waterx_perp/market_config.js +780 -0
- package/dist/src/generated/waterx_perp/math.d.ts +63 -0
- package/dist/src/generated/waterx_perp/math.js +64 -0
- package/dist/src/generated/waterx_perp/memo.d.ts +251 -0
- package/dist/src/generated/waterx_perp/memo.js +323 -0
- package/dist/src/generated/waterx_perp/order_book.d.ts +290 -0
- package/dist/src/generated/waterx_perp/order_book.js +329 -0
- package/dist/src/generated/waterx_perp/position.d.ts +1005 -0
- package/dist/src/generated/waterx_perp/position.js +1103 -0
- package/dist/src/generated/waterx_perp/request.d.ts +544 -0
- package/dist/src/generated/waterx_perp/request.js +541 -0
- package/dist/src/generated/waterx_perp/response.d.ts +247 -0
- package/dist/src/generated/waterx_perp/response.js +280 -0
- package/dist/src/generated/waterx_perp/trading.d.ts +2821 -0
- package/dist/src/generated/waterx_perp/trading.js +2372 -0
- package/dist/src/generated/waterx_perp/version.d.ts +10 -0
- package/dist/src/generated/waterx_perp/version.js +8 -0
- package/dist/src/generated/waterx_perp/witness.d.ts +18 -0
- package/dist/src/generated/waterx_perp/witness.js +21 -0
- package/dist/src/generated/waterx_perp_view/deps/std/type_name.d.ts +17 -0
- package/dist/src/generated/waterx_perp_view/deps/std/type_name.js +19 -0
- package/dist/src/generated/waterx_perp_view/view.d.ts +447 -0
- package/dist/src/generated/waterx_perp_view/view.js +414 -0
- package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +90 -0
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +72 -0
- package/dist/src/generated/waterx_referral/deps/sui/table.d.ts +29 -0
- package/dist/src/generated/waterx_referral/deps/sui/table.js +31 -0
- package/dist/src/generated/waterx_referral/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_referral/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_referral/referral_table.d.ts +171 -0
- package/dist/src/generated/waterx_referral/referral_table.js +192 -0
- package/dist/src/generated/waterx_staking/deps/bucket_v2_framework/double.d.ts +8 -0
- package/dist/src/generated/waterx_staking/deps/bucket_v2_framework/double.js +10 -0
- package/dist/src/generated/waterx_staking/deps/sui/balance.d.ts +12 -0
- package/dist/src/generated/waterx_staking/deps/sui/balance.js +14 -0
- package/dist/src/generated/waterx_staking/deps/sui/table.d.ts +29 -0
- package/dist/src/generated/waterx_staking/deps/sui/table.js +31 -0
- package/dist/src/generated/waterx_staking/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_staking/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_staking/waterx_staking.d.ts +746 -0
- package/dist/src/generated/waterx_staking/waterx_staking.js +731 -0
- package/dist/src/generated/waterx_staking/witness.d.ts +16 -0
- package/dist/src/generated/waterx_staking/witness.js +18 -0
- package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.d.ts +8 -0
- package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.js +18 -0
- package/dist/src/generated/withdrawal_queue/deps/std/type_name.d.ts +17 -0
- package/dist/src/generated/withdrawal_queue/deps/std/type_name.js +19 -0
- package/dist/src/generated/withdrawal_queue/deps/sui/balance.d.ts +12 -0
- package/dist/src/generated/withdrawal_queue/deps/sui/balance.js +14 -0
- package/dist/src/generated/withdrawal_queue/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/withdrawal_queue/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +483 -0
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +480 -0
- package/dist/src/generated/wlp/wlp.d.ts +28 -0
- package/dist/src/generated/wlp/wlp.js +32 -0
- package/dist/src/generated/wormhole_bridge/deps/sui/table.d.ts +29 -0
- package/dist/src/generated/wormhole_bridge/deps/sui/table.js +31 -0
- package/dist/src/generated/wormhole_bridge/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/wormhole_bridge/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/wormhole_bridge/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/wormhole_bridge/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.d.ts +12 -0
- package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.js +9 -0
- package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.d.ts +14 -0
- package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.js +16 -0
- package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/set.d.ts +16 -0
- package/dist/src/generated/wormhole_bridge/deps/wormhole_sdk/set.js +15 -0
- package/dist/src/generated/wormhole_bridge/events.d.ts +32 -0
- package/dist/src/generated/wormhole_bridge/events.js +28 -0
- package/dist/src/generated/wormhole_bridge/wormhole_bridge.d.ts +498 -0
- package/dist/src/generated/wormhole_bridge/wormhole_bridge.js +494 -0
- package/dist/src/index.d.ts +28 -0
- package/dist/src/index.js +34 -0
- package/dist/src/tx-builders.d.ts +242 -0
- package/dist/src/tx-builders.js +320 -0
- package/dist/src/user/account.d.ts +129 -0
- package/dist/src/user/account.js +166 -0
- package/dist/src/user/credit.d.ts +135 -0
- package/dist/src/user/credit.js +255 -0
- package/dist/src/user/custody.d.ts +71 -0
- package/dist/src/user/custody.js +112 -0
- package/dist/src/user/index.d.ts +8 -0
- package/dist/src/user/index.js +8 -0
- package/dist/src/user/order.d.ts +89 -0
- package/dist/src/user/order.js +134 -0
- package/dist/src/user/referral.d.ts +21 -0
- package/dist/src/user/referral.js +41 -0
- package/dist/src/user/staking.d.ts +54 -0
- package/dist/src/user/staking.js +109 -0
- package/dist/src/user/trading.d.ts +119 -0
- package/dist/src/user/trading.js +262 -0
- package/dist/src/user/wlp.d.ts +58 -0
- package/dist/src/user/wlp.js +99 -0
- package/dist/src/utils/account-request.d.ts +9 -0
- package/dist/src/utils/account-request.js +17 -0
- package/dist/src/utils/config.d.ts +11 -0
- package/dist/src/utils/config.js +15 -0
- package/dist/src/utils/math.d.ts +201 -0
- package/dist/src/utils/math.js +343 -0
- package/dist/src/utils/pyth.d.ts +89 -0
- package/dist/src/utils/pyth.js +316 -0
- package/dist/src/utils/wormhole.d.ts +86 -0
- package/dist/src/utils/wormhole.js +154 -0
- package/package.json +66 -0
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Hot potato request for trading actions in WaterX Perp. No drop trait — must be
|
|
6
|
+
* consumed by trading::execute().
|
|
7
|
+
*/
|
|
8
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
9
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
10
|
+
import * as float from "./deps/bucket_v2_framework/float.js";
|
|
11
|
+
import * as balance from "./deps/sui/balance.js";
|
|
12
|
+
import * as float_1 from "./deps/bucket_v2_framework/float.js";
|
|
13
|
+
import * as vec_set from "./deps/sui/vec_set.js";
|
|
14
|
+
import * as type_name from "./deps/std/type_name.js";
|
|
15
|
+
const $moduleName = '@waterx/perp::request';
|
|
16
|
+
export const PlaceOrderArgument = new MoveStruct({ name: `${$moduleName}::PlaceOrderArgument`, fields: {
|
|
17
|
+
is_long: bcs.bool(),
|
|
18
|
+
is_stop_order: bcs.bool(),
|
|
19
|
+
reduce_only: bcs.bool(),
|
|
20
|
+
/** Scaled Float (1e9) — converted internally. */
|
|
21
|
+
size: bcs.u128(),
|
|
22
|
+
/** `None` = market order (parked at tick 0). Pre-orders must be `Some`. */
|
|
23
|
+
trigger_price: bcs.option(bcs.u128()),
|
|
24
|
+
/** `None` = standalone. Pre-orders must be `None` (auto-linked at activation). */
|
|
25
|
+
linked_position_id: bcs.option(bcs.u64()),
|
|
26
|
+
/** Honored only on market orders. */
|
|
27
|
+
acceptable_price: bcs.option(bcs.u64()),
|
|
28
|
+
/** Collateral debited from the wxa account. Pre-orders must be `0`. */
|
|
29
|
+
collateral_amount: bcs.u64()
|
|
30
|
+
} });
|
|
31
|
+
export const TradingRequest = new MoveStruct({ name: `${$moduleName}::TradingRequest<phantom C_TOKEN>`, fields: {
|
|
32
|
+
market_id: bcs.Address,
|
|
33
|
+
account_object_address: bcs.Address,
|
|
34
|
+
action: bcs.u8(),
|
|
35
|
+
sender: bcs.Address,
|
|
36
|
+
is_long: bcs.bool(),
|
|
37
|
+
size: float.Float,
|
|
38
|
+
collateral: balance.Balance,
|
|
39
|
+
order_id: bcs.option(bcs.u64()),
|
|
40
|
+
position_id: bcs.option(bcs.u64()),
|
|
41
|
+
trigger_price: bcs.option(float_1.Float),
|
|
42
|
+
reduce_only: bcs.bool(),
|
|
43
|
+
is_stop_order: bcs.bool(),
|
|
44
|
+
linked_position_id: bcs.option(bcs.u64()),
|
|
45
|
+
trigger_price_key: bcs.option(bcs.u128()),
|
|
46
|
+
withdraw_amount: bcs.u64(),
|
|
47
|
+
/**
|
|
48
|
+
* Slippage protection: acceptable execution price (0 = no limit). For long open /
|
|
49
|
+
* short close: assert price <= acceptable_price. For short open / long close:
|
|
50
|
+
* assert price >= acceptable_price.
|
|
51
|
+
*/
|
|
52
|
+
acceptable_price: bcs.u64(),
|
|
53
|
+
/**
|
|
54
|
+
* TP / SL pre-orders carried alongside a place-order action. Empty for
|
|
55
|
+
* non-`ACTION_PLACE_ORDER` actions and for plain main orders.
|
|
56
|
+
*/
|
|
57
|
+
pre_orders: bcs.vector(PlaceOrderArgument),
|
|
58
|
+
witnesses: vec_set.VecSet(type_name.TypeName)
|
|
59
|
+
} });
|
|
60
|
+
export function newPlaceOrderArgument(options) {
|
|
61
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
62
|
+
const argumentsTypes = [
|
|
63
|
+
'bool',
|
|
64
|
+
'bool',
|
|
65
|
+
'bool',
|
|
66
|
+
'u128',
|
|
67
|
+
'0x1::option::Option<u128>',
|
|
68
|
+
'0x1::option::Option<u64>',
|
|
69
|
+
'0x1::option::Option<u64>',
|
|
70
|
+
'u64'
|
|
71
|
+
];
|
|
72
|
+
const parameterNames = ["isLong", "isStopOrder", "reduceOnly", "size", "triggerPrice", "linkedPositionId", "acceptablePrice", "collateralAmount"];
|
|
73
|
+
return (tx) => tx.moveCall({
|
|
74
|
+
package: packageAddress,
|
|
75
|
+
module: 'request',
|
|
76
|
+
function: 'new_place_order_argument',
|
|
77
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export function argIsLong(options) {
|
|
81
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
82
|
+
const argumentsTypes = [
|
|
83
|
+
null
|
|
84
|
+
];
|
|
85
|
+
const parameterNames = ["self"];
|
|
86
|
+
return (tx) => tx.moveCall({
|
|
87
|
+
package: packageAddress,
|
|
88
|
+
module: 'request',
|
|
89
|
+
function: 'arg_is_long',
|
|
90
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export function argIsStopOrder(options) {
|
|
94
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
95
|
+
const argumentsTypes = [
|
|
96
|
+
null
|
|
97
|
+
];
|
|
98
|
+
const parameterNames = ["self"];
|
|
99
|
+
return (tx) => tx.moveCall({
|
|
100
|
+
package: packageAddress,
|
|
101
|
+
module: 'request',
|
|
102
|
+
function: 'arg_is_stop_order',
|
|
103
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export function argReduceOnly(options) {
|
|
107
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
108
|
+
const argumentsTypes = [
|
|
109
|
+
null
|
|
110
|
+
];
|
|
111
|
+
const parameterNames = ["self"];
|
|
112
|
+
return (tx) => tx.moveCall({
|
|
113
|
+
package: packageAddress,
|
|
114
|
+
module: 'request',
|
|
115
|
+
function: 'arg_reduce_only',
|
|
116
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
export function argSize(options) {
|
|
120
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
121
|
+
const argumentsTypes = [
|
|
122
|
+
null
|
|
123
|
+
];
|
|
124
|
+
const parameterNames = ["self"];
|
|
125
|
+
return (tx) => tx.moveCall({
|
|
126
|
+
package: packageAddress,
|
|
127
|
+
module: 'request',
|
|
128
|
+
function: 'arg_size',
|
|
129
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export function argTriggerPrice(options) {
|
|
133
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
134
|
+
const argumentsTypes = [
|
|
135
|
+
null
|
|
136
|
+
];
|
|
137
|
+
const parameterNames = ["self"];
|
|
138
|
+
return (tx) => tx.moveCall({
|
|
139
|
+
package: packageAddress,
|
|
140
|
+
module: 'request',
|
|
141
|
+
function: 'arg_trigger_price',
|
|
142
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
export function argLinkedPositionId(options) {
|
|
146
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
147
|
+
const argumentsTypes = [
|
|
148
|
+
null
|
|
149
|
+
];
|
|
150
|
+
const parameterNames = ["self"];
|
|
151
|
+
return (tx) => tx.moveCall({
|
|
152
|
+
package: packageAddress,
|
|
153
|
+
module: 'request',
|
|
154
|
+
function: 'arg_linked_position_id',
|
|
155
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
export function argAcceptablePrice(options) {
|
|
159
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
160
|
+
const argumentsTypes = [
|
|
161
|
+
null
|
|
162
|
+
];
|
|
163
|
+
const parameterNames = ["self"];
|
|
164
|
+
return (tx) => tx.moveCall({
|
|
165
|
+
package: packageAddress,
|
|
166
|
+
module: 'request',
|
|
167
|
+
function: 'arg_acceptable_price',
|
|
168
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
export function argCollateralAmount(options) {
|
|
172
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
173
|
+
const argumentsTypes = [
|
|
174
|
+
null
|
|
175
|
+
];
|
|
176
|
+
const parameterNames = ["self"];
|
|
177
|
+
return (tx) => tx.moveCall({
|
|
178
|
+
package: packageAddress,
|
|
179
|
+
module: 'request',
|
|
180
|
+
function: 'arg_collateral_amount',
|
|
181
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/** Adds a witness type to the request. */
|
|
185
|
+
export function addWitness(options) {
|
|
186
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
187
|
+
const argumentsTypes = [
|
|
188
|
+
null,
|
|
189
|
+
`${options.typeArguments[1]}`
|
|
190
|
+
];
|
|
191
|
+
const parameterNames = ["self", "Witness"];
|
|
192
|
+
return (tx) => tx.moveCall({
|
|
193
|
+
package: packageAddress,
|
|
194
|
+
module: 'request',
|
|
195
|
+
function: 'add_witness',
|
|
196
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
197
|
+
typeArguments: options.typeArguments
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
export function marketId(options) {
|
|
201
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
202
|
+
const argumentsTypes = [
|
|
203
|
+
null
|
|
204
|
+
];
|
|
205
|
+
const parameterNames = ["self"];
|
|
206
|
+
return (tx) => tx.moveCall({
|
|
207
|
+
package: packageAddress,
|
|
208
|
+
module: 'request',
|
|
209
|
+
function: 'market_id',
|
|
210
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
211
|
+
typeArguments: options.typeArguments
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
export function accountId(options) {
|
|
215
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
216
|
+
const argumentsTypes = [
|
|
217
|
+
null
|
|
218
|
+
];
|
|
219
|
+
const parameterNames = ["self"];
|
|
220
|
+
return (tx) => tx.moveCall({
|
|
221
|
+
package: packageAddress,
|
|
222
|
+
module: 'request',
|
|
223
|
+
function: 'account_id',
|
|
224
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
225
|
+
typeArguments: options.typeArguments
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
export function accountObjectAddress(options) {
|
|
229
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
230
|
+
const argumentsTypes = [
|
|
231
|
+
null
|
|
232
|
+
];
|
|
233
|
+
const parameterNames = ["self"];
|
|
234
|
+
return (tx) => tx.moveCall({
|
|
235
|
+
package: packageAddress,
|
|
236
|
+
module: 'request',
|
|
237
|
+
function: 'account_object_address',
|
|
238
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
239
|
+
typeArguments: options.typeArguments
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
export function action(options) {
|
|
243
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
244
|
+
const argumentsTypes = [
|
|
245
|
+
null
|
|
246
|
+
];
|
|
247
|
+
const parameterNames = ["self"];
|
|
248
|
+
return (tx) => tx.moveCall({
|
|
249
|
+
package: packageAddress,
|
|
250
|
+
module: 'request',
|
|
251
|
+
function: 'action',
|
|
252
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
253
|
+
typeArguments: options.typeArguments
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
export function sender(options) {
|
|
257
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
258
|
+
const argumentsTypes = [
|
|
259
|
+
null
|
|
260
|
+
];
|
|
261
|
+
const parameterNames = ["self"];
|
|
262
|
+
return (tx) => tx.moveCall({
|
|
263
|
+
package: packageAddress,
|
|
264
|
+
module: 'request',
|
|
265
|
+
function: 'sender',
|
|
266
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
267
|
+
typeArguments: options.typeArguments
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
export function isLong(options) {
|
|
271
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
272
|
+
const argumentsTypes = [
|
|
273
|
+
null
|
|
274
|
+
];
|
|
275
|
+
const parameterNames = ["self"];
|
|
276
|
+
return (tx) => tx.moveCall({
|
|
277
|
+
package: packageAddress,
|
|
278
|
+
module: 'request',
|
|
279
|
+
function: 'is_long',
|
|
280
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
281
|
+
typeArguments: options.typeArguments
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
export function size(options) {
|
|
285
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
286
|
+
const argumentsTypes = [
|
|
287
|
+
null
|
|
288
|
+
];
|
|
289
|
+
const parameterNames = ["self"];
|
|
290
|
+
return (tx) => tx.moveCall({
|
|
291
|
+
package: packageAddress,
|
|
292
|
+
module: 'request',
|
|
293
|
+
function: 'size',
|
|
294
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
295
|
+
typeArguments: options.typeArguments
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
export function depositAmount(options) {
|
|
299
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
300
|
+
const argumentsTypes = [
|
|
301
|
+
null
|
|
302
|
+
];
|
|
303
|
+
const parameterNames = ["self"];
|
|
304
|
+
return (tx) => tx.moveCall({
|
|
305
|
+
package: packageAddress,
|
|
306
|
+
module: 'request',
|
|
307
|
+
function: 'deposit_amount',
|
|
308
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
309
|
+
typeArguments: options.typeArguments
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
export function orderId(options) {
|
|
313
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
314
|
+
const argumentsTypes = [
|
|
315
|
+
null
|
|
316
|
+
];
|
|
317
|
+
const parameterNames = ["self"];
|
|
318
|
+
return (tx) => tx.moveCall({
|
|
319
|
+
package: packageAddress,
|
|
320
|
+
module: 'request',
|
|
321
|
+
function: 'order_id',
|
|
322
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
323
|
+
typeArguments: options.typeArguments
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
export function positionId(options) {
|
|
327
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
328
|
+
const argumentsTypes = [
|
|
329
|
+
null
|
|
330
|
+
];
|
|
331
|
+
const parameterNames = ["self"];
|
|
332
|
+
return (tx) => tx.moveCall({
|
|
333
|
+
package: packageAddress,
|
|
334
|
+
module: 'request',
|
|
335
|
+
function: 'position_id',
|
|
336
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
337
|
+
typeArguments: options.typeArguments
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
export function triggerPrice(options) {
|
|
341
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
342
|
+
const argumentsTypes = [
|
|
343
|
+
null
|
|
344
|
+
];
|
|
345
|
+
const parameterNames = ["self"];
|
|
346
|
+
return (tx) => tx.moveCall({
|
|
347
|
+
package: packageAddress,
|
|
348
|
+
module: 'request',
|
|
349
|
+
function: 'trigger_price',
|
|
350
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
351
|
+
typeArguments: options.typeArguments
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
export function reduceOnly(options) {
|
|
355
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
356
|
+
const argumentsTypes = [
|
|
357
|
+
null
|
|
358
|
+
];
|
|
359
|
+
const parameterNames = ["self"];
|
|
360
|
+
return (tx) => tx.moveCall({
|
|
361
|
+
package: packageAddress,
|
|
362
|
+
module: 'request',
|
|
363
|
+
function: 'reduce_only',
|
|
364
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
365
|
+
typeArguments: options.typeArguments
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
export function isStopOrder(options) {
|
|
369
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
370
|
+
const argumentsTypes = [
|
|
371
|
+
null
|
|
372
|
+
];
|
|
373
|
+
const parameterNames = ["self"];
|
|
374
|
+
return (tx) => tx.moveCall({
|
|
375
|
+
package: packageAddress,
|
|
376
|
+
module: 'request',
|
|
377
|
+
function: 'is_stop_order',
|
|
378
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
379
|
+
typeArguments: options.typeArguments
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
export function linkedPositionId(options) {
|
|
383
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
384
|
+
const argumentsTypes = [
|
|
385
|
+
null
|
|
386
|
+
];
|
|
387
|
+
const parameterNames = ["self"];
|
|
388
|
+
return (tx) => tx.moveCall({
|
|
389
|
+
package: packageAddress,
|
|
390
|
+
module: 'request',
|
|
391
|
+
function: 'linked_position_id',
|
|
392
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
393
|
+
typeArguments: options.typeArguments
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
export function triggerPriceKey(options) {
|
|
397
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
398
|
+
const argumentsTypes = [
|
|
399
|
+
null
|
|
400
|
+
];
|
|
401
|
+
const parameterNames = ["self"];
|
|
402
|
+
return (tx) => tx.moveCall({
|
|
403
|
+
package: packageAddress,
|
|
404
|
+
module: 'request',
|
|
405
|
+
function: 'trigger_price_key',
|
|
406
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
407
|
+
typeArguments: options.typeArguments
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
export function withdrawAmount(options) {
|
|
411
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
412
|
+
const argumentsTypes = [
|
|
413
|
+
null
|
|
414
|
+
];
|
|
415
|
+
const parameterNames = ["self"];
|
|
416
|
+
return (tx) => tx.moveCall({
|
|
417
|
+
package: packageAddress,
|
|
418
|
+
module: 'request',
|
|
419
|
+
function: 'withdraw_amount',
|
|
420
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
421
|
+
typeArguments: options.typeArguments
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
export function acceptablePrice(options) {
|
|
425
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
426
|
+
const argumentsTypes = [
|
|
427
|
+
null
|
|
428
|
+
];
|
|
429
|
+
const parameterNames = ["self"];
|
|
430
|
+
return (tx) => tx.moveCall({
|
|
431
|
+
package: packageAddress,
|
|
432
|
+
module: 'request',
|
|
433
|
+
function: 'acceptable_price',
|
|
434
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
435
|
+
typeArguments: options.typeArguments
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
export function preOrders(options) {
|
|
439
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
440
|
+
const argumentsTypes = [
|
|
441
|
+
null
|
|
442
|
+
];
|
|
443
|
+
const parameterNames = ["self"];
|
|
444
|
+
return (tx) => tx.moveCall({
|
|
445
|
+
package: packageAddress,
|
|
446
|
+
module: 'request',
|
|
447
|
+
function: 'pre_orders',
|
|
448
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
449
|
+
typeArguments: options.typeArguments
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
export function witnesses(options) {
|
|
453
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
454
|
+
const argumentsTypes = [
|
|
455
|
+
null
|
|
456
|
+
];
|
|
457
|
+
const parameterNames = ["self"];
|
|
458
|
+
return (tx) => tx.moveCall({
|
|
459
|
+
package: packageAddress,
|
|
460
|
+
module: 'request',
|
|
461
|
+
function: 'witnesses',
|
|
462
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
463
|
+
typeArguments: options.typeArguments
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
export function actionPlaceOrder(options = {}) {
|
|
467
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
468
|
+
return (tx) => tx.moveCall({
|
|
469
|
+
package: packageAddress,
|
|
470
|
+
module: 'request',
|
|
471
|
+
function: 'action_place_order',
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
/** Creates a new TradingRequest. Package visibility only. */
|
|
475
|
+
export function _new(options) {
|
|
476
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
477
|
+
const argumentsTypes = [
|
|
478
|
+
'0x2::object::ID',
|
|
479
|
+
'address',
|
|
480
|
+
'u8',
|
|
481
|
+
'address',
|
|
482
|
+
'bool',
|
|
483
|
+
null,
|
|
484
|
+
null,
|
|
485
|
+
'0x1::option::Option<u64>',
|
|
486
|
+
'0x1::option::Option<u64>',
|
|
487
|
+
'0x1::option::Option<null>',
|
|
488
|
+
'bool',
|
|
489
|
+
'bool',
|
|
490
|
+
'0x1::option::Option<u64>',
|
|
491
|
+
'0x1::option::Option<u128>',
|
|
492
|
+
'u64',
|
|
493
|
+
'u64',
|
|
494
|
+
'vector<null>'
|
|
495
|
+
];
|
|
496
|
+
const parameterNames = ["marketId", "accountObjectAddress", "action", "sender", "isLong", "size", "collateral", "orderId", "positionId", "triggerPrice", "reduceOnly", "isStopOrder", "linkedPositionId", "triggerPriceKey", "withdrawAmount", "acceptablePrice", "preOrders"];
|
|
497
|
+
return (tx) => tx.moveCall({
|
|
498
|
+
package: packageAddress,
|
|
499
|
+
module: 'request',
|
|
500
|
+
function: 'new',
|
|
501
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
502
|
+
typeArguments: options.typeArguments
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
/** Destroys a TradingRequest, returning its fields. Package visibility only. */
|
|
506
|
+
export function destroy(options) {
|
|
507
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
508
|
+
const argumentsTypes = [
|
|
509
|
+
null
|
|
510
|
+
];
|
|
511
|
+
const parameterNames = ["self"];
|
|
512
|
+
return (tx) => tx.moveCall({
|
|
513
|
+
package: packageAddress,
|
|
514
|
+
module: 'request',
|
|
515
|
+
function: 'destroy',
|
|
516
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
517
|
+
typeArguments: options.typeArguments
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
/** Creates an empty-collateral request (for actions that don't need collateral). */
|
|
521
|
+
export function newNoCollateral(options) {
|
|
522
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
523
|
+
const argumentsTypes = [
|
|
524
|
+
'0x2::object::ID',
|
|
525
|
+
'address',
|
|
526
|
+
'u8',
|
|
527
|
+
'address',
|
|
528
|
+
'0x1::option::Option<u64>',
|
|
529
|
+
'0x1::option::Option<u64>',
|
|
530
|
+
'u64',
|
|
531
|
+
'u64'
|
|
532
|
+
];
|
|
533
|
+
const parameterNames = ["marketId", "accountObjectAddress", "action", "sender", "orderId", "positionId", "withdrawAmount", "acceptablePrice"];
|
|
534
|
+
return (tx) => tx.moveCall({
|
|
535
|
+
package: packageAddress,
|
|
536
|
+
module: 'request',
|
|
537
|
+
function: 'new_no_collateral',
|
|
538
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
539
|
+
typeArguments: options.typeArguments
|
|
540
|
+
});
|
|
541
|
+
}
|