@waterx/sdk 2.1.0 → 2.4.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/README.md +75 -169
- package/dist/src/client.d.ts +40 -2
- package/dist/src/client.js +55 -6
- package/dist/src/config.d.ts +66 -3
- package/dist/src/config.js +10 -4
- package/dist/src/constants.d.ts +6 -0
- package/dist/src/constants.js +6 -0
- package/dist/src/core/waterx-account.d.ts +31 -0
- package/dist/src/core/waterx-account.js +26 -0
- package/dist/src/fetch.d.ts +110 -0
- package/dist/src/fetch.js +149 -4
- package/dist/src/generated/bucket_v2_framework/account.d.ts +5 -5
- package/dist/src/generated/bucket_v2_framework/double.d.ts +77 -77
- package/dist/src/generated/bucket_v2_framework/float.d.ts +73 -73
- package/dist/src/generated/bucket_v2_framework/liability.d.ts +33 -33
- package/dist/src/generated/bucket_v2_framework/linked_table.d.ts +5 -5
- package/dist/src/generated/bucket_v2_framework/linked_table.js +2 -2
- package/dist/src/generated/bucket_v2_framework/sheet.d.ts +57 -57
- package/dist/src/generated/bucket_v2_framework/sheet.js +5 -11
- package/dist/src/generated/native_custody/custody_vault.d.ts +46 -32
- package/dist/src/generated/native_custody/custody_vault.js +19 -10
- package/dist/src/generated/native_custody/deps/bucket_v2_framework/sheet.js +1 -3
- package/dist/src/generated/native_custody/events.js +1 -2
- package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +7 -7
- package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +1 -2
- package/dist/src/generated/utils/index.d.ts +7 -7
- package/dist/src/generated/utils/index.js +9 -6
- package/dist/src/generated/waterx_account/account.d.ts +124 -71
- package/dist/src/generated/waterx_account/account.js +64 -29
- package/dist/src/generated/waterx_account/deps/bucket_v2_framework/sheet.js +1 -3
- package/dist/src/generated/waterx_account/direct_rule.d.ts +5 -5
- package/dist/src/generated/waterx_account/events.d.ts +10 -0
- package/dist/src/generated/waterx_account/events.js +31 -50
- package/dist/src/generated/waterx_constant_rule/constant_rule.d.ts +68 -0
- package/dist/src/generated/waterx_constant_rule/constant_rule.js +59 -0
- package/dist/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.js +10 -0
- package/dist/src/generated/waterx_constant_rule/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_constant_rule/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_credit/credit_registry.d.ts +9 -9
- package/dist/src/generated/waterx_credit/credit_registry.js +1 -2
- package/dist/src/generated/waterx_credit/limited_supply.d.ts +17 -17
- package/dist/src/generated/waterx_oracle/aggregator.js +1 -2
- package/dist/src/generated/waterx_oracle/collector.d.ts +17 -17
- package/dist/src/generated/waterx_oracle/collector.js +1 -1
- package/dist/src/generated/waterx_oracle/oracle.d.ts +5 -5
- package/dist/src/generated/waterx_perp/account_data.d.ts +5 -5
- package/dist/src/generated/waterx_perp/account_data.js +1 -2
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.js +1 -3
- package/dist/src/generated/waterx_perp/events.d.ts +181 -181
- package/dist/src/generated/waterx_perp/events.js +87 -173
- package/dist/src/generated/waterx_perp/global_config.d.ts +3 -3
- package/dist/src/generated/waterx_perp/global_config.js +6 -12
- package/dist/src/generated/waterx_perp/keyed_big_vector.d.ts +9 -9
- package/dist/src/generated/waterx_perp/keyed_big_vector.js +1 -2
- package/dist/src/generated/waterx_perp/lp_pool.d.ts +115 -115
- package/dist/src/generated/waterx_perp/lp_pool.js +11 -22
- package/dist/src/generated/waterx_perp/market_config.d.ts +61 -43
- package/dist/src/generated/waterx_perp/market_config.js +29 -22
- package/dist/src/generated/waterx_perp/math.d.ts +7 -7
- package/dist/src/generated/waterx_perp/order_book.d.ts +47 -47
- package/dist/src/generated/waterx_perp/position.d.ts +99 -99
- package/dist/src/generated/waterx_perp/position.js +6 -12
- package/dist/src/generated/waterx_perp/request.d.ts +67 -67
- package/dist/src/generated/waterx_perp/request.js +2 -3
- package/dist/src/generated/waterx_perp/response.d.ts +35 -35
- package/dist/src/generated/waterx_perp/response.js +1 -2
- package/dist/src/generated/waterx_perp/trading.d.ts +303 -179
- package/dist/src/generated/waterx_perp/trading.js +99 -14
- package/dist/src/generated/waterx_perp_view/view.js +5 -10
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +5 -5
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +1 -2
- package/dist/src/generated/waterx_referral/referral_table.d.ts +5 -5
- package/dist/src/generated/waterx_referral/referral_table.js +1 -2
- package/dist/src/generated/waterx_staking/waterx_staking.d.ts +19 -19
- package/dist/src/generated/waterx_staking/waterx_staking.js +10 -20
- package/dist/src/generated/waterx_supra_rule/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_supra_rule/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_supra_rule/supra_rule.d.ts +158 -0
- package/dist/src/generated/waterx_supra_rule/supra_rule.js +148 -0
- package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.js +10 -0
- package/dist/src/generated/withdrawal_queue/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/withdrawal_queue/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +444 -4
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +417 -4
- package/dist/src/generated/wormhole_bridge/wormhole_bridge.d.ts +214 -74
- package/dist/src/generated/wormhole_bridge/wormhole_bridge.js +158 -29
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.js +3 -2
- package/dist/src/prediction/account.d.ts +96 -0
- package/dist/src/prediction/account.js +230 -0
- package/dist/src/prediction/admin.d.ts +47 -0
- package/dist/src/prediction/admin.js +105 -0
- package/dist/src/prediction/bcs.d.ts +22 -0
- package/dist/src/prediction/bcs.js +240 -0
- package/dist/src/prediction/client.d.ts +75 -0
- package/dist/src/prediction/client.js +164 -0
- package/dist/src/prediction/config.d.ts +60 -0
- package/dist/src/prediction/config.js +75 -0
- package/dist/src/prediction/constants.d.ts +44 -0
- package/dist/src/prediction/constants.js +46 -0
- package/dist/src/prediction/fetch.d.ts +82 -0
- package/dist/src/prediction/fetch.js +270 -0
- package/dist/src/prediction/generated/bucket_v2_framework/account.d.ts +100 -0
- package/dist/src/prediction/generated/bucket_v2_framework/account.js +129 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.d.ts +6 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.js +19 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.d.ts +10 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.js +14 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.js +27 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_set.js +19 -0
- package/dist/src/prediction/generated/bucket_v2_framework/double.d.ts +382 -0
- package/dist/src/prediction/generated/bucket_v2_framework/double.js +466 -0
- package/dist/src/prediction/generated/bucket_v2_framework/float.d.ts +362 -0
- package/dist/src/prediction/generated/bucket_v2_framework/float.js +440 -0
- package/dist/src/prediction/generated/bucket_v2_framework/liability.d.ts +193 -0
- package/dist/src/prediction/generated/bucket_v2_framework/liability.js +205 -0
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.d.ts +384 -0
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.js +382 -0
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.d.ts +344 -0
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.js +338 -0
- package/dist/src/prediction/generated/utils/index.d.ts +30 -0
- package/dist/src/prediction/generated/utils/index.js +160 -0
- package/dist/src/prediction/generated/waterx_account/account.d.ts +1589 -0
- package/dist/src/prediction/generated/waterx_account/account.js +1758 -0
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +7 -0
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.js +13 -0
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +7 -0
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.js +16 -0
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.d.ts +6 -0
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.js +19 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.d.ts +10 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.js +14 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.d.ts +12 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.js +19 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/table.d.ts +24 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/table.js +31 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.js +27 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.js +19 -0
- package/dist/src/prediction/generated/waterx_account/direct_rule.d.ts +75 -0
- package/dist/src/prediction/generated/waterx_account/direct_rule.js +78 -0
- package/dist/src/prediction/generated/waterx_account/events.d.ts +33 -0
- package/dist/src/prediction/generated/waterx_account/events.js +137 -0
- package/dist/src/prediction/generated/waterx_account/version.d.ts +10 -0
- package/dist/src/prediction/generated/waterx_account/version.js +8 -0
- package/dist/src/prediction/generated/waterx_prediction/account_data.d.ts +327 -0
- package/dist/src/prediction/generated/waterx_prediction/account_data.js +405 -0
- package/dist/src/prediction/generated/waterx_prediction/admin.d.ts +5 -0
- package/dist/src/prediction/generated/waterx_prediction/admin.js +9 -0
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.d.ts +60 -0
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.js +83 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +8 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.js +18 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.d.ts +10 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.js +14 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.d.ts +24 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.js +31 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.js +19 -0
- package/dist/src/prediction/generated/waterx_prediction/events.d.ts +22 -0
- package/dist/src/prediction/generated/waterx_prediction/events.js +179 -0
- package/dist/src/prediction/generated/waterx_prediction/global_config.d.ts +116 -0
- package/dist/src/prediction/generated/waterx_prediction/global_config.js +141 -0
- package/dist/src/prediction/generated/waterx_prediction/order.d.ts +200 -0
- package/dist/src/prediction/generated/waterx_prediction/order.js +284 -0
- package/dist/src/prediction/generated/waterx_prediction/outcome.d.ts +58 -0
- package/dist/src/prediction/generated/waterx_prediction/outcome.js +73 -0
- package/dist/src/prediction/generated/waterx_prediction/position.d.ts +160 -0
- package/dist/src/prediction/generated/waterx_prediction/position.js +214 -0
- package/dist/src/prediction/generated/waterx_prediction/version.d.ts +10 -0
- package/dist/src/prediction/generated/waterx_prediction/version.js +8 -0
- package/dist/src/prediction/generated/waterx_prediction/view.d.ts +353 -0
- package/dist/src/prediction/generated/waterx_prediction/view.js +432 -0
- package/dist/src/prediction/generated/waterx_prediction/waterx_prediction.d.ts +1698 -0
- package/dist/src/prediction/generated/waterx_prediction/waterx_prediction.js +1733 -0
- package/dist/src/prediction/gift-link.d.ts +6 -0
- package/dist/src/prediction/gift-link.js +5 -0
- package/dist/src/prediction/gift.d.ts +223 -0
- package/dist/src/prediction/gift.js +451 -0
- package/dist/src/prediction/index.d.ts +29 -0
- package/dist/src/prediction/index.js +21 -0
- package/dist/src/prediction/prediction.d.ts +104 -0
- package/dist/src/prediction/prediction.js +317 -0
- package/dist/src/prediction/tx-builders.d.ts +44 -0
- package/dist/src/prediction/tx-builders.js +52 -0
- package/dist/src/prediction/types.d.ts +93 -0
- package/dist/src/prediction/types.js +1 -0
- package/dist/src/prediction/user/account.d.ts +2 -0
- package/dist/src/prediction/user/account.js +1 -0
- package/dist/src/prediction/user/admin.d.ts +6 -0
- package/dist/src/prediction/user/admin.js +3 -0
- package/dist/src/prediction/user/gift.d.ts +2 -0
- package/dist/src/prediction/user/gift.js +1 -0
- package/dist/src/prediction/user/index.d.ts +5 -0
- package/dist/src/prediction/user/index.js +3 -0
- package/dist/src/prediction/user/keeper.d.ts +2 -0
- package/dist/src/prediction/user/keeper.js +1 -0
- package/dist/src/prediction/user/order.d.ts +2 -0
- package/dist/src/prediction/user/order.js +1 -0
- package/dist/src/prediction/user/position.d.ts +2 -0
- package/dist/src/prediction/user/position.js +1 -0
- package/dist/src/prediction/utils/bcs.d.ts +1 -0
- package/dist/src/prediction/utils/bcs.js +1 -0
- package/dist/src/prediction/utils/index.d.ts +1 -0
- package/dist/src/prediction/utils/index.js +1 -0
- package/dist/src/prediction/utils.d.ts +30 -0
- package/dist/src/prediction/utils.js +177 -0
- package/dist/src/sdk.d.ts +18 -0
- package/dist/src/sdk.js +17 -0
- package/dist/src/tx-builders.d.ts +54 -0
- package/dist/src/tx-builders.js +141 -0
- package/dist/src/unified-client.d.ts +407 -0
- package/dist/src/unified-client.js +123 -0
- package/dist/src/user/account.d.ts +27 -0
- package/dist/src/user/account.js +34 -8
- package/dist/src/user/credit.d.ts +8 -14
- package/dist/src/user/credit.js +9 -23
- package/dist/src/user/custody.d.ts +4 -18
- package/dist/src/user/custody.js +14 -25
- package/dist/src/utils/consolidate-balance.d.ts +37 -0
- package/dist/src/utils/consolidate-balance.js +89 -0
- package/dist/src/utils/math.d.ts +86 -0
- package/dist/src/utils/math.js +100 -0
- package/dist/src/utils/pyth.d.ts +42 -7
- package/dist/src/utils/pyth.js +107 -31
- package/package.json +129 -34
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Supra oracle rule for `waterx_oracle`.
|
|
6
|
+
*
|
|
7
|
+
* Reads a price from Supra's push oracle (`OracleHolder`) and contributes it to a
|
|
8
|
+
* `waterx_oracle::collector::PriceCollector` keyed by oracle `symbol`. Mirrors
|
|
9
|
+
* `waterx_pyth_rule::pyth_rule`'s shape: a per-symbol id map (`pair_id`) plus a
|
|
10
|
+
* per-symbol freshness tolerance, falling back to `DEFAULT_TOLERANCE_MS`.
|
|
11
|
+
*
|
|
12
|
+
* Like the other rules in this umbrella, `feed` _abstains_ (records `none`)
|
|
13
|
+
* instead of aborting when the symbol is unconfigured or the Supra timestamp is
|
|
14
|
+
* stale, so the aggregator can still reach `weight_threshold` from other rules.
|
|
15
|
+
* The canonical kill switch is `oracle::set_rule_weight<SupraRule>(.., 0)`.
|
|
16
|
+
*/
|
|
17
|
+
import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
|
|
18
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
19
|
+
export declare const SupraRule: MoveStruct<{
|
|
20
|
+
dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
|
|
21
|
+
}, "@waterx/supra-rule::supra_rule::SupraRule">;
|
|
22
|
+
export declare const Config: MoveStruct<{
|
|
23
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
24
|
+
/** Oracle symbol (e.g. `b"BTC_USD".to_string()`) → Supra pair ID (`u32`). */
|
|
25
|
+
pair_id_map: MoveStruct<{
|
|
26
|
+
contents: import("@mysten/sui/bcs").BcsType<{
|
|
27
|
+
key: string;
|
|
28
|
+
value: number;
|
|
29
|
+
}[], Iterable<{
|
|
30
|
+
key: string;
|
|
31
|
+
value: number;
|
|
32
|
+
}> & {
|
|
33
|
+
length: number;
|
|
34
|
+
}, string>;
|
|
35
|
+
}, "0x2::vec_map::VecMap<string, u32>">;
|
|
36
|
+
/** Per-symbol freshness tolerance in ms. Falls back to `DEFAULT_TOLERANCE_MS`. */
|
|
37
|
+
tolerance_ms_map: MoveStruct<{
|
|
38
|
+
contents: import("@mysten/sui/bcs").BcsType<{
|
|
39
|
+
key: string;
|
|
40
|
+
value: string;
|
|
41
|
+
}[], Iterable<{
|
|
42
|
+
key: string;
|
|
43
|
+
value: string | number | bigint;
|
|
44
|
+
}> & {
|
|
45
|
+
length: number;
|
|
46
|
+
}, string>;
|
|
47
|
+
}, "0x2::vec_map::VecMap<string, u64>">;
|
|
48
|
+
}, "@waterx/supra-rule::supra_rule::Config">;
|
|
49
|
+
export declare const SupraPairIdSet: MoveStruct<{
|
|
50
|
+
symbol: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
51
|
+
/** `none` when the entry was removed. */
|
|
52
|
+
pair_id: import("@mysten/sui/bcs").BcsType<number | null, number | null | undefined, "Option<u32>">;
|
|
53
|
+
}, "@waterx/supra-rule::supra_rule::SupraPairIdSet">;
|
|
54
|
+
export declare const SupraToleranceSet: MoveStruct<{
|
|
55
|
+
symbol: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
56
|
+
tolerance_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
57
|
+
}, "@waterx/supra-rule::supra_rule::SupraToleranceSet">;
|
|
58
|
+
export interface FeedArguments {
|
|
59
|
+
collector: RawTransactionArgument<string>;
|
|
60
|
+
config: RawTransactionArgument<string>;
|
|
61
|
+
oracleHolder: RawTransactionArgument<string>;
|
|
62
|
+
}
|
|
63
|
+
export interface FeedOptions {
|
|
64
|
+
package?: string;
|
|
65
|
+
arguments: FeedArguments | [
|
|
66
|
+
collector: RawTransactionArgument<string>,
|
|
67
|
+
config: RawTransactionArgument<string>,
|
|
68
|
+
oracleHolder: RawTransactionArgument<string>
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Reads the Supra push price for `collector.symbol()` and contributes it. Abstains
|
|
73
|
+
* (records `none`) when the symbol is unconfigured or the Supra timestamp diverges
|
|
74
|
+
* from the on-chain clock by more than the configured tolerance, so other rules in
|
|
75
|
+
* the same collector can still satisfy `weight_threshold`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function feed(options: FeedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
78
|
+
export interface PairIdArguments {
|
|
79
|
+
config: RawTransactionArgument<string>;
|
|
80
|
+
symbol: RawTransactionArgument<string>;
|
|
81
|
+
}
|
|
82
|
+
export interface PairIdOptions {
|
|
83
|
+
package?: string;
|
|
84
|
+
arguments: PairIdArguments | [
|
|
85
|
+
config: RawTransactionArgument<string>,
|
|
86
|
+
symbol: RawTransactionArgument<string>
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
/** The Supra pair ID configured for `symbol`, or `none`. */
|
|
90
|
+
export declare function pairId(options: PairIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
91
|
+
export interface ToleranceMsArguments {
|
|
92
|
+
config: RawTransactionArgument<string>;
|
|
93
|
+
symbol: RawTransactionArgument<string>;
|
|
94
|
+
}
|
|
95
|
+
export interface ToleranceMsOptions {
|
|
96
|
+
package?: string;
|
|
97
|
+
arguments: ToleranceMsArguments | [
|
|
98
|
+
config: RawTransactionArgument<string>,
|
|
99
|
+
symbol: RawTransactionArgument<string>
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The freshness tolerance (ms) `feed` applies for `symbol`, resolving the
|
|
104
|
+
* `DEFAULT_TOLERANCE_MS` fallback.
|
|
105
|
+
*/
|
|
106
|
+
export declare function toleranceMs(options: ToleranceMsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
107
|
+
export interface SetPairIdArguments {
|
|
108
|
+
config: RawTransactionArgument<string>;
|
|
109
|
+
Cap: RawTransactionArgument<string>;
|
|
110
|
+
symbol: RawTransactionArgument<string>;
|
|
111
|
+
pairId: RawTransactionArgument<number>;
|
|
112
|
+
}
|
|
113
|
+
export interface SetPairIdOptions {
|
|
114
|
+
package?: string;
|
|
115
|
+
arguments: SetPairIdArguments | [
|
|
116
|
+
config: RawTransactionArgument<string>,
|
|
117
|
+
Cap: RawTransactionArgument<string>,
|
|
118
|
+
symbol: RawTransactionArgument<string>,
|
|
119
|
+
pairId: RawTransactionArgument<number>
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
/** Registers / overwrites the Supra pair ID for `symbol`. Emits `SupraPairIdSet`. */
|
|
123
|
+
export declare function setPairId(options: SetPairIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
124
|
+
export interface RemovePairIdArguments {
|
|
125
|
+
config: RawTransactionArgument<string>;
|
|
126
|
+
Cap: RawTransactionArgument<string>;
|
|
127
|
+
symbol: RawTransactionArgument<string>;
|
|
128
|
+
}
|
|
129
|
+
export interface RemovePairIdOptions {
|
|
130
|
+
package?: string;
|
|
131
|
+
arguments: RemovePairIdArguments | [
|
|
132
|
+
config: RawTransactionArgument<string>,
|
|
133
|
+
Cap: RawTransactionArgument<string>,
|
|
134
|
+
symbol: RawTransactionArgument<string>
|
|
135
|
+
];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Removes the Supra pair ID for `symbol` (no-op if absent). After removal `feed`
|
|
139
|
+
* abstains for `symbol`. Emits `SupraPairIdSet { pair_id: none }`.
|
|
140
|
+
*/
|
|
141
|
+
export declare function removePairId(options: RemovePairIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
142
|
+
export interface SetToleranceMsArguments {
|
|
143
|
+
config: RawTransactionArgument<string>;
|
|
144
|
+
Cap: RawTransactionArgument<string>;
|
|
145
|
+
symbol: RawTransactionArgument<string>;
|
|
146
|
+
toleranceMs: RawTransactionArgument<number | bigint>;
|
|
147
|
+
}
|
|
148
|
+
export interface SetToleranceMsOptions {
|
|
149
|
+
package?: string;
|
|
150
|
+
arguments: SetToleranceMsArguments | [
|
|
151
|
+
config: RawTransactionArgument<string>,
|
|
152
|
+
Cap: RawTransactionArgument<string>,
|
|
153
|
+
symbol: RawTransactionArgument<string>,
|
|
154
|
+
toleranceMs: RawTransactionArgument<number | bigint>
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
/** Sets the per-symbol freshness tolerance in ms. Emits `SupraToleranceSet`. */
|
|
158
|
+
export declare function setToleranceMs(options: SetToleranceMsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Supra oracle rule for `waterx_oracle`.
|
|
6
|
+
*
|
|
7
|
+
* Reads a price from Supra's push oracle (`OracleHolder`) and contributes it to a
|
|
8
|
+
* `waterx_oracle::collector::PriceCollector` keyed by oracle `symbol`. Mirrors
|
|
9
|
+
* `waterx_pyth_rule::pyth_rule`'s shape: a per-symbol id map (`pair_id`) plus a
|
|
10
|
+
* per-symbol freshness tolerance, falling back to `DEFAULT_TOLERANCE_MS`.
|
|
11
|
+
*
|
|
12
|
+
* Like the other rules in this umbrella, `feed` _abstains_ (records `none`)
|
|
13
|
+
* instead of aborting when the symbol is unconfigured or the Supra timestamp is
|
|
14
|
+
* stale, so the aggregator can still reach `weight_threshold` from other rules.
|
|
15
|
+
* The canonical kill switch is `oracle::set_rule_weight<SupraRule>(.., 0)`.
|
|
16
|
+
*/
|
|
17
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
18
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
19
|
+
import * as vec_map from "./deps/sui/vec_map.js";
|
|
20
|
+
import * as vec_map_1 from "./deps/sui/vec_map.js";
|
|
21
|
+
const $moduleName = '@waterx/supra-rule::supra_rule';
|
|
22
|
+
export const SupraRule = new MoveStruct({ name: `${$moduleName}::SupraRule`, fields: {
|
|
23
|
+
dummy_field: bcs.bool()
|
|
24
|
+
} });
|
|
25
|
+
export const Config = new MoveStruct({ name: `${$moduleName}::Config`, fields: {
|
|
26
|
+
id: bcs.Address,
|
|
27
|
+
/** Oracle symbol (e.g. `b"BTC_USD".to_string()`) → Supra pair ID (`u32`). */
|
|
28
|
+
pair_id_map: vec_map.VecMap(bcs.string(), bcs.u32()),
|
|
29
|
+
/** Per-symbol freshness tolerance in ms. Falls back to `DEFAULT_TOLERANCE_MS`. */
|
|
30
|
+
tolerance_ms_map: vec_map_1.VecMap(bcs.string(), bcs.u64())
|
|
31
|
+
} });
|
|
32
|
+
export const SupraPairIdSet = new MoveStruct({ name: `${$moduleName}::SupraPairIdSet`, fields: {
|
|
33
|
+
symbol: bcs.string(),
|
|
34
|
+
/** `none` when the entry was removed. */
|
|
35
|
+
pair_id: bcs.option(bcs.u32())
|
|
36
|
+
} });
|
|
37
|
+
export const SupraToleranceSet = new MoveStruct({ name: `${$moduleName}::SupraToleranceSet`, fields: {
|
|
38
|
+
symbol: bcs.string(),
|
|
39
|
+
tolerance_ms: bcs.u64()
|
|
40
|
+
} });
|
|
41
|
+
/**
|
|
42
|
+
* Reads the Supra push price for `collector.symbol()` and contributes it. Abstains
|
|
43
|
+
* (records `none`) when the symbol is unconfigured or the Supra timestamp diverges
|
|
44
|
+
* from the on-chain clock by more than the configured tolerance, so other rules in
|
|
45
|
+
* the same collector can still satisfy `weight_threshold`.
|
|
46
|
+
*/
|
|
47
|
+
export function feed(options) {
|
|
48
|
+
const packageAddress = options.package ?? '@waterx/supra-rule';
|
|
49
|
+
const argumentsTypes = [
|
|
50
|
+
null,
|
|
51
|
+
null,
|
|
52
|
+
'0x2::clock::Clock',
|
|
53
|
+
null
|
|
54
|
+
];
|
|
55
|
+
const parameterNames = ["collector", "config", "oracleHolder"];
|
|
56
|
+
return (tx) => tx.moveCall({
|
|
57
|
+
package: packageAddress,
|
|
58
|
+
module: 'supra_rule',
|
|
59
|
+
function: 'feed',
|
|
60
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** The Supra pair ID configured for `symbol`, or `none`. */
|
|
64
|
+
export function pairId(options) {
|
|
65
|
+
const packageAddress = options.package ?? '@waterx/supra-rule';
|
|
66
|
+
const argumentsTypes = [
|
|
67
|
+
null,
|
|
68
|
+
'0x1::string::String'
|
|
69
|
+
];
|
|
70
|
+
const parameterNames = ["config", "symbol"];
|
|
71
|
+
return (tx) => tx.moveCall({
|
|
72
|
+
package: packageAddress,
|
|
73
|
+
module: 'supra_rule',
|
|
74
|
+
function: 'pair_id',
|
|
75
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The freshness tolerance (ms) `feed` applies for `symbol`, resolving the
|
|
80
|
+
* `DEFAULT_TOLERANCE_MS` fallback.
|
|
81
|
+
*/
|
|
82
|
+
export function toleranceMs(options) {
|
|
83
|
+
const packageAddress = options.package ?? '@waterx/supra-rule';
|
|
84
|
+
const argumentsTypes = [
|
|
85
|
+
null,
|
|
86
|
+
'0x1::string::String'
|
|
87
|
+
];
|
|
88
|
+
const parameterNames = ["config", "symbol"];
|
|
89
|
+
return (tx) => tx.moveCall({
|
|
90
|
+
package: packageAddress,
|
|
91
|
+
module: 'supra_rule',
|
|
92
|
+
function: 'tolerance_ms',
|
|
93
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/** Registers / overwrites the Supra pair ID for `symbol`. Emits `SupraPairIdSet`. */
|
|
97
|
+
export function setPairId(options) {
|
|
98
|
+
const packageAddress = options.package ?? '@waterx/supra-rule';
|
|
99
|
+
const argumentsTypes = [
|
|
100
|
+
null,
|
|
101
|
+
null,
|
|
102
|
+
'0x1::string::String',
|
|
103
|
+
'u32'
|
|
104
|
+
];
|
|
105
|
+
const parameterNames = ["config", "Cap", "symbol", "pairId"];
|
|
106
|
+
return (tx) => tx.moveCall({
|
|
107
|
+
package: packageAddress,
|
|
108
|
+
module: 'supra_rule',
|
|
109
|
+
function: 'set_pair_id',
|
|
110
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Removes the Supra pair ID for `symbol` (no-op if absent). After removal `feed`
|
|
115
|
+
* abstains for `symbol`. Emits `SupraPairIdSet { pair_id: none }`.
|
|
116
|
+
*/
|
|
117
|
+
export function removePairId(options) {
|
|
118
|
+
const packageAddress = options.package ?? '@waterx/supra-rule';
|
|
119
|
+
const argumentsTypes = [
|
|
120
|
+
null,
|
|
121
|
+
null,
|
|
122
|
+
'0x1::string::String'
|
|
123
|
+
];
|
|
124
|
+
const parameterNames = ["config", "Cap", "symbol"];
|
|
125
|
+
return (tx) => tx.moveCall({
|
|
126
|
+
package: packageAddress,
|
|
127
|
+
module: 'supra_rule',
|
|
128
|
+
function: 'remove_pair_id',
|
|
129
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/** Sets the per-symbol freshness tolerance in ms. Emits `SupraToleranceSet`. */
|
|
133
|
+
export function setToleranceMs(options) {
|
|
134
|
+
const packageAddress = options.package ?? '@waterx/supra-rule';
|
|
135
|
+
const argumentsTypes = [
|
|
136
|
+
null,
|
|
137
|
+
null,
|
|
138
|
+
'0x1::string::String',
|
|
139
|
+
'u64'
|
|
140
|
+
];
|
|
141
|
+
const parameterNames = ["config", "Cap", "symbol", "toleranceMs"];
|
|
142
|
+
return (tx) => tx.moveCall({
|
|
143
|
+
package: packageAddress,
|
|
144
|
+
module: 'supra_rule',
|
|
145
|
+
function: 'set_tolerance_ms',
|
|
146
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
@@ -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,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
|
+
}
|