@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,1103 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Position and Order structs and lifecycle management. All functions are
|
|
6
|
+
* package-internal, used by trading.move. Collateral balances are stored in
|
|
7
|
+
* GlobalVault (global_config.move), not in Position/Order.
|
|
8
|
+
*/
|
|
9
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
10
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
11
|
+
import * as float from "./deps/bucket_v2_framework/float.js";
|
|
12
|
+
import * as type_name from "./deps/std/type_name.js";
|
|
13
|
+
import * as float_1 from "./deps/bucket_v2_framework/float.js";
|
|
14
|
+
import * as float_2 from "./deps/bucket_v2_framework/float.js";
|
|
15
|
+
import * as double from "./deps/bucket_v2_framework/double.js";
|
|
16
|
+
import * as type_name_1 from "./deps/std/type_name.js";
|
|
17
|
+
import * as float_3 from "./deps/bucket_v2_framework/float.js";
|
|
18
|
+
import * as float_4 from "./deps/bucket_v2_framework/float.js";
|
|
19
|
+
import * as float_5 from "./deps/bucket_v2_framework/float.js";
|
|
20
|
+
const $moduleName = '@waterx/perp::position';
|
|
21
|
+
export const Position = new MoveStruct({ name: `${$moduleName}::Position`, fields: {
|
|
22
|
+
id: bcs.Address,
|
|
23
|
+
/** Position ID (unique within market). */
|
|
24
|
+
position_id: bcs.u64(),
|
|
25
|
+
/** Owner address. */
|
|
26
|
+
account_object_address: bcs.Address,
|
|
27
|
+
/** Market ID. */
|
|
28
|
+
market_id: bcs.Address,
|
|
29
|
+
/** Whether this is a long position. */
|
|
30
|
+
is_long: bcs.bool(),
|
|
31
|
+
/** Position size as Float (fixed 9 decimals). */
|
|
32
|
+
size: float.Float,
|
|
33
|
+
/** Collateral token type. */
|
|
34
|
+
collateral_token: type_name.TypeName,
|
|
35
|
+
/** Collateral token decimal. */
|
|
36
|
+
collateral_decimal: bcs.u8(),
|
|
37
|
+
/** Collateral amount (tracked; actual balance in GlobalVault). */
|
|
38
|
+
collateral_amount: bcs.u64(),
|
|
39
|
+
/** Average entry price (Float). */
|
|
40
|
+
average_price: float_1.Float,
|
|
41
|
+
/** Entry cumulative borrow rate index as Float. */
|
|
42
|
+
entry_borrow_index: float_2.Float,
|
|
43
|
+
/** Pool reserve snapshot in collateral token units. */
|
|
44
|
+
pool_reserve_amount: bcs.u64(),
|
|
45
|
+
/** Borrow reserve snapshot in collateral token units. */
|
|
46
|
+
borrow_reserve_amount: bcs.u64(),
|
|
47
|
+
/** Entry cumulative funding rate sign (true = longs pay). */
|
|
48
|
+
entry_funding_sign: bcs.bool(),
|
|
49
|
+
/** Entry cumulative funding rate index (Double). */
|
|
50
|
+
entry_funding_index: double.Double,
|
|
51
|
+
/** Unrealized borrow fee in collateral token. */
|
|
52
|
+
unrealized_borrow_fee: bcs.u64(),
|
|
53
|
+
/** Unrealized funding fee sign (true = should pay). */
|
|
54
|
+
unrealized_funding_sign: bcs.bool(),
|
|
55
|
+
/** Unrealized funding fee in collateral token. */
|
|
56
|
+
unrealized_funding_fee: bcs.u64(),
|
|
57
|
+
/** Unrealized trading fee in collateral token. */
|
|
58
|
+
unrealized_trading_fee: bcs.u64(),
|
|
59
|
+
/** Linked order IDs. */
|
|
60
|
+
linked_order_ids: bcs.vector(bcs.u64()),
|
|
61
|
+
/** Linked order trigger price bucket keys paired with linked_order_ids. */
|
|
62
|
+
linked_order_price_keys: bcs.vector(bcs.u128()),
|
|
63
|
+
/** Creation timestamp. */
|
|
64
|
+
create_timestamp: bcs.u64(),
|
|
65
|
+
/** Last update timestamp. */
|
|
66
|
+
update_timestamp: bcs.u64()
|
|
67
|
+
} });
|
|
68
|
+
export const Order = new MoveStruct({ name: `${$moduleName}::Order`, fields: {
|
|
69
|
+
id: bcs.Address,
|
|
70
|
+
/** Order ID (unique within market). */
|
|
71
|
+
order_id: bcs.u64(),
|
|
72
|
+
/**
|
|
73
|
+
* Owner account object address (UserAccount ID, same as
|
|
74
|
+
* Position.account_object_address).
|
|
75
|
+
*/
|
|
76
|
+
account_object_address: bcs.Address,
|
|
77
|
+
/** Market ID. */
|
|
78
|
+
market_id: bcs.Address,
|
|
79
|
+
/** Linked position ID (for reduce-only). */
|
|
80
|
+
linked_position_id: bcs.option(bcs.u64()),
|
|
81
|
+
/** Collateral token type. */
|
|
82
|
+
collateral_token: type_name_1.TypeName,
|
|
83
|
+
/** Collateral token decimal. */
|
|
84
|
+
collateral_decimal: bcs.u8(),
|
|
85
|
+
/** Collateral amount (tracked; actual balance in GlobalVault). */
|
|
86
|
+
collateral_amount: bcs.u64(),
|
|
87
|
+
/** Whether this is a long order. */
|
|
88
|
+
is_long: bcs.bool(),
|
|
89
|
+
/** Whether this is a reduce-only order. */
|
|
90
|
+
reduce_only: bcs.bool(),
|
|
91
|
+
/** Whether this is a stop order (vs limit). */
|
|
92
|
+
is_stop_order: bcs.bool(),
|
|
93
|
+
/** Order size as Float (fixed 9 decimals). */
|
|
94
|
+
size: float_3.Float,
|
|
95
|
+
/**
|
|
96
|
+
* Trigger price (Float). A value of zero marks the order as a market order: it
|
|
97
|
+
* sits at price tick 0 in the limit book and matches at any oracle price (see
|
|
98
|
+
* `check_order_fillable`).
|
|
99
|
+
*/
|
|
100
|
+
trigger_price: float_4.Float,
|
|
101
|
+
/**
|
|
102
|
+
* Slippage limit (scaled `Float`) checked at match time. Zero disables the check.
|
|
103
|
+
* Only carries meaning on market orders — limit/stop orders always pass it through
|
|
104
|
+
* as zero.
|
|
105
|
+
*/
|
|
106
|
+
acceptable_price: bcs.u64(),
|
|
107
|
+
/** Leverage in bps. */
|
|
108
|
+
leverage_bps: bcs.u64(),
|
|
109
|
+
/** Oracle price when order was placed. */
|
|
110
|
+
oracle_price_at_creation: float_5.Float,
|
|
111
|
+
/** Creation timestamp. */
|
|
112
|
+
create_timestamp: bcs.u64()
|
|
113
|
+
} });
|
|
114
|
+
/**
|
|
115
|
+
* Creates a new trading order. Collateral is deposited into the vault.
|
|
116
|
+
* `acceptable_price = 0` means no slippage check; non-zero values are only carried
|
|
117
|
+
* by market orders (trigger_price == 0) and consulted by `match_orders` at fill
|
|
118
|
+
* time.
|
|
119
|
+
*/
|
|
120
|
+
export function createOrder(options) {
|
|
121
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
122
|
+
const argumentsTypes = [
|
|
123
|
+
'u64',
|
|
124
|
+
'address',
|
|
125
|
+
'0x2::object::ID',
|
|
126
|
+
'0x1::option::Option<u64>',
|
|
127
|
+
null,
|
|
128
|
+
null,
|
|
129
|
+
'u8',
|
|
130
|
+
'bool',
|
|
131
|
+
'bool',
|
|
132
|
+
'bool',
|
|
133
|
+
null,
|
|
134
|
+
null,
|
|
135
|
+
'u64',
|
|
136
|
+
'u64',
|
|
137
|
+
null,
|
|
138
|
+
'0x2::clock::Clock'
|
|
139
|
+
];
|
|
140
|
+
const parameterNames = ["orderId", "accountObjectAddress", "marketId", "linkedPositionId", "collateral", "vault", "collateralDecimal", "isLong", "reduceOnly", "isStopOrder", "size", "triggerPrice", "acceptablePrice", "leverageBps", "oraclePrice"];
|
|
141
|
+
return (tx) => tx.moveCall({
|
|
142
|
+
package: packageAddress,
|
|
143
|
+
module: 'position',
|
|
144
|
+
function: 'create_order',
|
|
145
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
146
|
+
typeArguments: options.typeArguments
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/** Removes an order and returns its collateral from the vault. */
|
|
150
|
+
export function removeOrder(options) {
|
|
151
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
152
|
+
const argumentsTypes = [
|
|
153
|
+
null,
|
|
154
|
+
null
|
|
155
|
+
];
|
|
156
|
+
const parameterNames = ["order", "vault"];
|
|
157
|
+
return (tx) => tx.moveCall({
|
|
158
|
+
package: packageAddress,
|
|
159
|
+
module: 'position',
|
|
160
|
+
function: 'remove_order',
|
|
161
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
162
|
+
typeArguments: options.typeArguments
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
export function updateOrder(options) {
|
|
166
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
167
|
+
const argumentsTypes = [
|
|
168
|
+
null,
|
|
169
|
+
null,
|
|
170
|
+
null,
|
|
171
|
+
'u64'
|
|
172
|
+
];
|
|
173
|
+
const parameterNames = ["order", "size", "triggerPrice", "leverageBps"];
|
|
174
|
+
return (tx) => tx.moveCall({
|
|
175
|
+
package: packageAddress,
|
|
176
|
+
module: 'position',
|
|
177
|
+
function: 'update_order',
|
|
178
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Stamp the resolved linked position ID on an order whose `linked_position_id` is
|
|
183
|
+
* currently `None`. Used by the pre-order activation path: when a main with
|
|
184
|
+
* reserved pre-orders fills, the perp fills in the freshly-minted `position_id` on
|
|
185
|
+
* each reserved `Order` before moving it onto the live book.
|
|
186
|
+
*/
|
|
187
|
+
export function setLinkedPositionId(options) {
|
|
188
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
189
|
+
const argumentsTypes = [
|
|
190
|
+
null,
|
|
191
|
+
'u64'
|
|
192
|
+
];
|
|
193
|
+
const parameterNames = ["order", "positionId"];
|
|
194
|
+
return (tx) => tx.moveCall({
|
|
195
|
+
package: packageAddress,
|
|
196
|
+
module: 'position',
|
|
197
|
+
function: 'set_linked_position_id',
|
|
198
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/** Creates a new position. Collateral is deposited into the vault. */
|
|
202
|
+
export function createPosition(options) {
|
|
203
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
204
|
+
const argumentsTypes = [
|
|
205
|
+
'u64',
|
|
206
|
+
'address',
|
|
207
|
+
'0x2::object::ID',
|
|
208
|
+
'bool',
|
|
209
|
+
null,
|
|
210
|
+
null,
|
|
211
|
+
null,
|
|
212
|
+
'u8',
|
|
213
|
+
null,
|
|
214
|
+
null,
|
|
215
|
+
null,
|
|
216
|
+
'bool',
|
|
217
|
+
null,
|
|
218
|
+
'u64',
|
|
219
|
+
'0x2::clock::Clock'
|
|
220
|
+
];
|
|
221
|
+
const parameterNames = ["positionId", "accountObjectAddress", "marketId", "isLong", "size", "collateral", "vault", "collateralDecimal", "averagePrice", "collateralPrice", "entryBorrowIndex", "entryFundingSign", "entryFundingIndex", "tradingFee"];
|
|
222
|
+
return (tx) => tx.moveCall({
|
|
223
|
+
package: packageAddress,
|
|
224
|
+
module: 'position',
|
|
225
|
+
function: 'create_position',
|
|
226
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
227
|
+
typeArguments: options.typeArguments
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/** Deposits collateral into position via the vault. */
|
|
231
|
+
export function depositCollateral(options) {
|
|
232
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
233
|
+
const argumentsTypes = [
|
|
234
|
+
null,
|
|
235
|
+
null,
|
|
236
|
+
null
|
|
237
|
+
];
|
|
238
|
+
const parameterNames = ["position", "vault", "collateral"];
|
|
239
|
+
return (tx) => tx.moveCall({
|
|
240
|
+
package: packageAddress,
|
|
241
|
+
module: 'position',
|
|
242
|
+
function: 'deposit_collateral',
|
|
243
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
244
|
+
typeArguments: options.typeArguments
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/** Withdraws collateral from a position via the vault. */
|
|
248
|
+
export function withdrawCollateral(options) {
|
|
249
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
250
|
+
const argumentsTypes = [
|
|
251
|
+
null,
|
|
252
|
+
null,
|
|
253
|
+
'u64'
|
|
254
|
+
];
|
|
255
|
+
const parameterNames = ["position", "vault", "amount"];
|
|
256
|
+
return (tx) => tx.moveCall({
|
|
257
|
+
package: packageAddress,
|
|
258
|
+
module: 'position',
|
|
259
|
+
function: 'withdraw_collateral',
|
|
260
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
261
|
+
typeArguments: options.typeArguments
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Removes a position, returning its collateral from the vault and linked order
|
|
266
|
+
* metadata.
|
|
267
|
+
*/
|
|
268
|
+
export function removePosition(options) {
|
|
269
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
270
|
+
const argumentsTypes = [
|
|
271
|
+
null,
|
|
272
|
+
null
|
|
273
|
+
];
|
|
274
|
+
const parameterNames = ["position", "vault"];
|
|
275
|
+
return (tx) => tx.moveCall({
|
|
276
|
+
package: packageAddress,
|
|
277
|
+
module: 'position',
|
|
278
|
+
function: 'remove_position',
|
|
279
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
280
|
+
typeArguments: options.typeArguments
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
export function assertPositionCollateralType(options) {
|
|
284
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
285
|
+
const argumentsTypes = [
|
|
286
|
+
null
|
|
287
|
+
];
|
|
288
|
+
const parameterNames = ["position"];
|
|
289
|
+
return (tx) => tx.moveCall({
|
|
290
|
+
package: packageAddress,
|
|
291
|
+
module: 'position',
|
|
292
|
+
function: 'assert_position_collateral_type',
|
|
293
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
294
|
+
typeArguments: options.typeArguments
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
export function assertOrderCollateralType(options) {
|
|
298
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
299
|
+
const argumentsTypes = [
|
|
300
|
+
null
|
|
301
|
+
];
|
|
302
|
+
const parameterNames = ["order"];
|
|
303
|
+
return (tx) => tx.moveCall({
|
|
304
|
+
package: packageAddress,
|
|
305
|
+
module: 'position',
|
|
306
|
+
function: 'assert_order_collateral_type',
|
|
307
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
308
|
+
typeArguments: options.typeArguments
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
export function calculatePoolReserveAmountFromValues(options) {
|
|
312
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
313
|
+
const argumentsTypes = [
|
|
314
|
+
null,
|
|
315
|
+
null,
|
|
316
|
+
'u8',
|
|
317
|
+
null
|
|
318
|
+
];
|
|
319
|
+
const parameterNames = ["size", "price", "collateralDecimal", "collateralPrice"];
|
|
320
|
+
return (tx) => tx.moveCall({
|
|
321
|
+
package: packageAddress,
|
|
322
|
+
module: 'position',
|
|
323
|
+
function: 'calculate_pool_reserve_amount_from_values',
|
|
324
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
export function calculateReserveAmount(options) {
|
|
328
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
329
|
+
const argumentsTypes = [
|
|
330
|
+
null,
|
|
331
|
+
null,
|
|
332
|
+
null
|
|
333
|
+
];
|
|
334
|
+
const parameterNames = ["position", "price", "collateralPrice"];
|
|
335
|
+
return (tx) => tx.moveCall({
|
|
336
|
+
package: packageAddress,
|
|
337
|
+
module: 'position',
|
|
338
|
+
function: 'calculate_reserve_amount',
|
|
339
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
export function calculateReserveAmountFromValues(options) {
|
|
343
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
344
|
+
const argumentsTypes = [
|
|
345
|
+
null,
|
|
346
|
+
null,
|
|
347
|
+
'u64',
|
|
348
|
+
'u8',
|
|
349
|
+
null
|
|
350
|
+
];
|
|
351
|
+
const parameterNames = ["size", "price", "collateralAmount", "collateralDecimal", "collateralPrice"];
|
|
352
|
+
return (tx) => tx.moveCall({
|
|
353
|
+
package: packageAddress,
|
|
354
|
+
module: 'position',
|
|
355
|
+
function: 'calculate_reserve_amount_from_values',
|
|
356
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
export function refreshBorrowReserve(options) {
|
|
360
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
361
|
+
const argumentsTypes = [
|
|
362
|
+
null,
|
|
363
|
+
null,
|
|
364
|
+
null
|
|
365
|
+
];
|
|
366
|
+
const parameterNames = ["position", "price", "collateralPrice"];
|
|
367
|
+
return (tx) => tx.moveCall({
|
|
368
|
+
package: packageAddress,
|
|
369
|
+
module: 'position',
|
|
370
|
+
function: 'refresh_borrow_reserve',
|
|
371
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
export function addPoolReserve(options) {
|
|
375
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
376
|
+
const argumentsTypes = [
|
|
377
|
+
null,
|
|
378
|
+
'u64'
|
|
379
|
+
];
|
|
380
|
+
const parameterNames = ["position", "reserveAmount"];
|
|
381
|
+
return (tx) => tx.moveCall({
|
|
382
|
+
package: packageAddress,
|
|
383
|
+
module: 'position',
|
|
384
|
+
function: 'add_pool_reserve',
|
|
385
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
export function realizePoolReserve(options) {
|
|
389
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
390
|
+
const argumentsTypes = [
|
|
391
|
+
null,
|
|
392
|
+
null,
|
|
393
|
+
null
|
|
394
|
+
];
|
|
395
|
+
const parameterNames = ["position", "reduceSize", "originalSize"];
|
|
396
|
+
return (tx) => tx.moveCall({
|
|
397
|
+
package: packageAddress,
|
|
398
|
+
module: 'position',
|
|
399
|
+
function: 'realize_pool_reserve',
|
|
400
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
/** Updates position size and average price (on partial fill / increase). */
|
|
404
|
+
export function updatePositionSize(options) {
|
|
405
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
406
|
+
const argumentsTypes = [
|
|
407
|
+
null,
|
|
408
|
+
null,
|
|
409
|
+
null,
|
|
410
|
+
'bool',
|
|
411
|
+
'0x2::clock::Clock'
|
|
412
|
+
];
|
|
413
|
+
const parameterNames = ["position", "newSize", "newAvgPrice", "newSide"];
|
|
414
|
+
return (tx) => tx.moveCall({
|
|
415
|
+
package: packageAddress,
|
|
416
|
+
module: 'position',
|
|
417
|
+
function: 'update_position_size',
|
|
418
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
/** Updates position borrow and funding fee state. */
|
|
422
|
+
export function updateFees(options) {
|
|
423
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
424
|
+
const argumentsTypes = [
|
|
425
|
+
null,
|
|
426
|
+
null,
|
|
427
|
+
null,
|
|
428
|
+
'bool',
|
|
429
|
+
null
|
|
430
|
+
];
|
|
431
|
+
const parameterNames = ["position", "collateralPrice", "cumulativeBorrowRate", "cumulativeFundingSign", "cumulativeFundingIndex"];
|
|
432
|
+
return (tx) => tx.moveCall({
|
|
433
|
+
package: packageAddress,
|
|
434
|
+
module: 'position',
|
|
435
|
+
function: 'update_fees',
|
|
436
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
/** Adds trading fee to unrealized. */
|
|
440
|
+
export function addTradingFee(options) {
|
|
441
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
442
|
+
const argumentsTypes = [
|
|
443
|
+
null,
|
|
444
|
+
'u64'
|
|
445
|
+
];
|
|
446
|
+
const parameterNames = ["position", "fee"];
|
|
447
|
+
return (tx) => tx.moveCall({
|
|
448
|
+
package: packageAddress,
|
|
449
|
+
module: 'position',
|
|
450
|
+
function: 'add_trading_fee',
|
|
451
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Realizes a proportional share of fees for a partial reduction. Returns
|
|
456
|
+
* (borrow_fee, funding_sign, funding_fee, trading_fee).
|
|
457
|
+
*/
|
|
458
|
+
export function realizePartialFees(options) {
|
|
459
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
460
|
+
const argumentsTypes = [
|
|
461
|
+
null,
|
|
462
|
+
null,
|
|
463
|
+
null
|
|
464
|
+
];
|
|
465
|
+
const parameterNames = ["position", "reduceSize", "originalSize"];
|
|
466
|
+
return (tx) => tx.moveCall({
|
|
467
|
+
package: packageAddress,
|
|
468
|
+
module: 'position',
|
|
469
|
+
function: 'realize_partial_fees',
|
|
470
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
/** Adds a linked order to a position. */
|
|
474
|
+
export function addLinkedOrder(options) {
|
|
475
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
476
|
+
const argumentsTypes = [
|
|
477
|
+
null,
|
|
478
|
+
'u64',
|
|
479
|
+
'u128'
|
|
480
|
+
];
|
|
481
|
+
const parameterNames = ["position", "orderId", "priceKey"];
|
|
482
|
+
return (tx) => tx.moveCall({
|
|
483
|
+
package: packageAddress,
|
|
484
|
+
module: 'position',
|
|
485
|
+
function: 'add_linked_order',
|
|
486
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
export function maxLinkedOrders(options = {}) {
|
|
490
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
491
|
+
return (tx) => tx.moveCall({
|
|
492
|
+
package: packageAddress,
|
|
493
|
+
module: 'position',
|
|
494
|
+
function: 'max_linked_orders',
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
/** Removes a linked order from a position. */
|
|
498
|
+
export function removeLinkedOrder(options) {
|
|
499
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
500
|
+
const argumentsTypes = [
|
|
501
|
+
null,
|
|
502
|
+
'u64'
|
|
503
|
+
];
|
|
504
|
+
const parameterNames = ["position", "orderId"];
|
|
505
|
+
return (tx) => tx.moveCall({
|
|
506
|
+
package: packageAddress,
|
|
507
|
+
module: 'position',
|
|
508
|
+
function: 'remove_linked_order',
|
|
509
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
/** Calculates unrealized PnL. Returns (is_profit, pnl as Float in USD). */
|
|
513
|
+
export function unrealizedPnl(options) {
|
|
514
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
515
|
+
const argumentsTypes = [
|
|
516
|
+
null,
|
|
517
|
+
null
|
|
518
|
+
];
|
|
519
|
+
const parameterNames = ["position", "currentPrice"];
|
|
520
|
+
return (tx) => tx.moveCall({
|
|
521
|
+
package: packageAddress,
|
|
522
|
+
module: 'position',
|
|
523
|
+
function: 'unrealized_pnl',
|
|
524
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
/** Returns true if the order should be filled at the given oracle price. */
|
|
528
|
+
export function checkOrderFillable(options) {
|
|
529
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
530
|
+
const argumentsTypes = [
|
|
531
|
+
null,
|
|
532
|
+
null
|
|
533
|
+
];
|
|
534
|
+
const parameterNames = ["order", "oraclePrice"];
|
|
535
|
+
return (tx) => tx.moveCall({
|
|
536
|
+
package: packageAddress,
|
|
537
|
+
module: 'position',
|
|
538
|
+
function: 'check_order_fillable',
|
|
539
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Returns true if the position is liquidatable. `maintenance_margin` is a Float
|
|
544
|
+
* rate (e.g. 0.015 = 1.5%).
|
|
545
|
+
*/
|
|
546
|
+
export function isLiquidatable(options) {
|
|
547
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
548
|
+
const argumentsTypes = [
|
|
549
|
+
null,
|
|
550
|
+
null,
|
|
551
|
+
null,
|
|
552
|
+
null,
|
|
553
|
+
null,
|
|
554
|
+
null,
|
|
555
|
+
'bool',
|
|
556
|
+
null
|
|
557
|
+
];
|
|
558
|
+
const parameterNames = ["position", "currentPrice", "collateralPrice", "closingFee", "maintenanceMargin", "cumulativeBorrowRate", "cumulativeFundingSign", "cumulativeFundingIndex"];
|
|
559
|
+
return (tx) => tx.moveCall({
|
|
560
|
+
package: packageAddress,
|
|
561
|
+
module: 'position',
|
|
562
|
+
function: 'is_liquidatable',
|
|
563
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
export function calculateBorrowFee(options) {
|
|
567
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
568
|
+
const argumentsTypes = [
|
|
569
|
+
null,
|
|
570
|
+
null
|
|
571
|
+
];
|
|
572
|
+
const parameterNames = ["position", "cumulativeBorrowRate"];
|
|
573
|
+
return (tx) => tx.moveCall({
|
|
574
|
+
package: packageAddress,
|
|
575
|
+
module: 'position',
|
|
576
|
+
function: 'calculate_borrow_fee',
|
|
577
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
export function calculateFundingFee(options) {
|
|
581
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
582
|
+
const argumentsTypes = [
|
|
583
|
+
null,
|
|
584
|
+
null,
|
|
585
|
+
'bool',
|
|
586
|
+
null
|
|
587
|
+
];
|
|
588
|
+
const parameterNames = ["position", "collateralPrice", "cumulativeFundingSign", "cumulativeFundingIndex"];
|
|
589
|
+
return (tx) => tx.moveCall({
|
|
590
|
+
package: packageAddress,
|
|
591
|
+
module: 'position',
|
|
592
|
+
function: 'calculate_funding_fee',
|
|
593
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
export function getPositionId(options) {
|
|
597
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
598
|
+
const argumentsTypes = [
|
|
599
|
+
null
|
|
600
|
+
];
|
|
601
|
+
const parameterNames = ["p"];
|
|
602
|
+
return (tx) => tx.moveCall({
|
|
603
|
+
package: packageAddress,
|
|
604
|
+
module: 'position',
|
|
605
|
+
function: 'get_position_id',
|
|
606
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
export function positionAccountObjectAddress(options) {
|
|
610
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
611
|
+
const argumentsTypes = [
|
|
612
|
+
null
|
|
613
|
+
];
|
|
614
|
+
const parameterNames = ["p"];
|
|
615
|
+
return (tx) => tx.moveCall({
|
|
616
|
+
package: packageAddress,
|
|
617
|
+
module: 'position',
|
|
618
|
+
function: 'position_account_object_address',
|
|
619
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
export function positionMarketId(options) {
|
|
623
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
624
|
+
const argumentsTypes = [
|
|
625
|
+
null
|
|
626
|
+
];
|
|
627
|
+
const parameterNames = ["p"];
|
|
628
|
+
return (tx) => tx.moveCall({
|
|
629
|
+
package: packageAddress,
|
|
630
|
+
module: 'position',
|
|
631
|
+
function: 'position_market_id',
|
|
632
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
export function positionIsLong(options) {
|
|
636
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
637
|
+
const argumentsTypes = [
|
|
638
|
+
null
|
|
639
|
+
];
|
|
640
|
+
const parameterNames = ["p"];
|
|
641
|
+
return (tx) => tx.moveCall({
|
|
642
|
+
package: packageAddress,
|
|
643
|
+
module: 'position',
|
|
644
|
+
function: 'position_is_long',
|
|
645
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
export function positionSize(options) {
|
|
649
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
650
|
+
const argumentsTypes = [
|
|
651
|
+
null
|
|
652
|
+
];
|
|
653
|
+
const parameterNames = ["p"];
|
|
654
|
+
return (tx) => tx.moveCall({
|
|
655
|
+
package: packageAddress,
|
|
656
|
+
module: 'position',
|
|
657
|
+
function: 'position_size',
|
|
658
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
export function positionCollateralToken(options) {
|
|
662
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
663
|
+
const argumentsTypes = [
|
|
664
|
+
null
|
|
665
|
+
];
|
|
666
|
+
const parameterNames = ["p"];
|
|
667
|
+
return (tx) => tx.moveCall({
|
|
668
|
+
package: packageAddress,
|
|
669
|
+
module: 'position',
|
|
670
|
+
function: 'position_collateral_token',
|
|
671
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
export function positionCollateralDecimal(options) {
|
|
675
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
676
|
+
const argumentsTypes = [
|
|
677
|
+
null
|
|
678
|
+
];
|
|
679
|
+
const parameterNames = ["p"];
|
|
680
|
+
return (tx) => tx.moveCall({
|
|
681
|
+
package: packageAddress,
|
|
682
|
+
module: 'position',
|
|
683
|
+
function: 'position_collateral_decimal',
|
|
684
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
export function positionCollateralAmount(options) {
|
|
688
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
689
|
+
const argumentsTypes = [
|
|
690
|
+
null
|
|
691
|
+
];
|
|
692
|
+
const parameterNames = ["p"];
|
|
693
|
+
return (tx) => tx.moveCall({
|
|
694
|
+
package: packageAddress,
|
|
695
|
+
module: 'position',
|
|
696
|
+
function: 'position_collateral_amount',
|
|
697
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
export function positionAveragePrice(options) {
|
|
701
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
702
|
+
const argumentsTypes = [
|
|
703
|
+
null
|
|
704
|
+
];
|
|
705
|
+
const parameterNames = ["p"];
|
|
706
|
+
return (tx) => tx.moveCall({
|
|
707
|
+
package: packageAddress,
|
|
708
|
+
module: 'position',
|
|
709
|
+
function: 'position_average_price',
|
|
710
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
export function positionEntryBorrowIndex(options) {
|
|
714
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
715
|
+
const argumentsTypes = [
|
|
716
|
+
null
|
|
717
|
+
];
|
|
718
|
+
const parameterNames = ["p"];
|
|
719
|
+
return (tx) => tx.moveCall({
|
|
720
|
+
package: packageAddress,
|
|
721
|
+
module: 'position',
|
|
722
|
+
function: 'position_entry_borrow_index',
|
|
723
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
export function positionPoolReserveAmount(options) {
|
|
727
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
728
|
+
const argumentsTypes = [
|
|
729
|
+
null
|
|
730
|
+
];
|
|
731
|
+
const parameterNames = ["p"];
|
|
732
|
+
return (tx) => tx.moveCall({
|
|
733
|
+
package: packageAddress,
|
|
734
|
+
module: 'position',
|
|
735
|
+
function: 'position_pool_reserve_amount',
|
|
736
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
export function positionBorrowReserveAmount(options) {
|
|
740
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
741
|
+
const argumentsTypes = [
|
|
742
|
+
null
|
|
743
|
+
];
|
|
744
|
+
const parameterNames = ["p"];
|
|
745
|
+
return (tx) => tx.moveCall({
|
|
746
|
+
package: packageAddress,
|
|
747
|
+
module: 'position',
|
|
748
|
+
function: 'position_borrow_reserve_amount',
|
|
749
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
export function positionLinkedOrderIds(options) {
|
|
753
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
754
|
+
const argumentsTypes = [
|
|
755
|
+
null
|
|
756
|
+
];
|
|
757
|
+
const parameterNames = ["p"];
|
|
758
|
+
return (tx) => tx.moveCall({
|
|
759
|
+
package: packageAddress,
|
|
760
|
+
module: 'position',
|
|
761
|
+
function: 'position_linked_order_ids',
|
|
762
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
export function positionLinkedOrderPriceKeys(options) {
|
|
766
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
767
|
+
const argumentsTypes = [
|
|
768
|
+
null
|
|
769
|
+
];
|
|
770
|
+
const parameterNames = ["p"];
|
|
771
|
+
return (tx) => tx.moveCall({
|
|
772
|
+
package: packageAddress,
|
|
773
|
+
module: 'position',
|
|
774
|
+
function: 'position_linked_order_price_keys',
|
|
775
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
export function positionUnrealizedBorrowFee(options) {
|
|
779
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
780
|
+
const argumentsTypes = [
|
|
781
|
+
null
|
|
782
|
+
];
|
|
783
|
+
const parameterNames = ["p"];
|
|
784
|
+
return (tx) => tx.moveCall({
|
|
785
|
+
package: packageAddress,
|
|
786
|
+
module: 'position',
|
|
787
|
+
function: 'position_unrealized_borrow_fee',
|
|
788
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
export function positionUnrealizedTradingFee(options) {
|
|
792
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
793
|
+
const argumentsTypes = [
|
|
794
|
+
null
|
|
795
|
+
];
|
|
796
|
+
const parameterNames = ["p"];
|
|
797
|
+
return (tx) => tx.moveCall({
|
|
798
|
+
package: packageAddress,
|
|
799
|
+
module: 'position',
|
|
800
|
+
function: 'position_unrealized_trading_fee',
|
|
801
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
export function positionUnrealizedFundingSign(options) {
|
|
805
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
806
|
+
const argumentsTypes = [
|
|
807
|
+
null
|
|
808
|
+
];
|
|
809
|
+
const parameterNames = ["p"];
|
|
810
|
+
return (tx) => tx.moveCall({
|
|
811
|
+
package: packageAddress,
|
|
812
|
+
module: 'position',
|
|
813
|
+
function: 'position_unrealized_funding_sign',
|
|
814
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
export function positionUnrealizedFundingFee(options) {
|
|
818
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
819
|
+
const argumentsTypes = [
|
|
820
|
+
null
|
|
821
|
+
];
|
|
822
|
+
const parameterNames = ["p"];
|
|
823
|
+
return (tx) => tx.moveCall({
|
|
824
|
+
package: packageAddress,
|
|
825
|
+
module: 'position',
|
|
826
|
+
function: 'position_unrealized_funding_fee',
|
|
827
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
export function positionUpdateTimestamp(options) {
|
|
831
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
832
|
+
const argumentsTypes = [
|
|
833
|
+
null
|
|
834
|
+
];
|
|
835
|
+
const parameterNames = ["p"];
|
|
836
|
+
return (tx) => tx.moveCall({
|
|
837
|
+
package: packageAddress,
|
|
838
|
+
module: 'position',
|
|
839
|
+
function: 'position_update_timestamp',
|
|
840
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
export function positionEntryFundingSign(options) {
|
|
844
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
845
|
+
const argumentsTypes = [
|
|
846
|
+
null
|
|
847
|
+
];
|
|
848
|
+
const parameterNames = ["p"];
|
|
849
|
+
return (tx) => tx.moveCall({
|
|
850
|
+
package: packageAddress,
|
|
851
|
+
module: 'position',
|
|
852
|
+
function: 'position_entry_funding_sign',
|
|
853
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
export function positionEntryFundingIndex(options) {
|
|
857
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
858
|
+
const argumentsTypes = [
|
|
859
|
+
null
|
|
860
|
+
];
|
|
861
|
+
const parameterNames = ["p"];
|
|
862
|
+
return (tx) => tx.moveCall({
|
|
863
|
+
package: packageAddress,
|
|
864
|
+
module: 'position',
|
|
865
|
+
function: 'position_entry_funding_index',
|
|
866
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
export function positionFeeState(options) {
|
|
870
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
871
|
+
const argumentsTypes = [
|
|
872
|
+
null
|
|
873
|
+
];
|
|
874
|
+
const parameterNames = ["p"];
|
|
875
|
+
return (tx) => tx.moveCall({
|
|
876
|
+
package: packageAddress,
|
|
877
|
+
module: 'position',
|
|
878
|
+
function: 'position_fee_state',
|
|
879
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
export function positionCreateTimestamp(options) {
|
|
883
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
884
|
+
const argumentsTypes = [
|
|
885
|
+
null
|
|
886
|
+
];
|
|
887
|
+
const parameterNames = ["p"];
|
|
888
|
+
return (tx) => tx.moveCall({
|
|
889
|
+
package: packageAddress,
|
|
890
|
+
module: 'position',
|
|
891
|
+
function: 'position_create_timestamp',
|
|
892
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
export function getOrderId(options) {
|
|
896
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
897
|
+
const argumentsTypes = [
|
|
898
|
+
null
|
|
899
|
+
];
|
|
900
|
+
const parameterNames = ["o"];
|
|
901
|
+
return (tx) => tx.moveCall({
|
|
902
|
+
package: packageAddress,
|
|
903
|
+
module: 'position',
|
|
904
|
+
function: 'get_order_id',
|
|
905
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
export function orderAccountObjectAddress(options) {
|
|
909
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
910
|
+
const argumentsTypes = [
|
|
911
|
+
null
|
|
912
|
+
];
|
|
913
|
+
const parameterNames = ["o"];
|
|
914
|
+
return (tx) => tx.moveCall({
|
|
915
|
+
package: packageAddress,
|
|
916
|
+
module: 'position',
|
|
917
|
+
function: 'order_account_object_address',
|
|
918
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
export function orderMarketId(options) {
|
|
922
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
923
|
+
const argumentsTypes = [
|
|
924
|
+
null
|
|
925
|
+
];
|
|
926
|
+
const parameterNames = ["o"];
|
|
927
|
+
return (tx) => tx.moveCall({
|
|
928
|
+
package: packageAddress,
|
|
929
|
+
module: 'position',
|
|
930
|
+
function: 'order_market_id',
|
|
931
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
export function orderIsLong(options) {
|
|
935
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
936
|
+
const argumentsTypes = [
|
|
937
|
+
null
|
|
938
|
+
];
|
|
939
|
+
const parameterNames = ["o"];
|
|
940
|
+
return (tx) => tx.moveCall({
|
|
941
|
+
package: packageAddress,
|
|
942
|
+
module: 'position',
|
|
943
|
+
function: 'order_is_long',
|
|
944
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
export function orderIsStopOrder(options) {
|
|
948
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
949
|
+
const argumentsTypes = [
|
|
950
|
+
null
|
|
951
|
+
];
|
|
952
|
+
const parameterNames = ["o"];
|
|
953
|
+
return (tx) => tx.moveCall({
|
|
954
|
+
package: packageAddress,
|
|
955
|
+
module: 'position',
|
|
956
|
+
function: 'order_is_stop_order',
|
|
957
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
export function orderReduceOnly(options) {
|
|
961
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
962
|
+
const argumentsTypes = [
|
|
963
|
+
null
|
|
964
|
+
];
|
|
965
|
+
const parameterNames = ["o"];
|
|
966
|
+
return (tx) => tx.moveCall({
|
|
967
|
+
package: packageAddress,
|
|
968
|
+
module: 'position',
|
|
969
|
+
function: 'order_reduce_only',
|
|
970
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
export function orderSize(options) {
|
|
974
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
975
|
+
const argumentsTypes = [
|
|
976
|
+
null
|
|
977
|
+
];
|
|
978
|
+
const parameterNames = ["o"];
|
|
979
|
+
return (tx) => tx.moveCall({
|
|
980
|
+
package: packageAddress,
|
|
981
|
+
module: 'position',
|
|
982
|
+
function: 'order_size',
|
|
983
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
export function orderTriggerPrice(options) {
|
|
987
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
988
|
+
const argumentsTypes = [
|
|
989
|
+
null
|
|
990
|
+
];
|
|
991
|
+
const parameterNames = ["o"];
|
|
992
|
+
return (tx) => tx.moveCall({
|
|
993
|
+
package: packageAddress,
|
|
994
|
+
module: 'position',
|
|
995
|
+
function: 'order_trigger_price',
|
|
996
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
export function orderAcceptablePrice(options) {
|
|
1000
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
1001
|
+
const argumentsTypes = [
|
|
1002
|
+
null
|
|
1003
|
+
];
|
|
1004
|
+
const parameterNames = ["o"];
|
|
1005
|
+
return (tx) => tx.moveCall({
|
|
1006
|
+
package: packageAddress,
|
|
1007
|
+
module: 'position',
|
|
1008
|
+
function: 'order_acceptable_price',
|
|
1009
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
export function orderLinkedPositionId(options) {
|
|
1013
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
1014
|
+
const argumentsTypes = [
|
|
1015
|
+
null
|
|
1016
|
+
];
|
|
1017
|
+
const parameterNames = ["o"];
|
|
1018
|
+
return (tx) => tx.moveCall({
|
|
1019
|
+
package: packageAddress,
|
|
1020
|
+
module: 'position',
|
|
1021
|
+
function: 'order_linked_position_id',
|
|
1022
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
export function orderCollateralToken(options) {
|
|
1026
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
1027
|
+
const argumentsTypes = [
|
|
1028
|
+
null
|
|
1029
|
+
];
|
|
1030
|
+
const parameterNames = ["o"];
|
|
1031
|
+
return (tx) => tx.moveCall({
|
|
1032
|
+
package: packageAddress,
|
|
1033
|
+
module: 'position',
|
|
1034
|
+
function: 'order_collateral_token',
|
|
1035
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
export function orderCollateralDecimal(options) {
|
|
1039
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
1040
|
+
const argumentsTypes = [
|
|
1041
|
+
null
|
|
1042
|
+
];
|
|
1043
|
+
const parameterNames = ["o"];
|
|
1044
|
+
return (tx) => tx.moveCall({
|
|
1045
|
+
package: packageAddress,
|
|
1046
|
+
module: 'position',
|
|
1047
|
+
function: 'order_collateral_decimal',
|
|
1048
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
export function orderCollateralAmount(options) {
|
|
1052
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
1053
|
+
const argumentsTypes = [
|
|
1054
|
+
null
|
|
1055
|
+
];
|
|
1056
|
+
const parameterNames = ["o"];
|
|
1057
|
+
return (tx) => tx.moveCall({
|
|
1058
|
+
package: packageAddress,
|
|
1059
|
+
module: 'position',
|
|
1060
|
+
function: 'order_collateral_amount',
|
|
1061
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
export function orderLeverageBps(options) {
|
|
1065
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
1066
|
+
const argumentsTypes = [
|
|
1067
|
+
null
|
|
1068
|
+
];
|
|
1069
|
+
const parameterNames = ["o"];
|
|
1070
|
+
return (tx) => tx.moveCall({
|
|
1071
|
+
package: packageAddress,
|
|
1072
|
+
module: 'position',
|
|
1073
|
+
function: 'order_leverage_bps',
|
|
1074
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
export function orderCreateTimestamp(options) {
|
|
1078
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
1079
|
+
const argumentsTypes = [
|
|
1080
|
+
null
|
|
1081
|
+
];
|
|
1082
|
+
const parameterNames = ["o"];
|
|
1083
|
+
return (tx) => tx.moveCall({
|
|
1084
|
+
package: packageAddress,
|
|
1085
|
+
module: 'position',
|
|
1086
|
+
function: 'order_create_timestamp',
|
|
1087
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
/** Returns order type tag: 0=limit_buy, 1=limit_sell, 2=stop_buy, 3=stop_sell. */
|
|
1091
|
+
export function orderTypeTag(options) {
|
|
1092
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
1093
|
+
const argumentsTypes = [
|
|
1094
|
+
null
|
|
1095
|
+
];
|
|
1096
|
+
const parameterNames = ["o"];
|
|
1097
|
+
return (tx) => tx.moveCall({
|
|
1098
|
+
package: packageAddress,
|
|
1099
|
+
module: 'position',
|
|
1100
|
+
function: 'order_type_tag',
|
|
1101
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1102
|
+
});
|
|
1103
|
+
}
|