@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,269 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Per-account perp state, stored as a `WaterXPerpData` blob on the shared
|
|
6
|
+
* `waterx_account::Account` object via `wxa::new_data` / `wxa::borrow_data` /
|
|
7
|
+
* `wxa::borrow_data_mut`. No separate `UserAccount` object and no perp-side
|
|
8
|
+
* `AccountRegistry` exist — the wxa account IS the canonical user identity.
|
|
9
|
+
*
|
|
10
|
+
* `WaterXPerp` is the witness type that gates every perp-side mutation of the wxa
|
|
11
|
+
* account: the data slot (`new_data` / `borrow_data_mut`) AND fund movement
|
|
12
|
+
* (`wxa_account::take<C, WaterXPerp>` / `wxa_account::put<C, WaterXPerp>`). Only
|
|
13
|
+
* this module can construct `WaterXPerp {}`, so type-construction privacy is the
|
|
14
|
+
* security boundary for both surfaces.
|
|
15
|
+
*
|
|
16
|
+
* Deposit flow (no TTO): wxa::deposit<T_U, T_M>(...) // Mirrorable
|
|
17
|
+
* wxa::deposit_raw_coin<T>(...) // Storable
|
|
18
|
+
*
|
|
19
|
+
* Trading then draws collateral directly from the user's wxa balance in
|
|
20
|
+
* `trading.move`; payback paths repay via `wxa_account::put`.
|
|
21
|
+
*/
|
|
22
|
+
import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
|
|
23
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
24
|
+
export declare const WaterXPerp: MoveStruct<{
|
|
25
|
+
dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
|
|
26
|
+
}, "@waterx/perp::account_data::WaterXPerp">;
|
|
27
|
+
export declare const WaterXPerpData: MoveStruct<{
|
|
28
|
+
/** Position IDs keyed by Market ID. */
|
|
29
|
+
positions: MoveStruct<{
|
|
30
|
+
contents: import("@mysten/sui/bcs").BcsType<{
|
|
31
|
+
key: string;
|
|
32
|
+
value: string[];
|
|
33
|
+
}[], Iterable<{
|
|
34
|
+
key: string | Uint8Array<ArrayBufferLike>;
|
|
35
|
+
value: Iterable<string | number | bigint> & {
|
|
36
|
+
length: number;
|
|
37
|
+
};
|
|
38
|
+
}> & {
|
|
39
|
+
length: number;
|
|
40
|
+
}, string>;
|
|
41
|
+
}, "0x2::vec_map::VecMap<bytes[32], vector<u64>>">;
|
|
42
|
+
/** Order IDs keyed by Market ID. */
|
|
43
|
+
orders: MoveStruct<{
|
|
44
|
+
contents: import("@mysten/sui/bcs").BcsType<{
|
|
45
|
+
key: string;
|
|
46
|
+
value: string[];
|
|
47
|
+
}[], Iterable<{
|
|
48
|
+
key: string | Uint8Array<ArrayBufferLike>;
|
|
49
|
+
value: Iterable<string | number | bigint> & {
|
|
50
|
+
length: number;
|
|
51
|
+
};
|
|
52
|
+
}> & {
|
|
53
|
+
length: number;
|
|
54
|
+
}, string>;
|
|
55
|
+
}, "0x2::vec_map::VecMap<bytes[32], vector<u64>>">;
|
|
56
|
+
}, "@waterx/perp::account_data::WaterXPerpData">;
|
|
57
|
+
export interface PermOpenPositionOptions {
|
|
58
|
+
package?: string;
|
|
59
|
+
arguments?: [
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
export declare function permOpenPosition(options?: PermOpenPositionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
63
|
+
export interface PermClosePositionOptions {
|
|
64
|
+
package?: string;
|
|
65
|
+
arguments?: [
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
export declare function permClosePosition(options?: PermClosePositionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
69
|
+
export interface PermIncreasePositionOptions {
|
|
70
|
+
package?: string;
|
|
71
|
+
arguments?: [
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
export declare function permIncreasePosition(options?: PermIncreasePositionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
75
|
+
export interface PermDecreasePositionOptions {
|
|
76
|
+
package?: string;
|
|
77
|
+
arguments?: [
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
export declare function permDecreasePosition(options?: PermDecreasePositionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
81
|
+
export interface PermPlaceOrderOptions {
|
|
82
|
+
package?: string;
|
|
83
|
+
arguments?: [
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
export declare function permPlaceOrder(options?: PermPlaceOrderOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
87
|
+
export interface PermCancelOrderOptions {
|
|
88
|
+
package?: string;
|
|
89
|
+
arguments?: [
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
export declare function permCancelOrder(options?: PermCancelOrderOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
93
|
+
export interface PermDepositCollateralOptions {
|
|
94
|
+
package?: string;
|
|
95
|
+
arguments?: [
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
export declare function permDepositCollateral(options?: PermDepositCollateralOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
99
|
+
export interface PermWithdrawCollateralOptions {
|
|
100
|
+
package?: string;
|
|
101
|
+
arguments?: [
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
export declare function permWithdrawCollateral(options?: PermWithdrawCollateralOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
105
|
+
export interface PermMintWlpOptions {
|
|
106
|
+
package?: string;
|
|
107
|
+
arguments?: [
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
export declare function permMintWlp(options?: PermMintWlpOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
111
|
+
export interface PermRedeemWlpOptions {
|
|
112
|
+
package?: string;
|
|
113
|
+
arguments?: [
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
export declare function permRedeemWlp(options?: PermRedeemWlpOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
117
|
+
export interface WitnessOptions {
|
|
118
|
+
package?: string;
|
|
119
|
+
arguments?: [
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
export declare function witness(options?: WitnessOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
123
|
+
export interface AccountPositionsArguments {
|
|
124
|
+
data: RawTransactionArgument<string>;
|
|
125
|
+
}
|
|
126
|
+
export interface AccountPositionsOptions {
|
|
127
|
+
package?: string;
|
|
128
|
+
arguments: AccountPositionsArguments | [
|
|
129
|
+
data: RawTransactionArgument<string>
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
export declare function accountPositions(options: AccountPositionsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
133
|
+
export interface AccountOrdersArguments {
|
|
134
|
+
data: RawTransactionArgument<string>;
|
|
135
|
+
}
|
|
136
|
+
export interface AccountOrdersOptions {
|
|
137
|
+
package?: string;
|
|
138
|
+
arguments: AccountOrdersArguments | [
|
|
139
|
+
data: RawTransactionArgument<string>
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
export declare function accountOrders(options: AccountOrdersOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
143
|
+
export interface HasAccountArguments {
|
|
144
|
+
wxaRegistry: RawTransactionArgument<string>;
|
|
145
|
+
accountId: RawTransactionArgument<string>;
|
|
146
|
+
}
|
|
147
|
+
export interface HasAccountOptions {
|
|
148
|
+
package?: string;
|
|
149
|
+
arguments: HasAccountArguments | [
|
|
150
|
+
wxaRegistry: RawTransactionArgument<string>,
|
|
151
|
+
accountId: RawTransactionArgument<string>
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* True if a `WaterXPerpData` slot exists on the wxa account. The slot is
|
|
156
|
+
* auto-installed on first position/order add — see `ensure_data`.
|
|
157
|
+
*/
|
|
158
|
+
export declare function hasAccount(options: HasAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
159
|
+
export interface BorrowAccountArguments {
|
|
160
|
+
wxaRegistry: RawTransactionArgument<string>;
|
|
161
|
+
accountId: RawTransactionArgument<string>;
|
|
162
|
+
}
|
|
163
|
+
export interface BorrowAccountOptions {
|
|
164
|
+
package?: string;
|
|
165
|
+
arguments: BorrowAccountArguments | [
|
|
166
|
+
wxaRegistry: RawTransactionArgument<string>,
|
|
167
|
+
accountId: RawTransactionArgument<string>
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
/** Borrow the perp data blob (read-only). Aborts if no slot exists. */
|
|
171
|
+
export declare function borrowAccount(options: BorrowAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
172
|
+
export interface AccountObjectAddressArguments {
|
|
173
|
+
WxaRegistry: RawTransactionArgument<string>;
|
|
174
|
+
accountId: RawTransactionArgument<string>;
|
|
175
|
+
}
|
|
176
|
+
export interface AccountObjectAddressOptions {
|
|
177
|
+
package?: string;
|
|
178
|
+
arguments: AccountObjectAddressArguments | [
|
|
179
|
+
WxaRegistry: RawTransactionArgument<string>,
|
|
180
|
+
accountId: RawTransactionArgument<string>
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* UID-derived address of the wxa account — the value stored on `Position` /
|
|
185
|
+
* `Order` as `account_object_address`. Just `account_id.to_address()`.
|
|
186
|
+
*/
|
|
187
|
+
export declare function accountObjectAddress(options: AccountObjectAddressOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
188
|
+
export interface AddPositionArguments {
|
|
189
|
+
wxaRegistry: RawTransactionArgument<string>;
|
|
190
|
+
accountId: RawTransactionArgument<string>;
|
|
191
|
+
marketId: RawTransactionArgument<string>;
|
|
192
|
+
positionId: RawTransactionArgument<number | bigint>;
|
|
193
|
+
}
|
|
194
|
+
export interface AddPositionOptions {
|
|
195
|
+
package?: string;
|
|
196
|
+
arguments: AddPositionArguments | [
|
|
197
|
+
wxaRegistry: RawTransactionArgument<string>,
|
|
198
|
+
accountId: RawTransactionArgument<string>,
|
|
199
|
+
marketId: RawTransactionArgument<string>,
|
|
200
|
+
positionId: RawTransactionArgument<number | bigint>
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
export declare function addPosition(options: AddPositionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
204
|
+
export interface RemovePositionArguments {
|
|
205
|
+
wxaRegistry: RawTransactionArgument<string>;
|
|
206
|
+
accountId: RawTransactionArgument<string>;
|
|
207
|
+
marketId: RawTransactionArgument<string>;
|
|
208
|
+
positionId: RawTransactionArgument<number | bigint>;
|
|
209
|
+
}
|
|
210
|
+
export interface RemovePositionOptions {
|
|
211
|
+
package?: string;
|
|
212
|
+
arguments: RemovePositionArguments | [
|
|
213
|
+
wxaRegistry: RawTransactionArgument<string>,
|
|
214
|
+
accountId: RawTransactionArgument<string>,
|
|
215
|
+
marketId: RawTransactionArgument<string>,
|
|
216
|
+
positionId: RawTransactionArgument<number | bigint>
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
export declare function removePosition(options: RemovePositionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
220
|
+
export interface AddOrderArguments {
|
|
221
|
+
wxaRegistry: RawTransactionArgument<string>;
|
|
222
|
+
accountId: RawTransactionArgument<string>;
|
|
223
|
+
marketId: RawTransactionArgument<string>;
|
|
224
|
+
orderId: RawTransactionArgument<number | bigint>;
|
|
225
|
+
}
|
|
226
|
+
export interface AddOrderOptions {
|
|
227
|
+
package?: string;
|
|
228
|
+
arguments: AddOrderArguments | [
|
|
229
|
+
wxaRegistry: RawTransactionArgument<string>,
|
|
230
|
+
accountId: RawTransactionArgument<string>,
|
|
231
|
+
marketId: RawTransactionArgument<string>,
|
|
232
|
+
orderId: RawTransactionArgument<number | bigint>
|
|
233
|
+
];
|
|
234
|
+
}
|
|
235
|
+
export declare function addOrder(options: AddOrderOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
236
|
+
export interface RemoveOrderArguments {
|
|
237
|
+
wxaRegistry: RawTransactionArgument<string>;
|
|
238
|
+
accountId: RawTransactionArgument<string>;
|
|
239
|
+
marketId: RawTransactionArgument<string>;
|
|
240
|
+
orderId: RawTransactionArgument<number | bigint>;
|
|
241
|
+
}
|
|
242
|
+
export interface RemoveOrderOptions {
|
|
243
|
+
package?: string;
|
|
244
|
+
arguments: RemoveOrderArguments | [
|
|
245
|
+
wxaRegistry: RawTransactionArgument<string>,
|
|
246
|
+
accountId: RawTransactionArgument<string>,
|
|
247
|
+
marketId: RawTransactionArgument<string>,
|
|
248
|
+
orderId: RawTransactionArgument<number | bigint>
|
|
249
|
+
];
|
|
250
|
+
}
|
|
251
|
+
export declare function removeOrder(options: RemoveOrderOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
252
|
+
export interface EnsureDataArguments {
|
|
253
|
+
wxaRegistry: RawTransactionArgument<string>;
|
|
254
|
+
accountId: RawTransactionArgument<string>;
|
|
255
|
+
}
|
|
256
|
+
export interface EnsureDataOptions {
|
|
257
|
+
package?: string;
|
|
258
|
+
arguments: EnsureDataArguments | [
|
|
259
|
+
wxaRegistry: RawTransactionArgument<string>,
|
|
260
|
+
accountId: RawTransactionArgument<string>
|
|
261
|
+
];
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Installs an empty `WaterXPerpData` slot on the wxa account if one doesn't
|
|
265
|
+
* already exist. Idempotent. Called from `add_position` / `add_order` so the first
|
|
266
|
+
* trade on an account auto-installs the slot without requiring an explicit
|
|
267
|
+
* `create_account`.
|
|
268
|
+
*/
|
|
269
|
+
export declare function ensureData(options: EnsureDataOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Per-account perp state, stored as a `WaterXPerpData` blob on the shared
|
|
6
|
+
* `waterx_account::Account` object via `wxa::new_data` / `wxa::borrow_data` /
|
|
7
|
+
* `wxa::borrow_data_mut`. No separate `UserAccount` object and no perp-side
|
|
8
|
+
* `AccountRegistry` exist — the wxa account IS the canonical user identity.
|
|
9
|
+
*
|
|
10
|
+
* `WaterXPerp` is the witness type that gates every perp-side mutation of the wxa
|
|
11
|
+
* account: the data slot (`new_data` / `borrow_data_mut`) AND fund movement
|
|
12
|
+
* (`wxa_account::take<C, WaterXPerp>` / `wxa_account::put<C, WaterXPerp>`). Only
|
|
13
|
+
* this module can construct `WaterXPerp {}`, so type-construction privacy is the
|
|
14
|
+
* security boundary for both surfaces.
|
|
15
|
+
*
|
|
16
|
+
* Deposit flow (no TTO): wxa::deposit<T_U, T_M>(...) // Mirrorable
|
|
17
|
+
* wxa::deposit_raw_coin<T>(...) // Storable
|
|
18
|
+
*
|
|
19
|
+
* Trading then draws collateral directly from the user's wxa balance in
|
|
20
|
+
* `trading.move`; payback paths repay via `wxa_account::put`.
|
|
21
|
+
*/
|
|
22
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
23
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
24
|
+
import * as vec_map from "./deps/sui/vec_map.js";
|
|
25
|
+
import * as vec_map_1 from "./deps/sui/vec_map.js";
|
|
26
|
+
const $moduleName = '@waterx/perp::account_data';
|
|
27
|
+
export const WaterXPerp = new MoveStruct({ name: `${$moduleName}::WaterXPerp`, fields: {
|
|
28
|
+
dummy_field: bcs.bool()
|
|
29
|
+
} });
|
|
30
|
+
export const WaterXPerpData = new MoveStruct({ name: `${$moduleName}::WaterXPerpData`, fields: {
|
|
31
|
+
/** Position IDs keyed by Market ID. */
|
|
32
|
+
positions: vec_map.VecMap(bcs.Address, bcs.vector(bcs.u64())),
|
|
33
|
+
/** Order IDs keyed by Market ID. */
|
|
34
|
+
orders: vec_map_1.VecMap(bcs.Address, bcs.vector(bcs.u64()))
|
|
35
|
+
} });
|
|
36
|
+
export function permOpenPosition(options = {}) {
|
|
37
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
38
|
+
return (tx) => tx.moveCall({
|
|
39
|
+
package: packageAddress,
|
|
40
|
+
module: 'account_data',
|
|
41
|
+
function: 'perm_open_position',
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export function permClosePosition(options = {}) {
|
|
45
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
46
|
+
return (tx) => tx.moveCall({
|
|
47
|
+
package: packageAddress,
|
|
48
|
+
module: 'account_data',
|
|
49
|
+
function: 'perm_close_position',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function permIncreasePosition(options = {}) {
|
|
53
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
54
|
+
return (tx) => tx.moveCall({
|
|
55
|
+
package: packageAddress,
|
|
56
|
+
module: 'account_data',
|
|
57
|
+
function: 'perm_increase_position',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export function permDecreasePosition(options = {}) {
|
|
61
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
62
|
+
return (tx) => tx.moveCall({
|
|
63
|
+
package: packageAddress,
|
|
64
|
+
module: 'account_data',
|
|
65
|
+
function: 'perm_decrease_position',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export function permPlaceOrder(options = {}) {
|
|
69
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
70
|
+
return (tx) => tx.moveCall({
|
|
71
|
+
package: packageAddress,
|
|
72
|
+
module: 'account_data',
|
|
73
|
+
function: 'perm_place_order',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
export function permCancelOrder(options = {}) {
|
|
77
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
78
|
+
return (tx) => tx.moveCall({
|
|
79
|
+
package: packageAddress,
|
|
80
|
+
module: 'account_data',
|
|
81
|
+
function: 'perm_cancel_order',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export function permDepositCollateral(options = {}) {
|
|
85
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
86
|
+
return (tx) => tx.moveCall({
|
|
87
|
+
package: packageAddress,
|
|
88
|
+
module: 'account_data',
|
|
89
|
+
function: 'perm_deposit_collateral',
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export function permWithdrawCollateral(options = {}) {
|
|
93
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
94
|
+
return (tx) => tx.moveCall({
|
|
95
|
+
package: packageAddress,
|
|
96
|
+
module: 'account_data',
|
|
97
|
+
function: 'perm_withdraw_collateral',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export function permMintWlp(options = {}) {
|
|
101
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
102
|
+
return (tx) => tx.moveCall({
|
|
103
|
+
package: packageAddress,
|
|
104
|
+
module: 'account_data',
|
|
105
|
+
function: 'perm_mint_wlp',
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export function permRedeemWlp(options = {}) {
|
|
109
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
110
|
+
return (tx) => tx.moveCall({
|
|
111
|
+
package: packageAddress,
|
|
112
|
+
module: 'account_data',
|
|
113
|
+
function: 'perm_redeem_wlp',
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export function witness(options = {}) {
|
|
117
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
118
|
+
return (tx) => tx.moveCall({
|
|
119
|
+
package: packageAddress,
|
|
120
|
+
module: 'account_data',
|
|
121
|
+
function: 'witness',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
export function accountPositions(options) {
|
|
125
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
126
|
+
const argumentsTypes = [
|
|
127
|
+
null
|
|
128
|
+
];
|
|
129
|
+
const parameterNames = ["data"];
|
|
130
|
+
return (tx) => tx.moveCall({
|
|
131
|
+
package: packageAddress,
|
|
132
|
+
module: 'account_data',
|
|
133
|
+
function: 'account_positions',
|
|
134
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export function accountOrders(options) {
|
|
138
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
139
|
+
const argumentsTypes = [
|
|
140
|
+
null
|
|
141
|
+
];
|
|
142
|
+
const parameterNames = ["data"];
|
|
143
|
+
return (tx) => tx.moveCall({
|
|
144
|
+
package: packageAddress,
|
|
145
|
+
module: 'account_data',
|
|
146
|
+
function: 'account_orders',
|
|
147
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* True if a `WaterXPerpData` slot exists on the wxa account. The slot is
|
|
152
|
+
* auto-installed on first position/order add — see `ensure_data`.
|
|
153
|
+
*/
|
|
154
|
+
export function hasAccount(options) {
|
|
155
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
156
|
+
const argumentsTypes = [
|
|
157
|
+
null,
|
|
158
|
+
'0x2::object::ID'
|
|
159
|
+
];
|
|
160
|
+
const parameterNames = ["wxaRegistry", "accountId"];
|
|
161
|
+
return (tx) => tx.moveCall({
|
|
162
|
+
package: packageAddress,
|
|
163
|
+
module: 'account_data',
|
|
164
|
+
function: 'has_account',
|
|
165
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/** Borrow the perp data blob (read-only). Aborts if no slot exists. */
|
|
169
|
+
export function borrowAccount(options) {
|
|
170
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
171
|
+
const argumentsTypes = [
|
|
172
|
+
null,
|
|
173
|
+
'0x2::object::ID'
|
|
174
|
+
];
|
|
175
|
+
const parameterNames = ["wxaRegistry", "accountId"];
|
|
176
|
+
return (tx) => tx.moveCall({
|
|
177
|
+
package: packageAddress,
|
|
178
|
+
module: 'account_data',
|
|
179
|
+
function: 'borrow_account',
|
|
180
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* UID-derived address of the wxa account — the value stored on `Position` /
|
|
185
|
+
* `Order` as `account_object_address`. Just `account_id.to_address()`.
|
|
186
|
+
*/
|
|
187
|
+
export function accountObjectAddress(options) {
|
|
188
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
189
|
+
const argumentsTypes = [
|
|
190
|
+
null,
|
|
191
|
+
'0x2::object::ID'
|
|
192
|
+
];
|
|
193
|
+
const parameterNames = ["WxaRegistry", "accountId"];
|
|
194
|
+
return (tx) => tx.moveCall({
|
|
195
|
+
package: packageAddress,
|
|
196
|
+
module: 'account_data',
|
|
197
|
+
function: 'account_object_address',
|
|
198
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
export function addPosition(options) {
|
|
202
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
203
|
+
const argumentsTypes = [
|
|
204
|
+
null,
|
|
205
|
+
'0x2::object::ID',
|
|
206
|
+
'0x2::object::ID',
|
|
207
|
+
'u64'
|
|
208
|
+
];
|
|
209
|
+
const parameterNames = ["wxaRegistry", "accountId", "marketId", "positionId"];
|
|
210
|
+
return (tx) => tx.moveCall({
|
|
211
|
+
package: packageAddress,
|
|
212
|
+
module: 'account_data',
|
|
213
|
+
function: 'add_position',
|
|
214
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
export function removePosition(options) {
|
|
218
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
219
|
+
const argumentsTypes = [
|
|
220
|
+
null,
|
|
221
|
+
'0x2::object::ID',
|
|
222
|
+
'0x2::object::ID',
|
|
223
|
+
'u64'
|
|
224
|
+
];
|
|
225
|
+
const parameterNames = ["wxaRegistry", "accountId", "marketId", "positionId"];
|
|
226
|
+
return (tx) => tx.moveCall({
|
|
227
|
+
package: packageAddress,
|
|
228
|
+
module: 'account_data',
|
|
229
|
+
function: 'remove_position',
|
|
230
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
export function addOrder(options) {
|
|
234
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
235
|
+
const argumentsTypes = [
|
|
236
|
+
null,
|
|
237
|
+
'0x2::object::ID',
|
|
238
|
+
'0x2::object::ID',
|
|
239
|
+
'u64'
|
|
240
|
+
];
|
|
241
|
+
const parameterNames = ["wxaRegistry", "accountId", "marketId", "orderId"];
|
|
242
|
+
return (tx) => tx.moveCall({
|
|
243
|
+
package: packageAddress,
|
|
244
|
+
module: 'account_data',
|
|
245
|
+
function: 'add_order',
|
|
246
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
export function removeOrder(options) {
|
|
250
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
251
|
+
const argumentsTypes = [
|
|
252
|
+
null,
|
|
253
|
+
'0x2::object::ID',
|
|
254
|
+
'0x2::object::ID',
|
|
255
|
+
'u64'
|
|
256
|
+
];
|
|
257
|
+
const parameterNames = ["wxaRegistry", "accountId", "marketId", "orderId"];
|
|
258
|
+
return (tx) => tx.moveCall({
|
|
259
|
+
package: packageAddress,
|
|
260
|
+
module: 'account_data',
|
|
261
|
+
function: 'remove_order',
|
|
262
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Installs an empty `WaterXPerpData` slot on the wxa account if one doesn't
|
|
267
|
+
* already exist. Idempotent. Called from `add_position` / `add_order` so the first
|
|
268
|
+
* trade on an account auto-installs the slot without requiring an explicit
|
|
269
|
+
* `create_account`.
|
|
270
|
+
*/
|
|
271
|
+
export function ensureData(options) {
|
|
272
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
273
|
+
const argumentsTypes = [
|
|
274
|
+
null,
|
|
275
|
+
'0x2::object::ID'
|
|
276
|
+
];
|
|
277
|
+
const parameterNames = ["wxaRegistry", "accountId"];
|
|
278
|
+
return (tx) => tx.moveCall({
|
|
279
|
+
package: packageAddress,
|
|
280
|
+
module: 'account_data',
|
|
281
|
+
function: 'ensure_data',
|
|
282
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
283
|
+
});
|
|
284
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Admin capability for the WaterX Perp protocol. A single AdminCap is minted at
|
|
6
|
+
* deployment and gates all privileged operations across market, lp_pool, referral,
|
|
7
|
+
* and other modules.
|
|
8
|
+
*/
|
|
9
|
+
import { MoveStruct } from '../utils/index.ts';
|
|
10
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
11
|
+
export declare const AdminCap: MoveStruct<{
|
|
12
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
13
|
+
}, "@waterx/perp::admin::AdminCap">;
|
|
14
|
+
export interface InitOptions {
|
|
15
|
+
package?: string;
|
|
16
|
+
arguments?: [
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
export declare function init(options?: InitOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Admin capability for the WaterX Perp protocol. A single AdminCap is minted at
|
|
6
|
+
* deployment and gates all privileged operations across market, lp_pool, referral,
|
|
7
|
+
* and other modules.
|
|
8
|
+
*/
|
|
9
|
+
import { MoveStruct } from "../utils/index.js";
|
|
10
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
11
|
+
const $moduleName = '@waterx/perp::admin';
|
|
12
|
+
export const AdminCap = new MoveStruct({ name: `${$moduleName}::AdminCap`, fields: {
|
|
13
|
+
id: bcs.Address
|
|
14
|
+
} });
|
|
15
|
+
export function init(options = {}) {
|
|
16
|
+
const packageAddress = options.package ?? '@waterx/perp';
|
|
17
|
+
return (tx) => tx.moveCall({
|
|
18
|
+
package: packageAddress,
|
|
19
|
+
module: 'admin',
|
|
20
|
+
function: 'init',
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/** Module for double precision floating points */
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
6
|
+
export declare const Double: MoveStruct<{
|
|
7
|
+
value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
8
|
+
}, "bucket_v2_framework::double::Double">;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/** Module for double precision floating points */
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
7
|
+
const $moduleName = 'bucket_v2_framework::double';
|
|
8
|
+
export const Double = new MoveStruct({ name: `${$moduleName}::Double`, fields: {
|
|
9
|
+
value: bcs.u256()
|
|
10
|
+
} });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/** Module for floating points */
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
6
|
+
export declare const Float: MoveStruct<{
|
|
7
|
+
value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u128">;
|
|
8
|
+
}, "bucket_v2_framework::float::Float">;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/** Module for floating points */
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
7
|
+
const $moduleName = 'bucket_v2_framework::float';
|
|
8
|
+
export const Float = new MoveStruct({ name: `${$moduleName}::Float`, fields: {
|
|
9
|
+
value: bcs.u128()
|
|
10
|
+
} });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/** Module for managing Credit and Debt for DeFi protocol usage */
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
6
|
+
export declare const Credit: MoveStruct<{
|
|
7
|
+
value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
8
|
+
}, "bucket_v2_framework::liability::Credit<phantom T>">;
|
|
9
|
+
export declare const Debt: MoveStruct<{
|
|
10
|
+
value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
11
|
+
}, "bucket_v2_framework::liability::Debt<phantom T>">;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/** Module for managing Credit and Debt for DeFi protocol usage */
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
7
|
+
const $moduleName = 'bucket_v2_framework::liability';
|
|
8
|
+
export const Credit = new MoveStruct({ name: `${$moduleName}::Credit<phantom T>`, fields: {
|
|
9
|
+
value: bcs.u64()
|
|
10
|
+
} });
|
|
11
|
+
export const Debt = new MoveStruct({ name: `${$moduleName}::Debt<phantom T>`, fields: {
|
|
12
|
+
value: bcs.u64()
|
|
13
|
+
} });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
6
|
+
export declare function LinkedTable<K extends BcsType<any>>(...typeParameters: [
|
|
7
|
+
K
|
|
8
|
+
]): MoveStruct<any, any>;
|