@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,414 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Read-only view functions for efficient off-chain data aggregation via
|
|
6
|
+
* devInspect. All functions are pure reads — no state mutation.
|
|
7
|
+
*/
|
|
8
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
9
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
10
|
+
import * as type_name from "./deps/std/type_name.js";
|
|
11
|
+
import * as type_name_1 from "./deps/std/type_name.js";
|
|
12
|
+
import * as type_name_2 from "./deps/std/type_name.js";
|
|
13
|
+
import * as type_name_3 from "./deps/std/type_name.js";
|
|
14
|
+
import * as type_name_4 from "./deps/std/type_name.js";
|
|
15
|
+
import * as type_name_5 from "./deps/std/type_name.js";
|
|
16
|
+
const $moduleName = '@waterx/perp-view::view';
|
|
17
|
+
export const AccountData = new MoveStruct({ name: `${$moduleName}::AccountData`, fields: {
|
|
18
|
+
account_id: bcs.Address,
|
|
19
|
+
account_object_address: bcs.Address
|
|
20
|
+
} });
|
|
21
|
+
export const MarketData = new MoveStruct({ name: `${$moduleName}::MarketData`, fields: {
|
|
22
|
+
market_id: bcs.Address,
|
|
23
|
+
symbol: bcs.string(),
|
|
24
|
+
lp_token: type_name.TypeName,
|
|
25
|
+
is_paused: bcs.bool(),
|
|
26
|
+
long_oi: bcs.u128(),
|
|
27
|
+
short_oi: bcs.u128(),
|
|
28
|
+
long_avg_entry_price: bcs.u128(),
|
|
29
|
+
short_avg_entry_price: bcs.u128(),
|
|
30
|
+
max_long_oi: bcs.u128(),
|
|
31
|
+
max_short_oi: bcs.u128(),
|
|
32
|
+
max_leverage_bps: bcs.u64(),
|
|
33
|
+
trading_fee: bcs.u128(),
|
|
34
|
+
max_impact_fee: bcs.u128(),
|
|
35
|
+
allocated_lp_exposure_bps: bcs.u64(),
|
|
36
|
+
impact_fee_curvature: bcs.u64(),
|
|
37
|
+
impact_fee_scale: bcs.u64(),
|
|
38
|
+
maintenance_margin: bcs.u128(),
|
|
39
|
+
min_coll_value: bcs.u64(),
|
|
40
|
+
cooldown_ms: bcs.u64(),
|
|
41
|
+
basic_funding_rate: bcs.u128(),
|
|
42
|
+
funding_interval_ms: bcs.u64(),
|
|
43
|
+
order_price_tick: bcs.u128(),
|
|
44
|
+
cumulative_funding_sign: bcs.bool(),
|
|
45
|
+
cumulative_funding_index: bcs.u256(),
|
|
46
|
+
last_funding_timestamp: bcs.u64(),
|
|
47
|
+
next_position_id: bcs.u64(),
|
|
48
|
+
next_order_id: bcs.u64()
|
|
49
|
+
} });
|
|
50
|
+
export const PoolData = new MoveStruct({ name: `${$moduleName}::PoolData`, fields: {
|
|
51
|
+
lp_token: type_name_1.TypeName,
|
|
52
|
+
is_active: bcs.bool(),
|
|
53
|
+
lp_decimal: bcs.u8(),
|
|
54
|
+
total_lp_supply: bcs.u64(),
|
|
55
|
+
tvl_usd: bcs.u128(),
|
|
56
|
+
token_count: bcs.u64()
|
|
57
|
+
} });
|
|
58
|
+
export const TokenPoolData = new MoveStruct({ name: `${$moduleName}::TokenPoolData`, fields: {
|
|
59
|
+
token_type: type_name_2.TypeName,
|
|
60
|
+
token_decimal: bcs.u8(),
|
|
61
|
+
liquidity_amount: bcs.u64(),
|
|
62
|
+
reserved_amount: bcs.u64(),
|
|
63
|
+
value_usd: bcs.u128(),
|
|
64
|
+
target_weight_bps: bcs.u64(),
|
|
65
|
+
mint_fee_bps: bcs.u64(),
|
|
66
|
+
burn_fee_bps: bcs.u64(),
|
|
67
|
+
cumulative_borrow_rate: bcs.u128(),
|
|
68
|
+
last_price_refresh_timestamp: bcs.u64()
|
|
69
|
+
} });
|
|
70
|
+
export const RedeemRequestData = new MoveStruct({ name: `${$moduleName}::RedeemRequestData`, fields: {
|
|
71
|
+
request_id: bcs.u64(),
|
|
72
|
+
recipient_account_id: bcs.Address,
|
|
73
|
+
lp_amount: bcs.u64(),
|
|
74
|
+
token_type: type_name_3.TypeName,
|
|
75
|
+
request_timestamp: bcs.u64()
|
|
76
|
+
} });
|
|
77
|
+
export const GlobalConfigData = new MoveStruct({ name: `${$moduleName}::GlobalConfigData`, fields: {
|
|
78
|
+
allowed_versions: bcs.vector(bcs.u16()),
|
|
79
|
+
keeper_addresses: bcs.vector(bcs.Address),
|
|
80
|
+
redeem_operator_addresses: bcs.vector(bcs.Address),
|
|
81
|
+
protocol_fee_share_bps: bcs.u64(),
|
|
82
|
+
liquidator_fee_bps: bcs.u64(),
|
|
83
|
+
insurance_fee_bps: bcs.u64(),
|
|
84
|
+
max_skipped_orders_per_match: bcs.u64(),
|
|
85
|
+
oi_cap_bps: bcs.u64(),
|
|
86
|
+
price_refresh_threshold_ms: bcs.u64()
|
|
87
|
+
} });
|
|
88
|
+
export const PositionData = new MoveStruct({ name: `${$moduleName}::PositionData`, fields: {
|
|
89
|
+
position_id: bcs.u64(),
|
|
90
|
+
account_object_address: bcs.Address,
|
|
91
|
+
market_id: bcs.Address,
|
|
92
|
+
is_long: bcs.bool(),
|
|
93
|
+
size: bcs.u128(),
|
|
94
|
+
collateral_type: type_name_4.TypeName,
|
|
95
|
+
collateral_amount: bcs.u64(),
|
|
96
|
+
collateral_decimal: bcs.u8(),
|
|
97
|
+
average_price: bcs.u128(),
|
|
98
|
+
oracle_price: bcs.u128(),
|
|
99
|
+
collateral_price: bcs.u128(),
|
|
100
|
+
est_liq_price: bcs.u128(),
|
|
101
|
+
leverage_bps: bcs.u64(),
|
|
102
|
+
entry_borrow_index: bcs.u128(),
|
|
103
|
+
entry_funding_sign: bcs.bool(),
|
|
104
|
+
entry_funding_index: bcs.u256(),
|
|
105
|
+
unrealized_trading_fee: bcs.u64(),
|
|
106
|
+
unrealized_borrow_fee: bcs.u64(),
|
|
107
|
+
unrealized_funding_fee: bcs.u64(),
|
|
108
|
+
unrealized_funding_sign: bcs.bool(),
|
|
109
|
+
pnl_positive: bcs.bool(),
|
|
110
|
+
pnl: bcs.u64(),
|
|
111
|
+
funding_fee_positive: bcs.bool(),
|
|
112
|
+
funding_fee: bcs.u64(),
|
|
113
|
+
borrow_fee: bcs.u64(),
|
|
114
|
+
close_fee: bcs.u64(),
|
|
115
|
+
linked_order_ids: bcs.vector(bcs.u64()),
|
|
116
|
+
linked_order_price_keys: bcs.vector(bcs.u128()),
|
|
117
|
+
create_timestamp: bcs.u64(),
|
|
118
|
+
update_timestamp: bcs.u64()
|
|
119
|
+
} });
|
|
120
|
+
export const OrderData = new MoveStruct({ name: `${$moduleName}::OrderData`, fields: {
|
|
121
|
+
order_id: bcs.u64(),
|
|
122
|
+
account_object_address: bcs.Address,
|
|
123
|
+
market_id: bcs.Address,
|
|
124
|
+
is_long: bcs.bool(),
|
|
125
|
+
reduce_only: bcs.bool(),
|
|
126
|
+
is_stop_order: bcs.bool(),
|
|
127
|
+
size: bcs.u128(),
|
|
128
|
+
collateral_type: type_name_5.TypeName,
|
|
129
|
+
collateral_amount: bcs.u64(),
|
|
130
|
+
collateral_decimal: bcs.u8(),
|
|
131
|
+
trigger_price: bcs.u128(),
|
|
132
|
+
oracle_price: bcs.u128(),
|
|
133
|
+
order_type_tag: bcs.u8(),
|
|
134
|
+
has_linked_position: bcs.bool(),
|
|
135
|
+
linked_position_id: bcs.u64(),
|
|
136
|
+
leverage_bps: bcs.u64(),
|
|
137
|
+
create_timestamp: bcs.u64()
|
|
138
|
+
} });
|
|
139
|
+
/**
|
|
140
|
+
* Get the perp-side snapshot for a single account, looked up by its
|
|
141
|
+
* `waterx_account::Account` ID. Returns `none` if no `WaterXPerpData` slot is
|
|
142
|
+
* installed on that account. Owner / delegate metadata is queryable on
|
|
143
|
+
* `waterx_account::AccountRegistry` separately.
|
|
144
|
+
*/
|
|
145
|
+
export function accountData(options) {
|
|
146
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
147
|
+
const argumentsTypes = [
|
|
148
|
+
null,
|
|
149
|
+
'0x2::object::ID'
|
|
150
|
+
];
|
|
151
|
+
const parameterNames = ["wxaRegistry", "accountId"];
|
|
152
|
+
return (tx) => tx.moveCall({
|
|
153
|
+
package: packageAddress,
|
|
154
|
+
module: 'view',
|
|
155
|
+
function: 'account_data',
|
|
156
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/** Get market config + state from a Market object. */
|
|
160
|
+
export function marketData(options) {
|
|
161
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
162
|
+
const argumentsTypes = [
|
|
163
|
+
null,
|
|
164
|
+
'0x1::string::String'
|
|
165
|
+
];
|
|
166
|
+
const parameterNames = ["marketRegistry", "ticker"];
|
|
167
|
+
return (tx) => tx.moveCall({
|
|
168
|
+
package: packageAddress,
|
|
169
|
+
module: 'view',
|
|
170
|
+
function: 'market_data',
|
|
171
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
172
|
+
typeArguments: options.typeArguments
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/** Get protocol-wide config snapshot. */
|
|
176
|
+
export function globalConfigData(options) {
|
|
177
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
178
|
+
const argumentsTypes = [
|
|
179
|
+
null
|
|
180
|
+
];
|
|
181
|
+
const parameterNames = ["cfg"];
|
|
182
|
+
return (tx) => tx.moveCall({
|
|
183
|
+
package: packageAddress,
|
|
184
|
+
module: 'view',
|
|
185
|
+
function: 'global_config_data',
|
|
186
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/** Get pool data. */
|
|
190
|
+
export function poolData(options) {
|
|
191
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
192
|
+
const argumentsTypes = [
|
|
193
|
+
null
|
|
194
|
+
];
|
|
195
|
+
const parameterNames = ["pool"];
|
|
196
|
+
return (tx) => tx.moveCall({
|
|
197
|
+
package: packageAddress,
|
|
198
|
+
module: 'view',
|
|
199
|
+
function: 'pool_data',
|
|
200
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
201
|
+
typeArguments: options.typeArguments
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/** Get token pool data by index. */
|
|
205
|
+
export function tokenPoolData(options) {
|
|
206
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
207
|
+
const argumentsTypes = [
|
|
208
|
+
null,
|
|
209
|
+
'u64'
|
|
210
|
+
];
|
|
211
|
+
const parameterNames = ["pool", "tokenIndex"];
|
|
212
|
+
return (tx) => tx.moveCall({
|
|
213
|
+
package: packageAddress,
|
|
214
|
+
module: 'view',
|
|
215
|
+
function: 'token_pool_data',
|
|
216
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
217
|
+
typeArguments: options.typeArguments
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/** Get all token pools in a WLP pool as a vector. */
|
|
221
|
+
export function tokenPoolsData(options) {
|
|
222
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
223
|
+
const argumentsTypes = [
|
|
224
|
+
null
|
|
225
|
+
];
|
|
226
|
+
const parameterNames = ["pool"];
|
|
227
|
+
return (tx) => tx.moveCall({
|
|
228
|
+
package: packageAddress,
|
|
229
|
+
module: 'view',
|
|
230
|
+
function: 'token_pools_data',
|
|
231
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
232
|
+
typeArguments: options.typeArguments
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
/** Check if a position exists. */
|
|
236
|
+
export function positionExists(options) {
|
|
237
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
238
|
+
const argumentsTypes = [
|
|
239
|
+
null,
|
|
240
|
+
'0x1::string::String',
|
|
241
|
+
'u64'
|
|
242
|
+
];
|
|
243
|
+
const parameterNames = ["marketRegistry", "ticker", "positionId"];
|
|
244
|
+
return (tx) => tx.moveCall({
|
|
245
|
+
package: packageAddress,
|
|
246
|
+
module: 'view',
|
|
247
|
+
function: 'position_exists',
|
|
248
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
249
|
+
typeArguments: options.typeArguments
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Enriched position data with computed PnL, fees, leverage, and estimated liq
|
|
254
|
+
* price. Prices are `u64` USD values (e.g. 50000 for $50k) — converted to Float
|
|
255
|
+
* internally.
|
|
256
|
+
*/
|
|
257
|
+
export function positionData(options) {
|
|
258
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
259
|
+
const argumentsTypes = [
|
|
260
|
+
null,
|
|
261
|
+
'0x1::string::String',
|
|
262
|
+
null,
|
|
263
|
+
'u64',
|
|
264
|
+
'u64',
|
|
265
|
+
'u64'
|
|
266
|
+
];
|
|
267
|
+
const parameterNames = ["marketRegistry", "ticker", "pool", "basePriceUsd", "collateralPriceUsd", "positionId"];
|
|
268
|
+
return (tx) => tx.moveCall({
|
|
269
|
+
package: packageAddress,
|
|
270
|
+
module: 'view',
|
|
271
|
+
function: 'position_data',
|
|
272
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
273
|
+
typeArguments: options.typeArguments
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Enriched order data with current oracle price. Caller provides order location:
|
|
278
|
+
* `order_type_tag` (0-3), `trigger_price` (raw scaled value), `order_id`.
|
|
279
|
+
*/
|
|
280
|
+
export function orderData(options) {
|
|
281
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
282
|
+
const argumentsTypes = [
|
|
283
|
+
null,
|
|
284
|
+
'0x1::string::String',
|
|
285
|
+
'u64',
|
|
286
|
+
'u8',
|
|
287
|
+
'u128',
|
|
288
|
+
'u64'
|
|
289
|
+
];
|
|
290
|
+
const parameterNames = ["marketRegistry", "ticker", "basePriceUsd", "orderTypeTag", "triggerPrice", "orderId"];
|
|
291
|
+
return (tx) => tx.moveCall({
|
|
292
|
+
package: packageAddress,
|
|
293
|
+
module: 'view',
|
|
294
|
+
function: 'order_data',
|
|
295
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
296
|
+
typeArguments: options.typeArguments
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get all positions for an account in a specific market, returned as enriched
|
|
301
|
+
* PositionData. Prices are `u64` USD values (e.g. 50000 for $50k).
|
|
302
|
+
*/
|
|
303
|
+
export function getAccountPositions(options) {
|
|
304
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
305
|
+
const argumentsTypes = [
|
|
306
|
+
null,
|
|
307
|
+
'0x1::string::String',
|
|
308
|
+
null,
|
|
309
|
+
null,
|
|
310
|
+
'u64',
|
|
311
|
+
'u64',
|
|
312
|
+
'address'
|
|
313
|
+
];
|
|
314
|
+
const parameterNames = ["marketRegistry", "ticker", "pool", "wxaRegistry", "basePriceUsd", "collateralPriceUsd", "accountObjectAddress"];
|
|
315
|
+
return (tx) => tx.moveCall({
|
|
316
|
+
package: packageAddress,
|
|
317
|
+
module: 'view',
|
|
318
|
+
function: 'get_account_positions',
|
|
319
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
320
|
+
typeArguments: options.typeArguments
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Get all orders for an account in a specific market by scanning all 4 order maps.
|
|
325
|
+
* `base_price_usd` is a `u64` USD value (e.g. 50000 for $50k).
|
|
326
|
+
*/
|
|
327
|
+
export function getAccountOrders(options) {
|
|
328
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
329
|
+
const argumentsTypes = [
|
|
330
|
+
null,
|
|
331
|
+
'0x1::string::String',
|
|
332
|
+
'u64',
|
|
333
|
+
'address'
|
|
334
|
+
];
|
|
335
|
+
const parameterNames = ["marketRegistry", "ticker", "basePriceUsd", "accountObjectAddress"];
|
|
336
|
+
return (tx) => tx.moveCall({
|
|
337
|
+
package: packageAddress,
|
|
338
|
+
module: 'view',
|
|
339
|
+
function: 'get_account_orders',
|
|
340
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
341
|
+
typeArguments: options.typeArguments
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Paginated list of all orders across all 4 order maps in a market. Cursor is an
|
|
346
|
+
* opaque flat index across (tag, price_level, order_index). Returns
|
|
347
|
+
* `(orders, next_cursor)` where `next_cursor` is `some(idx)` if more pages exist.
|
|
348
|
+
*/
|
|
349
|
+
export function getMarketOrders(options) {
|
|
350
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
351
|
+
const argumentsTypes = [
|
|
352
|
+
null,
|
|
353
|
+
'0x1::string::String',
|
|
354
|
+
'u64',
|
|
355
|
+
'u64',
|
|
356
|
+
'u64'
|
|
357
|
+
];
|
|
358
|
+
const parameterNames = ["marketRegistry", "ticker", "basePriceUsd", "cursor", "pageSize"];
|
|
359
|
+
return (tx) => tx.moveCall({
|
|
360
|
+
package: packageAddress,
|
|
361
|
+
module: 'view',
|
|
362
|
+
function: 'get_market_orders',
|
|
363
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
364
|
+
typeArguments: options.typeArguments
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Paginated list of all positions in a market, returned as enriched PositionData.
|
|
369
|
+
* `cursor`: starting index (0-based). `page_size`: max entries to return. Returns
|
|
370
|
+
* `(positions, next_cursor)` where `next_cursor` is `some(idx)` if more pages
|
|
371
|
+
* exist.
|
|
372
|
+
*/
|
|
373
|
+
export function getMarketPositions(options) {
|
|
374
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
375
|
+
const argumentsTypes = [
|
|
376
|
+
null,
|
|
377
|
+
'0x1::string::String',
|
|
378
|
+
null,
|
|
379
|
+
'u64',
|
|
380
|
+
'u64',
|
|
381
|
+
'u64',
|
|
382
|
+
'u64'
|
|
383
|
+
];
|
|
384
|
+
const parameterNames = ["marketRegistry", "ticker", "pool", "basePriceUsd", "collateralPriceUsd", "cursor", "pageSize"];
|
|
385
|
+
return (tx) => tx.moveCall({
|
|
386
|
+
package: packageAddress,
|
|
387
|
+
module: 'view',
|
|
388
|
+
function: 'get_market_positions',
|
|
389
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
390
|
+
typeArguments: options.typeArguments
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Paginated list of all pending redeem requests in a WLP pool. `cursor`: starting
|
|
395
|
+
* index (0-based). `page_size`: max entries to return. Returns
|
|
396
|
+
* `(requests, next_cursor)` where `next_cursor` is `some(idx)` if more pages
|
|
397
|
+
* exist.
|
|
398
|
+
*/
|
|
399
|
+
export function getRedeemRequests(options) {
|
|
400
|
+
const packageAddress = options.package ?? '@waterx/perp-view';
|
|
401
|
+
const argumentsTypes = [
|
|
402
|
+
null,
|
|
403
|
+
'u64',
|
|
404
|
+
'u64'
|
|
405
|
+
];
|
|
406
|
+
const parameterNames = ["pool", "cursor", "pageSize"];
|
|
407
|
+
return (tx) => tx.moveCall({
|
|
408
|
+
package: packageAddress,
|
|
409
|
+
module: 'view',
|
|
410
|
+
function: 'get_redeem_requests',
|
|
411
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
412
|
+
typeArguments: options.typeArguments
|
|
413
|
+
});
|
|
414
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
/** An entry in the map */
|
|
7
|
+
export declare function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
8
|
+
K,
|
|
9
|
+
V
|
|
10
|
+
]): MoveStruct<{
|
|
11
|
+
key: K;
|
|
12
|
+
value: V;
|
|
13
|
+
}, `0x2::vec_map::Entry<${K["name"]}, ${V["name"]}>`>;
|
|
14
|
+
/**
|
|
15
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
16
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
17
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
18
|
+
* of this data structure is only to provide the convenience of programming against
|
|
19
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
20
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
21
|
+
* also be handwritten.
|
|
22
|
+
*/
|
|
23
|
+
export declare function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
24
|
+
K,
|
|
25
|
+
V
|
|
26
|
+
]): MoveStruct<{
|
|
27
|
+
contents: BcsType<{
|
|
28
|
+
key: K extends BcsType<infer U, any, string> ? U : never;
|
|
29
|
+
value: V extends BcsType<infer U, any, string> ? U : never;
|
|
30
|
+
}[], Iterable<{
|
|
31
|
+
key: K extends BcsType<any, infer U_1, string> ? U_1 : never;
|
|
32
|
+
value: V extends BcsType<any, infer U_1, string> ? U_1 : never;
|
|
33
|
+
}> & {
|
|
34
|
+
length: number;
|
|
35
|
+
}, string>;
|
|
36
|
+
}, `0x2::vec_map::VecMap<${K["name"]}, ${V["name"]}>`>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
|
+
const $moduleName = '0x2::vec_map';
|
|
7
|
+
/** An entry in the map */
|
|
8
|
+
export function Entry(...typeParameters) {
|
|
9
|
+
return new MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
|
|
10
|
+
key: typeParameters[0],
|
|
11
|
+
value: typeParameters[1]
|
|
12
|
+
} });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
16
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
17
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
18
|
+
* of this data structure is only to provide the convenience of programming against
|
|
19
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
20
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
21
|
+
* also be handwritten.
|
|
22
|
+
*/
|
|
23
|
+
export function VecMap(...typeParameters) {
|
|
24
|
+
return new MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
|
|
25
|
+
contents: bcs.vector(Entry(typeParameters[0], typeParameters[1]))
|
|
26
|
+
} });
|
|
27
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
|
|
5
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
6
|
+
export declare const PythRule: MoveStruct<{
|
|
7
|
+
dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
|
|
8
|
+
}, "@waterx/pyth-rule::pyth_rule::PythRule">;
|
|
9
|
+
export declare const Config: MoveStruct<{
|
|
10
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
11
|
+
/** Ticker (e.g. `b"BTC_USD".to_string()`) → Pyth feed identifier bytes. */
|
|
12
|
+
identifier_map: MoveStruct<{
|
|
13
|
+
contents: import("@mysten/sui/bcs").BcsType<{
|
|
14
|
+
key: string;
|
|
15
|
+
value: number[];
|
|
16
|
+
}[], Iterable<{
|
|
17
|
+
key: string;
|
|
18
|
+
value: Iterable<number> & {
|
|
19
|
+
length: number;
|
|
20
|
+
};
|
|
21
|
+
}> & {
|
|
22
|
+
length: number;
|
|
23
|
+
}, string>;
|
|
24
|
+
}, "0x2::vec_map::VecMap<string, vector<u8>>">;
|
|
25
|
+
/** Per-ticker timestamp tolerance in seconds. Falls back to DEFAULT_TOLERANCE_SEC. */
|
|
26
|
+
tolerance_sec_map: MoveStruct<{
|
|
27
|
+
contents: import("@mysten/sui/bcs").BcsType<{
|
|
28
|
+
key: string;
|
|
29
|
+
value: string;
|
|
30
|
+
}[], Iterable<{
|
|
31
|
+
key: string;
|
|
32
|
+
value: string | number | bigint;
|
|
33
|
+
}> & {
|
|
34
|
+
length: number;
|
|
35
|
+
}, string>;
|
|
36
|
+
}, "0x2::vec_map::VecMap<string, u64>">;
|
|
37
|
+
}, "@waterx/pyth-rule::pyth_rule::Config">;
|
|
38
|
+
export interface FeedArguments {
|
|
39
|
+
collector: RawTransactionArgument<string>;
|
|
40
|
+
config: RawTransactionArgument<string>;
|
|
41
|
+
pythState: RawTransactionArgument<string>;
|
|
42
|
+
pythPriceInfo: RawTransactionArgument<string>;
|
|
43
|
+
}
|
|
44
|
+
export interface FeedOptions {
|
|
45
|
+
package?: string;
|
|
46
|
+
arguments: FeedArguments | [
|
|
47
|
+
collector: RawTransactionArgument<string>,
|
|
48
|
+
config: RawTransactionArgument<string>,
|
|
49
|
+
pythState: RawTransactionArgument<string>,
|
|
50
|
+
pythPriceInfo: RawTransactionArgument<string>
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reads a Pyth price for `collector.symbol()` and feeds it. Drops the value
|
|
55
|
+
* (records `none`) if the on-chain timestamp diverges from the Pyth feed timestamp
|
|
56
|
+
* by more than the configured tolerance.
|
|
57
|
+
*/
|
|
58
|
+
export declare function feed(options: FeedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
59
|
+
export interface SetIdentifierArguments {
|
|
60
|
+
config: RawTransactionArgument<string>;
|
|
61
|
+
Cap: RawTransactionArgument<string>;
|
|
62
|
+
symbol: RawTransactionArgument<string>;
|
|
63
|
+
identifier: RawTransactionArgument<number[]>;
|
|
64
|
+
}
|
|
65
|
+
export interface SetIdentifierOptions {
|
|
66
|
+
package?: string;
|
|
67
|
+
arguments: SetIdentifierArguments | [
|
|
68
|
+
config: RawTransactionArgument<string>,
|
|
69
|
+
Cap: RawTransactionArgument<string>,
|
|
70
|
+
symbol: RawTransactionArgument<string>,
|
|
71
|
+
identifier: RawTransactionArgument<number[]>
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
export declare function setIdentifier(options: SetIdentifierOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
75
|
+
export interface SetToleranceSecArguments {
|
|
76
|
+
config: RawTransactionArgument<string>;
|
|
77
|
+
Cap: RawTransactionArgument<string>;
|
|
78
|
+
symbol: RawTransactionArgument<string>;
|
|
79
|
+
toleranceSec: RawTransactionArgument<number | bigint>;
|
|
80
|
+
}
|
|
81
|
+
export interface SetToleranceSecOptions {
|
|
82
|
+
package?: string;
|
|
83
|
+
arguments: SetToleranceSecArguments | [
|
|
84
|
+
config: RawTransactionArgument<string>,
|
|
85
|
+
Cap: RawTransactionArgument<string>,
|
|
86
|
+
symbol: RawTransactionArgument<string>,
|
|
87
|
+
toleranceSec: RawTransactionArgument<number | bigint>
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
export declare function setToleranceSec(options: SetToleranceSecOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
import * as vec_map from "./deps/sui/vec_map.js";
|
|
7
|
+
import * as vec_map_1 from "./deps/sui/vec_map.js";
|
|
8
|
+
const $moduleName = '@waterx/pyth-rule::pyth_rule';
|
|
9
|
+
export const PythRule = new MoveStruct({ name: `${$moduleName}::PythRule`, fields: {
|
|
10
|
+
dummy_field: bcs.bool()
|
|
11
|
+
} });
|
|
12
|
+
export const Config = new MoveStruct({ name: `${$moduleName}::Config`, fields: {
|
|
13
|
+
id: bcs.Address,
|
|
14
|
+
/** Ticker (e.g. `b"BTC_USD".to_string()`) → Pyth feed identifier bytes. */
|
|
15
|
+
identifier_map: vec_map.VecMap(bcs.string(), bcs.vector(bcs.u8())),
|
|
16
|
+
/** Per-ticker timestamp tolerance in seconds. Falls back to DEFAULT_TOLERANCE_SEC. */
|
|
17
|
+
tolerance_sec_map: vec_map_1.VecMap(bcs.string(), bcs.u64())
|
|
18
|
+
} });
|
|
19
|
+
/**
|
|
20
|
+
* Reads a Pyth price for `collector.symbol()` and feeds it. Drops the value
|
|
21
|
+
* (records `none`) if the on-chain timestamp diverges from the Pyth feed timestamp
|
|
22
|
+
* by more than the configured tolerance.
|
|
23
|
+
*/
|
|
24
|
+
export function feed(options) {
|
|
25
|
+
const packageAddress = options.package ?? '@waterx/pyth-rule';
|
|
26
|
+
const argumentsTypes = [
|
|
27
|
+
null,
|
|
28
|
+
null,
|
|
29
|
+
'0x2::clock::Clock',
|
|
30
|
+
null,
|
|
31
|
+
null
|
|
32
|
+
];
|
|
33
|
+
const parameterNames = ["collector", "config", "pythState", "pythPriceInfo"];
|
|
34
|
+
return (tx) => tx.moveCall({
|
|
35
|
+
package: packageAddress,
|
|
36
|
+
module: 'pyth_rule',
|
|
37
|
+
function: 'feed',
|
|
38
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export function setIdentifier(options) {
|
|
42
|
+
const packageAddress = options.package ?? '@waterx/pyth-rule';
|
|
43
|
+
const argumentsTypes = [
|
|
44
|
+
null,
|
|
45
|
+
null,
|
|
46
|
+
'0x1::string::String',
|
|
47
|
+
'vector<u8>'
|
|
48
|
+
];
|
|
49
|
+
const parameterNames = ["config", "Cap", "symbol", "identifier"];
|
|
50
|
+
return (tx) => tx.moveCall({
|
|
51
|
+
package: packageAddress,
|
|
52
|
+
module: 'pyth_rule',
|
|
53
|
+
function: 'set_identifier',
|
|
54
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export function setToleranceSec(options) {
|
|
58
|
+
const packageAddress = options.package ?? '@waterx/pyth-rule';
|
|
59
|
+
const argumentsTypes = [
|
|
60
|
+
null,
|
|
61
|
+
null,
|
|
62
|
+
'0x1::string::String',
|
|
63
|
+
'u64'
|
|
64
|
+
];
|
|
65
|
+
const parameterNames = ["config", "Cap", "symbol", "toleranceSec"];
|
|
66
|
+
return (tx) => tx.moveCall({
|
|
67
|
+
package: packageAddress,
|
|
68
|
+
module: 'pyth_rule',
|
|
69
|
+
function: 'set_tolerance_sec',
|
|
70
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* A table is a map-like collection. But unlike a traditional collection, it's keys
|
|
6
|
+
* and values are not stored within the `Table` value, but instead are stored using
|
|
7
|
+
* Sui's object system. The `Table` struct acts only as a handle into the object
|
|
8
|
+
* system to retrieve those keys and values. Note that this means that `Table`
|
|
9
|
+
* values with exactly the same key-value mapping will not be equal, with `==`, at
|
|
10
|
+
* runtime. For example
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* let table1 = table::new<u64, bool>();
|
|
14
|
+
* let table2 = table::new<u64, bool>();
|
|
15
|
+
* table::add(&mut table1, 0, false);
|
|
16
|
+
* table::add(&mut table1, 1, true);
|
|
17
|
+
* table::add(&mut table2, 0, false);
|
|
18
|
+
* table::add(&mut table2, 1, true);
|
|
19
|
+
* // table1 does not equal table2, despite having the same entries
|
|
20
|
+
* assert!(&table1 != &table2);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
24
|
+
export declare const Table: MoveStruct<{
|
|
25
|
+
/** the ID of this table */
|
|
26
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
27
|
+
/** the number of key-value pairs in the table */
|
|
28
|
+
size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
29
|
+
}, "0x2::table::Table<phantom K, phantom V>">;
|