@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,298 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Shared `Oracle` registry. Holds one `PriceAggregator` per ticker as a DOF child.
|
|
6
|
+
*
|
|
7
|
+
* PTB flow:
|
|
8
|
+
*
|
|
9
|
+
* ```text
|
|
10
|
+
* let collector = oracle::new_collector(b"BTC_USD".to_string());
|
|
11
|
+
* waterx_rule::feed(&mut collector, &waterx_config, &clock, ...);
|
|
12
|
+
* oracle::aggregate(&mut oracle, collector, &clock);
|
|
13
|
+
* // ... later in the same tx:
|
|
14
|
+
* let price = oracle::get_price(&oracle, b"BTC_USD".to_string(), &clock);
|
|
15
|
+
* let historical = oracle::get_price_at_timestamp(&oracle, b"BTC_USD".to_string(), option::some(ts));
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
|
|
19
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
20
|
+
export declare const VersionAllowed: MoveStruct<{
|
|
21
|
+
version: import("@mysten/sui/bcs").BcsType<number, number, "u16">;
|
|
22
|
+
}, "@waterx/oracle::oracle::VersionAllowed">;
|
|
23
|
+
export declare const VersionDisallowed: MoveStruct<{
|
|
24
|
+
version: import("@mysten/sui/bcs").BcsType<number, number, "u16">;
|
|
25
|
+
}, "@waterx/oracle::oracle::VersionDisallowed">;
|
|
26
|
+
export declare const Oracle: MoveStruct<{
|
|
27
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
28
|
+
/**
|
|
29
|
+
* Allowed package versions. `assert_version` aborts unless the current
|
|
30
|
+
* `version::package_version()` is in this set.
|
|
31
|
+
*/
|
|
32
|
+
allowed_versions: MoveStruct<any, any>;
|
|
33
|
+
}, "@waterx/oracle::oracle::Oracle">;
|
|
34
|
+
export declare const ListingCap: MoveStruct<{
|
|
35
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
36
|
+
}, "@waterx/oracle::oracle::ListingCap">;
|
|
37
|
+
export interface AssertVersionArguments {
|
|
38
|
+
oracle: RawTransactionArgument<string>;
|
|
39
|
+
}
|
|
40
|
+
export interface AssertVersionOptions {
|
|
41
|
+
package?: string;
|
|
42
|
+
arguments: AssertVersionArguments | [
|
|
43
|
+
oracle: RawTransactionArgument<string>
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
export declare function assertVersion(options: AssertVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
47
|
+
export interface IsVersionAllowedArguments {
|
|
48
|
+
oracle: RawTransactionArgument<string>;
|
|
49
|
+
v: RawTransactionArgument<number>;
|
|
50
|
+
}
|
|
51
|
+
export interface IsVersionAllowedOptions {
|
|
52
|
+
package?: string;
|
|
53
|
+
arguments: IsVersionAllowedArguments | [
|
|
54
|
+
oracle: RawTransactionArgument<string>,
|
|
55
|
+
v: RawTransactionArgument<number>
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
export declare function isVersionAllowed(options: IsVersionAllowedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
59
|
+
export interface AllowVersionArguments {
|
|
60
|
+
oracle: RawTransactionArgument<string>;
|
|
61
|
+
Cap: RawTransactionArgument<string>;
|
|
62
|
+
v: RawTransactionArgument<number>;
|
|
63
|
+
}
|
|
64
|
+
export interface AllowVersionOptions {
|
|
65
|
+
package?: string;
|
|
66
|
+
arguments: AllowVersionArguments | [
|
|
67
|
+
oracle: RawTransactionArgument<string>,
|
|
68
|
+
Cap: RawTransactionArgument<string>,
|
|
69
|
+
v: RawTransactionArgument<number>
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
export declare function allowVersion(options: AllowVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
73
|
+
export interface DisallowVersionArguments {
|
|
74
|
+
oracle: RawTransactionArgument<string>;
|
|
75
|
+
Cap: RawTransactionArgument<string>;
|
|
76
|
+
v: RawTransactionArgument<number>;
|
|
77
|
+
}
|
|
78
|
+
export interface DisallowVersionOptions {
|
|
79
|
+
package?: string;
|
|
80
|
+
arguments: DisallowVersionArguments | [
|
|
81
|
+
oracle: RawTransactionArgument<string>,
|
|
82
|
+
Cap: RawTransactionArgument<string>,
|
|
83
|
+
v: RawTransactionArgument<number>
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
export declare function disallowVersion(options: DisallowVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
87
|
+
export interface AddAggregatorArguments {
|
|
88
|
+
oracle: RawTransactionArgument<string>;
|
|
89
|
+
Cap: RawTransactionArgument<string>;
|
|
90
|
+
symbol: RawTransactionArgument<string>;
|
|
91
|
+
weightThreshold: RawTransactionArgument<number | bigint>;
|
|
92
|
+
outlierToleranceBps: RawTransactionArgument<number | bigint>;
|
|
93
|
+
}
|
|
94
|
+
export interface AddAggregatorOptions {
|
|
95
|
+
package?: string;
|
|
96
|
+
arguments: AddAggregatorArguments | [
|
|
97
|
+
oracle: RawTransactionArgument<string>,
|
|
98
|
+
Cap: RawTransactionArgument<string>,
|
|
99
|
+
symbol: RawTransactionArgument<string>,
|
|
100
|
+
weightThreshold: RawTransactionArgument<number | bigint>,
|
|
101
|
+
outlierToleranceBps: RawTransactionArgument<number | bigint>
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
export declare function addAggregator(options: AddAggregatorOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
105
|
+
export interface SetRuleWeightArguments {
|
|
106
|
+
oracle: RawTransactionArgument<string>;
|
|
107
|
+
Cap: RawTransactionArgument<string>;
|
|
108
|
+
symbol: RawTransactionArgument<string>;
|
|
109
|
+
weight: RawTransactionArgument<number>;
|
|
110
|
+
}
|
|
111
|
+
export interface SetRuleWeightOptions {
|
|
112
|
+
package?: string;
|
|
113
|
+
arguments: SetRuleWeightArguments | [
|
|
114
|
+
oracle: RawTransactionArgument<string>,
|
|
115
|
+
Cap: RawTransactionArgument<string>,
|
|
116
|
+
symbol: RawTransactionArgument<string>,
|
|
117
|
+
weight: RawTransactionArgument<number>
|
|
118
|
+
];
|
|
119
|
+
typeArguments: [
|
|
120
|
+
string
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
export declare function setRuleWeight(options: SetRuleWeightOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
124
|
+
export interface SetWeightThresholdArguments {
|
|
125
|
+
oracle: RawTransactionArgument<string>;
|
|
126
|
+
Cap: RawTransactionArgument<string>;
|
|
127
|
+
symbol: RawTransactionArgument<string>;
|
|
128
|
+
weightThreshold: RawTransactionArgument<number | bigint>;
|
|
129
|
+
}
|
|
130
|
+
export interface SetWeightThresholdOptions {
|
|
131
|
+
package?: string;
|
|
132
|
+
arguments: SetWeightThresholdArguments | [
|
|
133
|
+
oracle: RawTransactionArgument<string>,
|
|
134
|
+
Cap: RawTransactionArgument<string>,
|
|
135
|
+
symbol: RawTransactionArgument<string>,
|
|
136
|
+
weightThreshold: RawTransactionArgument<number | bigint>
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
export declare function setWeightThreshold(options: SetWeightThresholdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
140
|
+
export interface SetOutlierToleranceArguments {
|
|
141
|
+
oracle: RawTransactionArgument<string>;
|
|
142
|
+
Cap: RawTransactionArgument<string>;
|
|
143
|
+
symbol: RawTransactionArgument<string>;
|
|
144
|
+
outlierToleranceBps: RawTransactionArgument<number | bigint>;
|
|
145
|
+
}
|
|
146
|
+
export interface SetOutlierToleranceOptions {
|
|
147
|
+
package?: string;
|
|
148
|
+
arguments: SetOutlierToleranceArguments | [
|
|
149
|
+
oracle: RawTransactionArgument<string>,
|
|
150
|
+
Cap: RawTransactionArgument<string>,
|
|
151
|
+
symbol: RawTransactionArgument<string>,
|
|
152
|
+
outlierToleranceBps: RawTransactionArgument<number | bigint>
|
|
153
|
+
];
|
|
154
|
+
}
|
|
155
|
+
export declare function setOutlierTolerance(options: SetOutlierToleranceOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
156
|
+
export interface NewCollectorArguments {
|
|
157
|
+
symbol: RawTransactionArgument<string>;
|
|
158
|
+
}
|
|
159
|
+
export interface NewCollectorOptions {
|
|
160
|
+
package?: string;
|
|
161
|
+
arguments: NewCollectorArguments | [
|
|
162
|
+
symbol: RawTransactionArgument<string>
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Creates a hot-potato collector for a given ticker. The ticker must already be
|
|
167
|
+
* listed (or `aggregate` will abort), but the membership check happens at
|
|
168
|
+
* `aggregate` time so no mutable borrow on the oracle is taken here.
|
|
169
|
+
*/
|
|
170
|
+
export declare function newCollector(options: NewCollectorOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
171
|
+
export interface AggregateArguments {
|
|
172
|
+
oracle: RawTransactionArgument<string>;
|
|
173
|
+
collector: RawTransactionArgument<string>;
|
|
174
|
+
}
|
|
175
|
+
export interface AggregateOptions {
|
|
176
|
+
package?: string;
|
|
177
|
+
arguments: AggregateArguments | [
|
|
178
|
+
oracle: RawTransactionArgument<string>,
|
|
179
|
+
collector: RawTransactionArgument<string>
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Consumes the collector and writes the aggregated price into the matching
|
|
184
|
+
* aggregator with `last_update_ms = clock.timestamp_ms()`.
|
|
185
|
+
*/
|
|
186
|
+
export declare function aggregate(options: AggregateOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
187
|
+
export interface RegisterPriceAtTimestampArguments {
|
|
188
|
+
oracle: RawTransactionArgument<string>;
|
|
189
|
+
collector: RawTransactionArgument<string>;
|
|
190
|
+
}
|
|
191
|
+
export interface RegisterPriceAtTimestampOptions {
|
|
192
|
+
package?: string;
|
|
193
|
+
arguments: RegisterPriceAtTimestampArguments | [
|
|
194
|
+
oracle: RawTransactionArgument<string>,
|
|
195
|
+
collector: RawTransactionArgument<string>
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Consumes a verified historical collector and stores an exact historical snapshot
|
|
200
|
+
* at the collector's verified timestamp without touching the latest price.
|
|
201
|
+
*/
|
|
202
|
+
export declare function registerPriceAtTimestamp(options: RegisterPriceAtTimestampOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
203
|
+
export interface GetPriceArguments {
|
|
204
|
+
oracle: RawTransactionArgument<string>;
|
|
205
|
+
ticker: RawTransactionArgument<string>;
|
|
206
|
+
}
|
|
207
|
+
export interface GetPriceOptions {
|
|
208
|
+
package?: string;
|
|
209
|
+
arguments: GetPriceArguments | [
|
|
210
|
+
oracle: RawTransactionArgument<string>,
|
|
211
|
+
ticker: RawTransactionArgument<string>
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Reads the latest aggregated price for `ticker`.
|
|
216
|
+
*
|
|
217
|
+
* This is intentionally strict: the latest price must have been written in the
|
|
218
|
+
* same PTB, using this same `Clock` timestamp.
|
|
219
|
+
*/
|
|
220
|
+
export declare function getPrice(options: GetPriceOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
221
|
+
export interface GetPriceAtTimestampArguments {
|
|
222
|
+
oracle: RawTransactionArgument<string>;
|
|
223
|
+
ticker: RawTransactionArgument<string>;
|
|
224
|
+
timestampMs: RawTransactionArgument<number | bigint | null>;
|
|
225
|
+
}
|
|
226
|
+
export interface GetPriceAtTimestampOptions {
|
|
227
|
+
package?: string;
|
|
228
|
+
arguments: GetPriceAtTimestampArguments | [
|
|
229
|
+
oracle: RawTransactionArgument<string>,
|
|
230
|
+
ticker: RawTransactionArgument<string>,
|
|
231
|
+
timestampMs: RawTransactionArgument<number | bigint | null>
|
|
232
|
+
];
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Reads the exact historical price written at `timestamp_ms`.
|
|
236
|
+
*
|
|
237
|
+
* Passing `none` returns the raw latest value without a freshness check. Use
|
|
238
|
+
* `get_price` for current-price consumer paths that require same-PTB freshness.
|
|
239
|
+
*/
|
|
240
|
+
export declare function getPriceAtTimestamp(options: GetPriceAtTimestampOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
241
|
+
export interface RemovePriceAtTimestampArguments {
|
|
242
|
+
oracle: RawTransactionArgument<string>;
|
|
243
|
+
ticker: RawTransactionArgument<string>;
|
|
244
|
+
timestampMs: RawTransactionArgument<number | bigint>;
|
|
245
|
+
}
|
|
246
|
+
export interface RemovePriceAtTimestampOptions {
|
|
247
|
+
package?: string;
|
|
248
|
+
arguments: RemovePriceAtTimestampArguments | [
|
|
249
|
+
oracle: RawTransactionArgument<string>,
|
|
250
|
+
ticker: RawTransactionArgument<string>,
|
|
251
|
+
timestampMs: RawTransactionArgument<number | bigint>
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Removes the exact historical price snapshot at `timestamp_ms` so the caller can
|
|
256
|
+
* reclaim the dynamic-field storage rebate. Latest price is unchanged.
|
|
257
|
+
*/
|
|
258
|
+
export declare function removePriceAtTimestamp(options: RemovePriceAtTimestampOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
259
|
+
export interface UnsafeGetLatestPriceArguments {
|
|
260
|
+
oracle: RawTransactionArgument<string>;
|
|
261
|
+
ticker: RawTransactionArgument<string>;
|
|
262
|
+
}
|
|
263
|
+
export interface UnsafeGetLatestPriceOptions {
|
|
264
|
+
package?: string;
|
|
265
|
+
arguments: UnsafeGetLatestPriceArguments | [
|
|
266
|
+
oracle: RawTransactionArgument<string>,
|
|
267
|
+
ticker: RawTransactionArgument<string>
|
|
268
|
+
];
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Reads the latest aggregated price without the freshness check. For
|
|
272
|
+
* view/off-chain pricing - never call from a path that updates state.
|
|
273
|
+
*/
|
|
274
|
+
export declare function unsafeGetLatestPrice(options: UnsafeGetLatestPriceOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
275
|
+
export interface IsListedArguments {
|
|
276
|
+
oracle: RawTransactionArgument<string>;
|
|
277
|
+
ticker: RawTransactionArgument<string>;
|
|
278
|
+
}
|
|
279
|
+
export interface IsListedOptions {
|
|
280
|
+
package?: string;
|
|
281
|
+
arguments: IsListedArguments | [
|
|
282
|
+
oracle: RawTransactionArgument<string>,
|
|
283
|
+
ticker: RawTransactionArgument<string>
|
|
284
|
+
];
|
|
285
|
+
}
|
|
286
|
+
export declare function isListed(options: IsListedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
287
|
+
export interface AggregatorArguments {
|
|
288
|
+
oracle: RawTransactionArgument<string>;
|
|
289
|
+
ticker: RawTransactionArgument<string>;
|
|
290
|
+
}
|
|
291
|
+
export interface AggregatorOptions {
|
|
292
|
+
package?: string;
|
|
293
|
+
arguments: AggregatorArguments | [
|
|
294
|
+
oracle: RawTransactionArgument<string>,
|
|
295
|
+
ticker: RawTransactionArgument<string>
|
|
296
|
+
];
|
|
297
|
+
}
|
|
298
|
+
export declare function aggregator(options: AggregatorOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Shared `Oracle` registry. Holds one `PriceAggregator` per ticker as a DOF child.
|
|
6
|
+
*
|
|
7
|
+
* PTB flow:
|
|
8
|
+
*
|
|
9
|
+
* ```text
|
|
10
|
+
* let collector = oracle::new_collector(b"BTC_USD".to_string());
|
|
11
|
+
* waterx_rule::feed(&mut collector, &waterx_config, &clock, ...);
|
|
12
|
+
* oracle::aggregate(&mut oracle, collector, &clock);
|
|
13
|
+
* // ... later in the same tx:
|
|
14
|
+
* let price = oracle::get_price(&oracle, b"BTC_USD".to_string(), &clock);
|
|
15
|
+
* let historical = oracle::get_price_at_timestamp(&oracle, b"BTC_USD".to_string(), option::some(ts));
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
19
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
20
|
+
import * as vec_set from "./deps/sui/vec_set.js";
|
|
21
|
+
const $moduleName = '@waterx/oracle::oracle';
|
|
22
|
+
export const VersionAllowed = new MoveStruct({ name: `${$moduleName}::VersionAllowed`, fields: {
|
|
23
|
+
version: bcs.u16()
|
|
24
|
+
} });
|
|
25
|
+
export const VersionDisallowed = new MoveStruct({ name: `${$moduleName}::VersionDisallowed`, fields: {
|
|
26
|
+
version: bcs.u16()
|
|
27
|
+
} });
|
|
28
|
+
export const Oracle = new MoveStruct({ name: `${$moduleName}::Oracle`, fields: {
|
|
29
|
+
id: bcs.Address,
|
|
30
|
+
/**
|
|
31
|
+
* Allowed package versions. `assert_version` aborts unless the current
|
|
32
|
+
* `version::package_version()` is in this set.
|
|
33
|
+
*/
|
|
34
|
+
allowed_versions: vec_set.VecSet(bcs.u16())
|
|
35
|
+
} });
|
|
36
|
+
export const ListingCap = new MoveStruct({ name: `${$moduleName}::ListingCap`, fields: {
|
|
37
|
+
id: bcs.Address
|
|
38
|
+
} });
|
|
39
|
+
export function assertVersion(options) {
|
|
40
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
41
|
+
const argumentsTypes = [
|
|
42
|
+
null
|
|
43
|
+
];
|
|
44
|
+
const parameterNames = ["oracle"];
|
|
45
|
+
return (tx) => tx.moveCall({
|
|
46
|
+
package: packageAddress,
|
|
47
|
+
module: 'oracle',
|
|
48
|
+
function: 'assert_version',
|
|
49
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function isVersionAllowed(options) {
|
|
53
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
54
|
+
const argumentsTypes = [
|
|
55
|
+
null,
|
|
56
|
+
'u16'
|
|
57
|
+
];
|
|
58
|
+
const parameterNames = ["oracle", "v"];
|
|
59
|
+
return (tx) => tx.moveCall({
|
|
60
|
+
package: packageAddress,
|
|
61
|
+
module: 'oracle',
|
|
62
|
+
function: 'is_version_allowed',
|
|
63
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export function allowVersion(options) {
|
|
67
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
68
|
+
const argumentsTypes = [
|
|
69
|
+
null,
|
|
70
|
+
null,
|
|
71
|
+
'u16'
|
|
72
|
+
];
|
|
73
|
+
const parameterNames = ["oracle", "Cap", "v"];
|
|
74
|
+
return (tx) => tx.moveCall({
|
|
75
|
+
package: packageAddress,
|
|
76
|
+
module: 'oracle',
|
|
77
|
+
function: 'allow_version',
|
|
78
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export function disallowVersion(options) {
|
|
82
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
83
|
+
const argumentsTypes = [
|
|
84
|
+
null,
|
|
85
|
+
null,
|
|
86
|
+
'u16'
|
|
87
|
+
];
|
|
88
|
+
const parameterNames = ["oracle", "Cap", "v"];
|
|
89
|
+
return (tx) => tx.moveCall({
|
|
90
|
+
package: packageAddress,
|
|
91
|
+
module: 'oracle',
|
|
92
|
+
function: 'disallow_version',
|
|
93
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
export function addAggregator(options) {
|
|
97
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
98
|
+
const argumentsTypes = [
|
|
99
|
+
null,
|
|
100
|
+
null,
|
|
101
|
+
'0x1::string::String',
|
|
102
|
+
'u64',
|
|
103
|
+
'u64'
|
|
104
|
+
];
|
|
105
|
+
const parameterNames = ["oracle", "Cap", "symbol", "weightThreshold", "outlierToleranceBps"];
|
|
106
|
+
return (tx) => tx.moveCall({
|
|
107
|
+
package: packageAddress,
|
|
108
|
+
module: 'oracle',
|
|
109
|
+
function: 'add_aggregator',
|
|
110
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
export function setRuleWeight(options) {
|
|
114
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
115
|
+
const argumentsTypes = [
|
|
116
|
+
null,
|
|
117
|
+
null,
|
|
118
|
+
'0x1::string::String',
|
|
119
|
+
'u8'
|
|
120
|
+
];
|
|
121
|
+
const parameterNames = ["oracle", "Cap", "symbol", "weight"];
|
|
122
|
+
return (tx) => tx.moveCall({
|
|
123
|
+
package: packageAddress,
|
|
124
|
+
module: 'oracle',
|
|
125
|
+
function: 'set_rule_weight',
|
|
126
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
127
|
+
typeArguments: options.typeArguments
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
export function setWeightThreshold(options) {
|
|
131
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
132
|
+
const argumentsTypes = [
|
|
133
|
+
null,
|
|
134
|
+
null,
|
|
135
|
+
'0x1::string::String',
|
|
136
|
+
'u64'
|
|
137
|
+
];
|
|
138
|
+
const parameterNames = ["oracle", "Cap", "symbol", "weightThreshold"];
|
|
139
|
+
return (tx) => tx.moveCall({
|
|
140
|
+
package: packageAddress,
|
|
141
|
+
module: 'oracle',
|
|
142
|
+
function: 'set_weight_threshold',
|
|
143
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
export function setOutlierTolerance(options) {
|
|
147
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
148
|
+
const argumentsTypes = [
|
|
149
|
+
null,
|
|
150
|
+
null,
|
|
151
|
+
'0x1::string::String',
|
|
152
|
+
'u64'
|
|
153
|
+
];
|
|
154
|
+
const parameterNames = ["oracle", "Cap", "symbol", "outlierToleranceBps"];
|
|
155
|
+
return (tx) => tx.moveCall({
|
|
156
|
+
package: packageAddress,
|
|
157
|
+
module: 'oracle',
|
|
158
|
+
function: 'set_outlier_tolerance',
|
|
159
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Creates a hot-potato collector for a given ticker. The ticker must already be
|
|
164
|
+
* listed (or `aggregate` will abort), but the membership check happens at
|
|
165
|
+
* `aggregate` time so no mutable borrow on the oracle is taken here.
|
|
166
|
+
*/
|
|
167
|
+
export function newCollector(options) {
|
|
168
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
169
|
+
const argumentsTypes = [
|
|
170
|
+
'0x1::string::String'
|
|
171
|
+
];
|
|
172
|
+
const parameterNames = ["symbol"];
|
|
173
|
+
return (tx) => tx.moveCall({
|
|
174
|
+
package: packageAddress,
|
|
175
|
+
module: 'oracle',
|
|
176
|
+
function: 'new_collector',
|
|
177
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Consumes the collector and writes the aggregated price into the matching
|
|
182
|
+
* aggregator with `last_update_ms = clock.timestamp_ms()`.
|
|
183
|
+
*/
|
|
184
|
+
export function aggregate(options) {
|
|
185
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
186
|
+
const argumentsTypes = [
|
|
187
|
+
null,
|
|
188
|
+
null,
|
|
189
|
+
'0x2::clock::Clock'
|
|
190
|
+
];
|
|
191
|
+
const parameterNames = ["oracle", "collector"];
|
|
192
|
+
return (tx) => tx.moveCall({
|
|
193
|
+
package: packageAddress,
|
|
194
|
+
module: 'oracle',
|
|
195
|
+
function: 'aggregate',
|
|
196
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Consumes a verified historical collector and stores an exact historical snapshot
|
|
201
|
+
* at the collector's verified timestamp without touching the latest price.
|
|
202
|
+
*/
|
|
203
|
+
export function registerPriceAtTimestamp(options) {
|
|
204
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
205
|
+
const argumentsTypes = [
|
|
206
|
+
null,
|
|
207
|
+
null
|
|
208
|
+
];
|
|
209
|
+
const parameterNames = ["oracle", "collector"];
|
|
210
|
+
return (tx) => tx.moveCall({
|
|
211
|
+
package: packageAddress,
|
|
212
|
+
module: 'oracle',
|
|
213
|
+
function: 'register_price_at_timestamp',
|
|
214
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Reads the latest aggregated price for `ticker`.
|
|
219
|
+
*
|
|
220
|
+
* This is intentionally strict: the latest price must have been written in the
|
|
221
|
+
* same PTB, using this same `Clock` timestamp.
|
|
222
|
+
*/
|
|
223
|
+
export function getPrice(options) {
|
|
224
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
225
|
+
const argumentsTypes = [
|
|
226
|
+
null,
|
|
227
|
+
'0x1::string::String',
|
|
228
|
+
'0x2::clock::Clock'
|
|
229
|
+
];
|
|
230
|
+
const parameterNames = ["oracle", "ticker"];
|
|
231
|
+
return (tx) => tx.moveCall({
|
|
232
|
+
package: packageAddress,
|
|
233
|
+
module: 'oracle',
|
|
234
|
+
function: 'get_price',
|
|
235
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Reads the exact historical price written at `timestamp_ms`.
|
|
240
|
+
*
|
|
241
|
+
* Passing `none` returns the raw latest value without a freshness check. Use
|
|
242
|
+
* `get_price` for current-price consumer paths that require same-PTB freshness.
|
|
243
|
+
*/
|
|
244
|
+
export function getPriceAtTimestamp(options) {
|
|
245
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
246
|
+
const argumentsTypes = [
|
|
247
|
+
null,
|
|
248
|
+
'0x1::string::String',
|
|
249
|
+
'0x1::option::Option<u64>'
|
|
250
|
+
];
|
|
251
|
+
const parameterNames = ["oracle", "ticker", "timestampMs"];
|
|
252
|
+
return (tx) => tx.moveCall({
|
|
253
|
+
package: packageAddress,
|
|
254
|
+
module: 'oracle',
|
|
255
|
+
function: 'get_price_at_timestamp',
|
|
256
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Removes the exact historical price snapshot at `timestamp_ms` so the caller can
|
|
261
|
+
* reclaim the dynamic-field storage rebate. Latest price is unchanged.
|
|
262
|
+
*/
|
|
263
|
+
export function removePriceAtTimestamp(options) {
|
|
264
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
265
|
+
const argumentsTypes = [
|
|
266
|
+
null,
|
|
267
|
+
'0x1::string::String',
|
|
268
|
+
'u64'
|
|
269
|
+
];
|
|
270
|
+
const parameterNames = ["oracle", "ticker", "timestampMs"];
|
|
271
|
+
return (tx) => tx.moveCall({
|
|
272
|
+
package: packageAddress,
|
|
273
|
+
module: 'oracle',
|
|
274
|
+
function: 'remove_price_at_timestamp',
|
|
275
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Reads the latest aggregated price without the freshness check. For
|
|
280
|
+
* view/off-chain pricing - never call from a path that updates state.
|
|
281
|
+
*/
|
|
282
|
+
export function unsafeGetLatestPrice(options) {
|
|
283
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
284
|
+
const argumentsTypes = [
|
|
285
|
+
null,
|
|
286
|
+
'0x1::string::String'
|
|
287
|
+
];
|
|
288
|
+
const parameterNames = ["oracle", "ticker"];
|
|
289
|
+
return (tx) => tx.moveCall({
|
|
290
|
+
package: packageAddress,
|
|
291
|
+
module: 'oracle',
|
|
292
|
+
function: 'unsafe_get_latest_price',
|
|
293
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
export function isListed(options) {
|
|
297
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
298
|
+
const argumentsTypes = [
|
|
299
|
+
null,
|
|
300
|
+
'0x1::string::String'
|
|
301
|
+
];
|
|
302
|
+
const parameterNames = ["oracle", "ticker"];
|
|
303
|
+
return (tx) => tx.moveCall({
|
|
304
|
+
package: packageAddress,
|
|
305
|
+
module: 'oracle',
|
|
306
|
+
function: 'is_listed',
|
|
307
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
export function aggregator(options) {
|
|
311
|
+
const packageAddress = options.package ?? '@waterx/oracle';
|
|
312
|
+
const argumentsTypes = [
|
|
313
|
+
null,
|
|
314
|
+
'0x1::string::String'
|
|
315
|
+
];
|
|
316
|
+
const parameterNames = ["oracle", "ticker"];
|
|
317
|
+
return (tx) => tx.moveCall({
|
|
318
|
+
package: packageAddress,
|
|
319
|
+
module: 'oracle',
|
|
320
|
+
function: 'aggregator',
|
|
321
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
322
|
+
});
|
|
323
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
5
|
+
export interface PackageVersionOptions {
|
|
6
|
+
package?: string;
|
|
7
|
+
arguments?: [
|
|
8
|
+
];
|
|
9
|
+
}
|
|
10
|
+
export declare function packageVersion(options?: PackageVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|