@waterx/sdk 2.4.1 → 3.0.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 +25 -21
- package/dist/src/{utils → account}/account-request.d.ts +2 -2
- package/dist/src/{user → account}/account.d.ts +23 -21
- package/dist/src/{user → account}/account.js +5 -5
- package/dist/src/account/client.d.ts +42 -0
- package/dist/src/account/client.js +17 -0
- package/dist/src/account/config.d.ts +151 -0
- package/dist/src/account/config.js +8 -0
- package/dist/src/account/constants.d.ts +5 -0
- package/dist/src/account/constants.js +5 -0
- package/dist/src/account/fetch/referral.d.ts +15 -0
- package/dist/src/account/fetch/referral.js +51 -0
- package/dist/src/account/fetch/simulate.d.ts +34 -0
- package/dist/src/account/fetch/simulate.js +43 -0
- package/dist/src/{utils/consolidate-balance.d.ts → account/funding/balance.d.ts} +3 -8
- package/dist/src/{utils/consolidate-balance.js → account/funding/balance.js} +6 -1
- package/dist/src/account/funding/consolidate.d.ts +46 -0
- package/dist/src/account/funding/consolidate.js +137 -0
- package/dist/src/{user → account/funding}/credit.d.ts +10 -10
- package/dist/src/{user → account/funding}/credit.js +6 -6
- package/dist/src/{user → account/funding}/custody.d.ts +4 -4
- package/dist/src/{user → account/funding}/custody.js +2 -2
- package/dist/src/{utils → account/funding}/wormhole.d.ts +4 -4
- package/dist/src/{utils → account/funding}/wormhole.js +1 -1
- package/dist/src/account/index.d.ts +29 -0
- package/dist/src/account/index.js +29 -0
- package/dist/src/{user → account}/referral.d.ts +3 -3
- package/dist/src/{user → account}/referral.js +1 -1
- package/dist/src/base-client.d.ts +74 -0
- package/dist/src/base-client.js +97 -0
- package/dist/src/constants.d.ts +4 -46
- package/dist/src/constants.js +8 -52
- package/dist/src/generated/bucket_v2_framework/liability.d.ts +0 -26
- package/dist/src/generated/bucket_v2_framework/liability.js +0 -28
- package/dist/src/generated/waterx_account/account.d.ts +50 -15
- package/dist/src/generated/waterx_account/account.js +51 -15
- package/dist/src/generated/waterx_oracle/oracle.d.ts +7 -1
- package/dist/src/generated/waterx_oracle/oracle.js +7 -2
- package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.d.ts +19 -2
- package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.d.ts +3 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/sui/balance.d.ts +3 -1
- package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.d.ts +6 -1
- package/dist/src/generated/waterx_prediction/events.d.ts +288 -0
- package/dist/src/{prediction/generated → generated}/waterx_prediction/events.js +39 -0
- package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.d.ts +6 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/order.d.ts +34 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/position.d.ts +16 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/view.d.ts +69 -4
- package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.d.ts +162 -2
- package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.js +99 -0
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +102 -0
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +99 -0
- package/dist/src/generated/waterx_supra_rule/supra_rule.d.ts +5 -5
- package/dist/src/generated/waterx_supra_rule/supra_rule.js +1 -2
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +23 -23
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +3 -6
- package/dist/src/oracle/aggregate.d.ts +74 -0
- package/dist/src/oracle/aggregate.js +112 -0
- package/dist/src/oracle/config.d.ts +99 -0
- package/dist/src/oracle/config.js +23 -0
- package/dist/src/oracle/host.d.ts +32 -0
- package/dist/src/oracle/host.js +10 -0
- package/dist/src/oracle/index.d.ts +16 -0
- package/dist/src/oracle/index.js +18 -0
- package/dist/src/oracle/pyth.d.ts +52 -0
- package/dist/src/oracle/pyth.js +220 -0
- package/dist/src/oracle/rules/constant-rule.d.ts +9 -0
- package/dist/src/oracle/rules/constant-rule.js +14 -0
- package/dist/src/oracle/rules/pyth-rule.d.ts +11 -0
- package/dist/src/oracle/rules/pyth-rule.js +20 -0
- package/dist/src/oracle/rules/sponsor.d.ts +28 -0
- package/dist/src/oracle/rules/sponsor.js +48 -0
- package/dist/src/oracle/rules/supra-rule.d.ts +11 -0
- package/dist/src/oracle/rules/supra-rule.js +22 -0
- package/dist/src/perp/client.d.ts +78 -0
- package/dist/src/perp/client.js +108 -0
- package/dist/src/{client.d.ts → perp/config-view.d.ts} +15 -60
- package/dist/src/{client.js → perp/config-view.js} +23 -95
- package/dist/src/perp/config.d.ts +126 -0
- package/dist/src/{config.js → perp/config.js} +11 -12
- package/dist/src/perp/constants.d.ts +49 -0
- package/dist/src/perp/constants.js +61 -0
- package/dist/src/perp/fetch/account.d.ts +43 -0
- package/dist/src/perp/fetch/account.js +64 -0
- package/dist/src/perp/fetch/bridge.d.ts +90 -0
- package/dist/src/perp/fetch/bridge.js +127 -0
- package/dist/src/perp/fetch/custody.d.ts +32 -0
- package/dist/src/perp/fetch/custody.js +62 -0
- package/dist/src/perp/fetch/market.d.ts +30 -0
- package/dist/src/perp/fetch/market.js +68 -0
- package/dist/src/perp/fetch/positions.d.ts +70 -0
- package/dist/src/perp/fetch/positions.js +185 -0
- package/dist/src/perp/fetch/simulate.d.ts +12 -0
- package/dist/src/perp/fetch/simulate.js +13 -0
- package/dist/src/perp/fetch.d.ts +23 -0
- package/dist/src/perp/fetch.js +23 -0
- package/dist/src/{index.d.ts → perp/index.d.ts} +21 -21
- package/dist/src/{index.js → perp/index.js} +21 -21
- package/dist/src/perp/tx-builders/common.d.ts +83 -0
- package/dist/src/perp/tx-builders/common.js +70 -0
- package/dist/src/perp/tx-builders/credit.d.ts +65 -0
- package/dist/src/perp/tx-builders/credit.js +62 -0
- package/dist/src/perp/tx-builders/rewards.d.ts +30 -0
- package/dist/src/perp/tx-builders/rewards.js +34 -0
- package/dist/src/perp/tx-builders/trading.d.ts +51 -0
- package/dist/src/perp/tx-builders/trading.js +59 -0
- package/dist/src/perp/tx-builders/wlp.d.ts +90 -0
- package/dist/src/perp/tx-builders/wlp.js +120 -0
- package/dist/src/perp/tx-builders.d.ts +23 -0
- package/dist/src/perp/tx-builders.js +23 -0
- package/dist/src/perp/user/index.d.ts +8 -0
- package/dist/src/perp/user/index.js +8 -0
- package/dist/src/{user → perp/user}/order.d.ts +7 -7
- package/dist/src/{user → perp/user}/order.js +3 -3
- package/dist/src/{user → perp/user}/staking.d.ts +4 -4
- package/dist/src/{user → perp/user}/staking.js +2 -2
- package/dist/src/{user → perp/user}/trading.d.ts +13 -13
- package/dist/src/{user → perp/user}/trading.js +2 -2
- package/dist/src/{user → perp/user}/wlp.d.ts +7 -7
- package/dist/src/{user → perp/user}/wlp.js +3 -3
- package/dist/src/prediction/account.js +40 -76
- package/dist/src/prediction/client.d.ts +8 -38
- package/dist/src/prediction/client.js +11 -67
- package/dist/src/prediction/config.d.ts +16 -2
- package/dist/src/prediction/config.js +10 -4
- package/dist/src/prediction/index.d.ts +11 -11
- package/dist/src/prediction/index.js +10 -10
- package/dist/src/prediction/prediction.d.ts +45 -0
- package/dist/src/prediction/prediction.js +71 -0
- package/dist/src/prediction/tx-builders.d.ts +4 -4
- package/dist/src/prediction/tx-builders.js +2 -2
- package/dist/src/prediction/user/index.d.ts +2 -2
- package/dist/src/prediction/user/index.js +1 -1
- package/dist/src/prediction/user/position.d.ts +2 -2
- package/dist/src/prediction/user/position.js +1 -1
- package/dist/src/prediction/utils/bcs.d.ts +5 -0
- package/dist/src/prediction/utils/bcs.js +5 -0
- package/dist/src/prediction/utils/index.d.ts +7 -0
- package/dist/src/prediction/utils/index.js +7 -0
- package/dist/src/sdk.d.ts +10 -6
- package/dist/src/sdk.js +9 -5
- package/dist/src/unified-client.d.ts +140 -145
- package/dist/src/unified-client.js +98 -40
- package/dist/src/utils/config.d.ts +1 -1
- package/package.json +22 -5
- package/dist/src/config.d.ts +0 -292
- package/dist/src/fetch.d.ts +0 -254
- package/dist/src/fetch.js +0 -564
- package/dist/src/prediction/generated/bucket_v2_framework/account.d.ts +0 -100
- package/dist/src/prediction/generated/bucket_v2_framework/account.js +0 -129
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.d.ts +0 -6
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.js +0 -19
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.d.ts +0 -10
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +0 -36
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.js +0 -27
- package/dist/src/prediction/generated/bucket_v2_framework/double.d.ts +0 -382
- package/dist/src/prediction/generated/bucket_v2_framework/double.js +0 -466
- package/dist/src/prediction/generated/bucket_v2_framework/float.d.ts +0 -362
- package/dist/src/prediction/generated/bucket_v2_framework/float.js +0 -440
- package/dist/src/prediction/generated/bucket_v2_framework/liability.d.ts +0 -193
- package/dist/src/prediction/generated/bucket_v2_framework/liability.js +0 -205
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.d.ts +0 -384
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.js +0 -382
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.d.ts +0 -344
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.js +0 -338
- package/dist/src/prediction/generated/utils/index.d.ts +0 -30
- package/dist/src/prediction/generated/utils/index.js +0 -160
- package/dist/src/prediction/generated/waterx_account/account.d.ts +0 -1589
- package/dist/src/prediction/generated/waterx_account/account.js +0 -1758
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +0 -7
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.js +0 -13
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +0 -7
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.js +0 -16
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.d.ts +0 -6
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.js +0 -19
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.d.ts +0 -10
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.js +0 -14
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.d.ts +0 -12
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.js +0 -19
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.d.ts +0 -36
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.js +0 -27
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.d.ts +0 -16
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.js +0 -19
- package/dist/src/prediction/generated/waterx_account/direct_rule.d.ts +0 -75
- package/dist/src/prediction/generated/waterx_account/direct_rule.js +0 -78
- package/dist/src/prediction/generated/waterx_account/events.d.ts +0 -33
- package/dist/src/prediction/generated/waterx_account/events.js +0 -137
- package/dist/src/prediction/generated/waterx_account/version.js +0 -8
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.d.ts +0 -60
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.js +0 -83
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.js +0 -14
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.d.ts +0 -24
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.js +0 -31
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.d.ts +0 -16
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.js +0 -19
- package/dist/src/prediction/generated/waterx_prediction/events.d.ts +0 -22
- package/dist/src/prediction/generated/waterx_prediction/version.d.ts +0 -10
- package/dist/src/tx-builders.d.ts +0 -296
- package/dist/src/tx-builders.js +0 -461
- package/dist/src/user/index.d.ts +0 -8
- package/dist/src/user/index.js +0 -8
- package/dist/src/utils/pyth.d.ts +0 -124
- package/dist/src/utils/pyth.js +0 -392
- /package/dist/src/{utils → account}/account-request.js +0 -0
- /package/dist/src/{core → account}/waterx-account.d.ts +0 -0
- /package/dist/src/{core → account}/waterx-account.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.js +0 -0
- /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/balance.js +0 -0
- /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.js +0 -0
- /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.d.ts +0 -0
- /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/order.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.d.ts +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/position.js +0 -0
- /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/version.d.ts +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/version.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/view.js +0 -0
package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.d.ts
RENAMED
|
@@ -3,9 +3,75 @@
|
|
|
3
3
|
**************************************************************/
|
|
4
4
|
import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
|
|
5
5
|
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
6
|
-
export declare const MarketRegistry: MoveStruct<
|
|
6
|
+
export declare const MarketRegistry: MoveStruct<{
|
|
7
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
8
|
+
/** One shared settlement pool for all markets using coin type `T`. */
|
|
9
|
+
balance: MoveStruct<{
|
|
10
|
+
value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
11
|
+
}, "0x2::balance::Balance<phantom T>">;
|
|
12
|
+
/** Exact market lookup: external market id bytes -> linked-table key. */
|
|
13
|
+
market_id_map: MoveStruct<{
|
|
14
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
15
|
+
size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
16
|
+
}, "0x2::table::Table<phantom K, phantom V>">;
|
|
17
|
+
unresolved_markets: MoveStruct<any, any>;
|
|
18
|
+
resolved_markets: MoveStruct<any, any>;
|
|
19
|
+
/** Set of market keys where new opens are blocked. Presence = paused. */
|
|
20
|
+
paused_markets: MoveStruct<{
|
|
21
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
22
|
+
size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
23
|
+
}, "0x2::table::Table<phantom K, phantom V>">;
|
|
24
|
+
/** Pending open and close orders waiting for broker/keeper execution. */
|
|
25
|
+
orders: MoveStruct<any, any>;
|
|
26
|
+
/** Filled positions with active Polymarket exposure. */
|
|
27
|
+
positions: MoveStruct<any, any>;
|
|
28
|
+
/**
|
|
29
|
+
* Filled order id -> filled position id. Split positions are independent positions
|
|
30
|
+
* and are not indexed here.
|
|
31
|
+
*/
|
|
32
|
+
position_id_by_order: MoveStruct<{
|
|
33
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
34
|
+
size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
35
|
+
}, "0x2::table::Table<phantom K, phantom V>">;
|
|
36
|
+
/**
|
|
37
|
+
* Reverse index for cleaning `position_id_by_order` when the filled position is
|
|
38
|
+
* claimed or closed.
|
|
39
|
+
*/
|
|
40
|
+
order_id_by_position: MoveStruct<{
|
|
41
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
42
|
+
size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
43
|
+
}, "0x2::table::Table<phantom K, phantom V>">;
|
|
44
|
+
next_order_id: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
45
|
+
next_position_id: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
46
|
+
next_market_key: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
47
|
+
/** Minimum time after order placement before user self-cancel is allowed. */
|
|
48
|
+
order_cancel_cooldown_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
49
|
+
/** Floor balance that `admin_withdraw` must respect. */
|
|
50
|
+
min_reserve: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
51
|
+
}, "@waterx/prediction::waterx_prediction::MarketRegistry<phantom T>">;
|
|
7
52
|
export declare const Market: MoveStruct<any, any>;
|
|
8
|
-
export declare const MarketPointer: MoveStruct<
|
|
53
|
+
export declare const MarketPointer: MoveStruct<{
|
|
54
|
+
key: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
55
|
+
resolved: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
|
|
56
|
+
}, "@waterx/prediction::waterx_prediction::MarketPointer">;
|
|
57
|
+
export declare const PriceSettlement: MoveStruct<{
|
|
58
|
+
/** Oracle ticker to read, e.g. "BTCUSD". */
|
|
59
|
+
settle_ticker: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
60
|
+
/**
|
|
61
|
+
* Exact snapshot timestamp to read (must already be registered on-chain via
|
|
62
|
+
* `oracle::register_price_at_timestamp`).
|
|
63
|
+
*/
|
|
64
|
+
settle_timestamp_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
65
|
+
/** 1e9-scaled `Float` raw value the price is compared against. */
|
|
66
|
+
threshold: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u128">;
|
|
67
|
+
/** One of CMP_GT / CMP_GTE / CMP_LT / CMP_LTE. */
|
|
68
|
+
comparison: import("@mysten/sui/bcs").BcsType<number, number, "u8">;
|
|
69
|
+
}, "@waterx/prediction::waterx_prediction::PriceSettlement">;
|
|
70
|
+
export declare const PriceSettlementKey: MoveStruct<{
|
|
71
|
+
market_id: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
|
|
72
|
+
length: number;
|
|
73
|
+
}, string>;
|
|
74
|
+
}, "@waterx/prediction::waterx_prediction::PriceSettlementKey">;
|
|
9
75
|
export interface CreateMarketRegistryArguments {
|
|
10
76
|
_: RawTransactionArgument<string>;
|
|
11
77
|
}
|
|
@@ -141,6 +207,41 @@ export interface RequestCloseOptions {
|
|
|
141
207
|
* if the market has already resolved.
|
|
142
208
|
*/
|
|
143
209
|
export declare function requestClose(options: RequestCloseOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
210
|
+
export interface RequestPartialCloseArguments {
|
|
211
|
+
globalConfig: RawTransactionArgument<string>;
|
|
212
|
+
marketRegistry: RawTransactionArgument<string>;
|
|
213
|
+
wxaRegistry: RawTransactionArgument<string>;
|
|
214
|
+
senderRequest: TransactionArgument;
|
|
215
|
+
positionId: RawTransactionArgument<number | bigint>;
|
|
216
|
+
closeShares: RawTransactionArgument<number | bigint>;
|
|
217
|
+
minProceeds: RawTransactionArgument<number | bigint>;
|
|
218
|
+
expiryTs: RawTransactionArgument<number | bigint>;
|
|
219
|
+
}
|
|
220
|
+
export interface RequestPartialCloseOptions {
|
|
221
|
+
package?: string;
|
|
222
|
+
arguments: RequestPartialCloseArguments | [
|
|
223
|
+
globalConfig: RawTransactionArgument<string>,
|
|
224
|
+
marketRegistry: RawTransactionArgument<string>,
|
|
225
|
+
wxaRegistry: RawTransactionArgument<string>,
|
|
226
|
+
senderRequest: TransactionArgument,
|
|
227
|
+
positionId: RawTransactionArgument<number | bigint>,
|
|
228
|
+
closeShares: RawTransactionArgument<number | bigint>,
|
|
229
|
+
minProceeds: RawTransactionArgument<number | bigint>,
|
|
230
|
+
expiryTs: RawTransactionArgument<number | bigint>
|
|
231
|
+
];
|
|
232
|
+
typeArguments: [
|
|
233
|
+
string
|
|
234
|
+
];
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Account-backed partial close. Splits `close_shares` off `position_id` into a new
|
|
238
|
+
* same-account position and runs the close flow on it; the remainder stays `Open`
|
|
239
|
+
* under `position_id`. Auth `PERM_REQUEST_CLOSE` — value stays in the account, so
|
|
240
|
+
* unlike `split_position` it is not transfer-equivalent. Emits a dedicated
|
|
241
|
+
* `PartialCloseRequested` plus `PositionSplit` (from == to) and `CloseRequested`
|
|
242
|
+
* for the new position. Returns the new PendingClose position id.
|
|
243
|
+
*/
|
|
244
|
+
export declare function requestPartialClose(options: RequestPartialCloseOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
144
245
|
export interface SelfCancelCloseArguments {
|
|
145
246
|
globalConfig: RawTransactionArgument<string>;
|
|
146
247
|
marketRegistry: RawTransactionArgument<string>;
|
|
@@ -514,6 +615,65 @@ export interface ResolveMarketOptions {
|
|
|
514
615
|
}
|
|
515
616
|
/** Keeper records the market outcome. Aborts if already resolved. */
|
|
516
617
|
export declare function resolveMarket(options: ResolveMarketOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
618
|
+
export interface SetPriceSettlementArguments {
|
|
619
|
+
_: RawTransactionArgument<string>;
|
|
620
|
+
marketRegistry: RawTransactionArgument<string>;
|
|
621
|
+
marketId: RawTransactionArgument<Array<number>>;
|
|
622
|
+
settleTicker: RawTransactionArgument<string>;
|
|
623
|
+
settleTimestampMs: RawTransactionArgument<number | bigint>;
|
|
624
|
+
threshold: RawTransactionArgument<number | bigint>;
|
|
625
|
+
comparison: RawTransactionArgument<number>;
|
|
626
|
+
}
|
|
627
|
+
export interface SetPriceSettlementOptions {
|
|
628
|
+
package?: string;
|
|
629
|
+
arguments: SetPriceSettlementArguments | [
|
|
630
|
+
_: RawTransactionArgument<string>,
|
|
631
|
+
marketRegistry: RawTransactionArgument<string>,
|
|
632
|
+
marketId: RawTransactionArgument<Array<number>>,
|
|
633
|
+
settleTicker: RawTransactionArgument<string>,
|
|
634
|
+
settleTimestampMs: RawTransactionArgument<number | bigint>,
|
|
635
|
+
threshold: RawTransactionArgument<number | bigint>,
|
|
636
|
+
comparison: RawTransactionArgument<number>
|
|
637
|
+
];
|
|
638
|
+
typeArguments: [
|
|
639
|
+
string
|
|
640
|
+
];
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Admin pre-commits the price-settlement config for a market. Stored as a dynamic
|
|
644
|
+
* field on the registry; re-calling overwrites (until resolved).
|
|
645
|
+
*/
|
|
646
|
+
export declare function setPriceSettlement(options: SetPriceSettlementOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
647
|
+
export interface ResolveWithOracleArguments {
|
|
648
|
+
globalConfig: RawTransactionArgument<string>;
|
|
649
|
+
keeperRequest: TransactionArgument;
|
|
650
|
+
marketRegistry: RawTransactionArgument<string>;
|
|
651
|
+
oracle: RawTransactionArgument<string>;
|
|
652
|
+
marketId: RawTransactionArgument<Array<number>>;
|
|
653
|
+
}
|
|
654
|
+
export interface ResolveWithOracleOptions {
|
|
655
|
+
package?: string;
|
|
656
|
+
arguments: ResolveWithOracleArguments | [
|
|
657
|
+
globalConfig: RawTransactionArgument<string>,
|
|
658
|
+
keeperRequest: TransactionArgument,
|
|
659
|
+
marketRegistry: RawTransactionArgument<string>,
|
|
660
|
+
oracle: RawTransactionArgument<string>,
|
|
661
|
+
marketId: RawTransactionArgument<Array<number>>
|
|
662
|
+
];
|
|
663
|
+
typeArguments: [
|
|
664
|
+
string
|
|
665
|
+
];
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Keeper resolves a price-settled market from an on-chain oracle snapshot. The
|
|
669
|
+
* price at `settle_timestamp_ms` must already be registered on the oracle (the
|
|
670
|
+
* keeper PTB submits `waterx_rule::quote_for_timestamp` →
|
|
671
|
+
* `oracle::register_price_at_timestamp` before calling this). The outcome is
|
|
672
|
+
* derived from the pre-committed threshold + comparison, so the keeper cannot
|
|
673
|
+
* influence the result beyond triggering it. Aborts if no settlement is set or the
|
|
674
|
+
* market is already resolved.
|
|
675
|
+
*/
|
|
676
|
+
export declare function resolveWithOracle(options: ResolveWithOracleOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
517
677
|
export interface PauseMarketArguments {
|
|
518
678
|
_: RawTransactionArgument<string>;
|
|
519
679
|
marketRegistry: RawTransactionArgument<string>;
|
|
@@ -60,6 +60,22 @@ export const MarketPointer = new MoveStruct({ name: `${$moduleName}::MarketPoint
|
|
|
60
60
|
key: bcs.u64(),
|
|
61
61
|
resolved: bcs.bool()
|
|
62
62
|
} });
|
|
63
|
+
export const PriceSettlement = new MoveStruct({ name: `${$moduleName}::PriceSettlement`, fields: {
|
|
64
|
+
/** Oracle ticker to read, e.g. "BTCUSD". */
|
|
65
|
+
settle_ticker: bcs.string(),
|
|
66
|
+
/**
|
|
67
|
+
* Exact snapshot timestamp to read (must already be registered on-chain via
|
|
68
|
+
* `oracle::register_price_at_timestamp`).
|
|
69
|
+
*/
|
|
70
|
+
settle_timestamp_ms: bcs.u64(),
|
|
71
|
+
/** 1e9-scaled `Float` raw value the price is compared against. */
|
|
72
|
+
threshold: bcs.u128(),
|
|
73
|
+
/** One of CMP_GT / CMP_GTE / CMP_LT / CMP_LTE. */
|
|
74
|
+
comparison: bcs.u8()
|
|
75
|
+
} });
|
|
76
|
+
export const PriceSettlementKey = new MoveStruct({ name: `${$moduleName}::PriceSettlementKey`, fields: {
|
|
77
|
+
market_id: bcs.vector(bcs.u8())
|
|
78
|
+
} });
|
|
63
79
|
/**
|
|
64
80
|
* Admin-only: spin up the shared market registry object for coin type `T`. All
|
|
65
81
|
* markets for this coin type should settle through this object.
|
|
@@ -179,6 +195,36 @@ export function requestClose(options) {
|
|
|
179
195
|
typeArguments: options.typeArguments
|
|
180
196
|
});
|
|
181
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Account-backed partial close. Splits `close_shares` off `position_id` into a new
|
|
200
|
+
* same-account position and runs the close flow on it; the remainder stays `Open`
|
|
201
|
+
* under `position_id`. Auth `PERM_REQUEST_CLOSE` — value stays in the account, so
|
|
202
|
+
* unlike `split_position` it is not transfer-equivalent. Emits a dedicated
|
|
203
|
+
* `PartialCloseRequested` plus `PositionSplit` (from == to) and `CloseRequested`
|
|
204
|
+
* for the new position. Returns the new PendingClose position id.
|
|
205
|
+
*/
|
|
206
|
+
export function requestPartialClose(options) {
|
|
207
|
+
const packageAddress = options.package ?? '@waterx/prediction';
|
|
208
|
+
const argumentsTypes = [
|
|
209
|
+
null,
|
|
210
|
+
null,
|
|
211
|
+
null,
|
|
212
|
+
null,
|
|
213
|
+
'u64',
|
|
214
|
+
'u64',
|
|
215
|
+
'u64',
|
|
216
|
+
'u64',
|
|
217
|
+
'0x2::clock::Clock'
|
|
218
|
+
];
|
|
219
|
+
const parameterNames = ["globalConfig", "marketRegistry", "wxaRegistry", "senderRequest", "positionId", "closeShares", "minProceeds", "expiryTs"];
|
|
220
|
+
return (tx) => tx.moveCall({
|
|
221
|
+
package: packageAddress,
|
|
222
|
+
module: 'waterx_prediction',
|
|
223
|
+
function: 'request_partial_close',
|
|
224
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
225
|
+
typeArguments: options.typeArguments
|
|
226
|
+
});
|
|
227
|
+
}
|
|
182
228
|
/** Account-backed PendingClose rescue. Reverts the position to Open. */
|
|
183
229
|
export function selfCancelClose(options) {
|
|
184
230
|
const packageAddress = options.package ?? '@waterx/prediction';
|
|
@@ -516,6 +562,59 @@ export function resolveMarket(options) {
|
|
|
516
562
|
typeArguments: options.typeArguments
|
|
517
563
|
});
|
|
518
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* Admin pre-commits the price-settlement config for a market. Stored as a dynamic
|
|
567
|
+
* field on the registry; re-calling overwrites (until resolved).
|
|
568
|
+
*/
|
|
569
|
+
export function setPriceSettlement(options) {
|
|
570
|
+
const packageAddress = options.package ?? '@waterx/prediction';
|
|
571
|
+
const argumentsTypes = [
|
|
572
|
+
null,
|
|
573
|
+
null,
|
|
574
|
+
'vector<u8>',
|
|
575
|
+
'0x1::string::String',
|
|
576
|
+
'u64',
|
|
577
|
+
'u128',
|
|
578
|
+
'u8',
|
|
579
|
+
'0x2::clock::Clock'
|
|
580
|
+
];
|
|
581
|
+
const parameterNames = ["_", "marketRegistry", "marketId", "settleTicker", "settleTimestampMs", "threshold", "comparison"];
|
|
582
|
+
return (tx) => tx.moveCall({
|
|
583
|
+
package: packageAddress,
|
|
584
|
+
module: 'waterx_prediction',
|
|
585
|
+
function: 'set_price_settlement',
|
|
586
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
587
|
+
typeArguments: options.typeArguments
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Keeper resolves a price-settled market from an on-chain oracle snapshot. The
|
|
592
|
+
* price at `settle_timestamp_ms` must already be registered on the oracle (the
|
|
593
|
+
* keeper PTB submits `waterx_rule::quote_for_timestamp` →
|
|
594
|
+
* `oracle::register_price_at_timestamp` before calling this). The outcome is
|
|
595
|
+
* derived from the pre-committed threshold + comparison, so the keeper cannot
|
|
596
|
+
* influence the result beyond triggering it. Aborts if no settlement is set or the
|
|
597
|
+
* market is already resolved.
|
|
598
|
+
*/
|
|
599
|
+
export function resolveWithOracle(options) {
|
|
600
|
+
const packageAddress = options.package ?? '@waterx/prediction';
|
|
601
|
+
const argumentsTypes = [
|
|
602
|
+
null,
|
|
603
|
+
null,
|
|
604
|
+
null,
|
|
605
|
+
null,
|
|
606
|
+
'vector<u8>',
|
|
607
|
+
'0x2::clock::Clock'
|
|
608
|
+
];
|
|
609
|
+
const parameterNames = ["globalConfig", "keeperRequest", "marketRegistry", "oracle", "marketId"];
|
|
610
|
+
return (tx) => tx.moveCall({
|
|
611
|
+
package: packageAddress,
|
|
612
|
+
module: 'waterx_prediction',
|
|
613
|
+
function: 'resolve_with_oracle',
|
|
614
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
615
|
+
typeArguments: options.typeArguments
|
|
616
|
+
});
|
|
617
|
+
}
|
|
519
618
|
/**
|
|
520
619
|
* Admin pauses new opens for a specific market. Existing positions unaffected. If
|
|
521
620
|
* the market does not exist yet, this creates market metadata and emits
|
|
@@ -35,6 +35,25 @@ export declare const Config: MoveStruct<{
|
|
|
35
35
|
}, string>;
|
|
36
36
|
}, "0x2::vec_map::VecMap<string, u64>">;
|
|
37
37
|
}, "@waterx/pyth-rule::pyth_rule::Config">;
|
|
38
|
+
export declare const MaxConfBpsKey: MoveStruct<{
|
|
39
|
+
dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
|
|
40
|
+
}, "@waterx/pyth-rule::pyth_rule::MaxConfBpsKey">;
|
|
41
|
+
export declare const MaxConfBpsConfig: MoveStruct<{
|
|
42
|
+
/** Default max confidence band (bps of price) for symbols without an override. */
|
|
43
|
+
default_bps: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
44
|
+
/** Per-symbol overrides. */
|
|
45
|
+
by_symbol: MoveStruct<{
|
|
46
|
+
contents: import("@mysten/sui/bcs").BcsType<{
|
|
47
|
+
key: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}[], Iterable<{
|
|
50
|
+
key: string;
|
|
51
|
+
value: string | number | bigint;
|
|
52
|
+
}> & {
|
|
53
|
+
length: number;
|
|
54
|
+
}, string>;
|
|
55
|
+
}, "0x2::vec_map::VecMap<string, u64>">;
|
|
56
|
+
}, "@waterx/pyth-rule::pyth_rule::MaxConfBpsConfig">;
|
|
38
57
|
export interface FeedArguments {
|
|
39
58
|
collector: TransactionArgument;
|
|
40
59
|
config: RawTransactionArgument<string>;
|
|
@@ -88,3 +107,86 @@ export interface SetToleranceSecOptions {
|
|
|
88
107
|
];
|
|
89
108
|
}
|
|
90
109
|
export declare function setToleranceSec(options: SetToleranceSecOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
110
|
+
export interface SetDefaultMaxConfidenceBpsArguments {
|
|
111
|
+
config: RawTransactionArgument<string>;
|
|
112
|
+
Cap: RawTransactionArgument<string>;
|
|
113
|
+
defaultBps: RawTransactionArgument<number | bigint>;
|
|
114
|
+
}
|
|
115
|
+
export interface SetDefaultMaxConfidenceBpsOptions {
|
|
116
|
+
package?: string;
|
|
117
|
+
arguments: SetDefaultMaxConfidenceBpsArguments | [
|
|
118
|
+
config: RawTransactionArgument<string>,
|
|
119
|
+
Cap: RawTransactionArgument<string>,
|
|
120
|
+
defaultBps: RawTransactionArgument<number | bigint>
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Sets the default confidence gate (bps of price) applied to symbols without an
|
|
125
|
+
* explicit override. `10_000` = 100%. Lazily creates the confidence-gate DF.
|
|
126
|
+
*/
|
|
127
|
+
export declare function setDefaultMaxConfidenceBps(options: SetDefaultMaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
128
|
+
export interface SetSymbolMaxConfidenceBpsArguments {
|
|
129
|
+
config: RawTransactionArgument<string>;
|
|
130
|
+
Cap: RawTransactionArgument<string>;
|
|
131
|
+
symbol: RawTransactionArgument<string>;
|
|
132
|
+
bps: RawTransactionArgument<number | bigint>;
|
|
133
|
+
}
|
|
134
|
+
export interface SetSymbolMaxConfidenceBpsOptions {
|
|
135
|
+
package?: string;
|
|
136
|
+
arguments: SetSymbolMaxConfidenceBpsArguments | [
|
|
137
|
+
config: RawTransactionArgument<string>,
|
|
138
|
+
Cap: RawTransactionArgument<string>,
|
|
139
|
+
symbol: RawTransactionArgument<string>,
|
|
140
|
+
bps: RawTransactionArgument<number | bigint>
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
/** Sets a per-symbol confidence gate (bps of price), overriding the default. */
|
|
144
|
+
export declare function setSymbolMaxConfidenceBps(options: SetSymbolMaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
145
|
+
export interface UnsetSymbolMaxConfidenceBpsArguments {
|
|
146
|
+
config: RawTransactionArgument<string>;
|
|
147
|
+
Cap: RawTransactionArgument<string>;
|
|
148
|
+
symbol: RawTransactionArgument<string>;
|
|
149
|
+
}
|
|
150
|
+
export interface UnsetSymbolMaxConfidenceBpsOptions {
|
|
151
|
+
package?: string;
|
|
152
|
+
arguments: UnsetSymbolMaxConfidenceBpsArguments | [
|
|
153
|
+
config: RawTransactionArgument<string>,
|
|
154
|
+
Cap: RawTransactionArgument<string>,
|
|
155
|
+
symbol: RawTransactionArgument<string>
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Removes a per-symbol confidence override (no-op if absent); the symbol then
|
|
160
|
+
* falls back to the default.
|
|
161
|
+
*/
|
|
162
|
+
export declare function unsetSymbolMaxConfidenceBps(options: UnsetSymbolMaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
163
|
+
export interface MaxConfidenceBpsArguments {
|
|
164
|
+
config: RawTransactionArgument<string>;
|
|
165
|
+
symbol: RawTransactionArgument<string>;
|
|
166
|
+
}
|
|
167
|
+
export interface MaxConfidenceBpsOptions {
|
|
168
|
+
package?: string;
|
|
169
|
+
arguments: MaxConfidenceBpsArguments | [
|
|
170
|
+
config: RawTransactionArgument<string>,
|
|
171
|
+
symbol: RawTransactionArgument<string>
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The effective confidence gate (bps of price) `feed` applies for `symbol`:
|
|
176
|
+
* per-symbol override → default → `DEFAULT_MAX_CONFIDENCE_BPS`.
|
|
177
|
+
*/
|
|
178
|
+
export declare function maxConfidenceBps(options: MaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
179
|
+
export interface DefaultMaxConfidenceBpsArguments {
|
|
180
|
+
config: RawTransactionArgument<string>;
|
|
181
|
+
}
|
|
182
|
+
export interface DefaultMaxConfidenceBpsOptions {
|
|
183
|
+
package?: string;
|
|
184
|
+
arguments: DefaultMaxConfidenceBpsArguments | [
|
|
185
|
+
config: RawTransactionArgument<string>
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The configured default confidence gate, or `DEFAULT_MAX_CONFIDENCE_BPS` if
|
|
190
|
+
* unset.
|
|
191
|
+
*/
|
|
192
|
+
export declare function defaultMaxConfidenceBps(options: DefaultMaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -15,6 +15,15 @@ export const Config = new MoveStruct({ name: `${$moduleName}::Config`, fields: {
|
|
|
15
15
|
/** Per-ticker timestamp tolerance in seconds. Falls back to DEFAULT_TOLERANCE_SEC. */
|
|
16
16
|
tolerance_sec_map: vec_map.VecMap(bcs.string(), bcs.u64())
|
|
17
17
|
} });
|
|
18
|
+
export const MaxConfBpsKey = new MoveStruct({ name: `${$moduleName}::MaxConfBpsKey`, fields: {
|
|
19
|
+
dummy_field: bcs.bool()
|
|
20
|
+
} });
|
|
21
|
+
export const MaxConfBpsConfig = new MoveStruct({ name: `${$moduleName}::MaxConfBpsConfig`, fields: {
|
|
22
|
+
/** Default max confidence band (bps of price) for symbols without an override. */
|
|
23
|
+
default_bps: bcs.u64(),
|
|
24
|
+
/** Per-symbol overrides. */
|
|
25
|
+
by_symbol: vec_map.VecMap(bcs.string(), bcs.u64())
|
|
26
|
+
} });
|
|
18
27
|
/**
|
|
19
28
|
* Reads a Pyth price for `collector.symbol()` and feeds it. Drops the value
|
|
20
29
|
* (records `none`) if the on-chain timestamp diverges from the Pyth feed timestamp
|
|
@@ -69,3 +78,93 @@ export function setToleranceSec(options) {
|
|
|
69
78
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
70
79
|
});
|
|
71
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Sets the default confidence gate (bps of price) applied to symbols without an
|
|
83
|
+
* explicit override. `10_000` = 100%. Lazily creates the confidence-gate DF.
|
|
84
|
+
*/
|
|
85
|
+
export function setDefaultMaxConfidenceBps(options) {
|
|
86
|
+
const packageAddress = options.package ?? '@waterx/pyth-rule';
|
|
87
|
+
const argumentsTypes = [
|
|
88
|
+
null,
|
|
89
|
+
null,
|
|
90
|
+
'u64'
|
|
91
|
+
];
|
|
92
|
+
const parameterNames = ["config", "Cap", "defaultBps"];
|
|
93
|
+
return (tx) => tx.moveCall({
|
|
94
|
+
package: packageAddress,
|
|
95
|
+
module: 'pyth_rule',
|
|
96
|
+
function: 'set_default_max_confidence_bps',
|
|
97
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/** Sets a per-symbol confidence gate (bps of price), overriding the default. */
|
|
101
|
+
export function setSymbolMaxConfidenceBps(options) {
|
|
102
|
+
const packageAddress = options.package ?? '@waterx/pyth-rule';
|
|
103
|
+
const argumentsTypes = [
|
|
104
|
+
null,
|
|
105
|
+
null,
|
|
106
|
+
'0x1::string::String',
|
|
107
|
+
'u64'
|
|
108
|
+
];
|
|
109
|
+
const parameterNames = ["config", "Cap", "symbol", "bps"];
|
|
110
|
+
return (tx) => tx.moveCall({
|
|
111
|
+
package: packageAddress,
|
|
112
|
+
module: 'pyth_rule',
|
|
113
|
+
function: 'set_symbol_max_confidence_bps',
|
|
114
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Removes a per-symbol confidence override (no-op if absent); the symbol then
|
|
119
|
+
* falls back to the default.
|
|
120
|
+
*/
|
|
121
|
+
export function unsetSymbolMaxConfidenceBps(options) {
|
|
122
|
+
const packageAddress = options.package ?? '@waterx/pyth-rule';
|
|
123
|
+
const argumentsTypes = [
|
|
124
|
+
null,
|
|
125
|
+
null,
|
|
126
|
+
'0x1::string::String'
|
|
127
|
+
];
|
|
128
|
+
const parameterNames = ["config", "Cap", "symbol"];
|
|
129
|
+
return (tx) => tx.moveCall({
|
|
130
|
+
package: packageAddress,
|
|
131
|
+
module: 'pyth_rule',
|
|
132
|
+
function: 'unset_symbol_max_confidence_bps',
|
|
133
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The effective confidence gate (bps of price) `feed` applies for `symbol`:
|
|
138
|
+
* per-symbol override → default → `DEFAULT_MAX_CONFIDENCE_BPS`.
|
|
139
|
+
*/
|
|
140
|
+
export function maxConfidenceBps(options) {
|
|
141
|
+
const packageAddress = options.package ?? '@waterx/pyth-rule';
|
|
142
|
+
const argumentsTypes = [
|
|
143
|
+
null,
|
|
144
|
+
'0x1::string::String'
|
|
145
|
+
];
|
|
146
|
+
const parameterNames = ["config", "symbol"];
|
|
147
|
+
return (tx) => tx.moveCall({
|
|
148
|
+
package: packageAddress,
|
|
149
|
+
module: 'pyth_rule',
|
|
150
|
+
function: 'max_confidence_bps',
|
|
151
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The configured default confidence gate, or `DEFAULT_MAX_CONFIDENCE_BPS` if
|
|
156
|
+
* unset.
|
|
157
|
+
*/
|
|
158
|
+
export function defaultMaxConfidenceBps(options) {
|
|
159
|
+
const packageAddress = options.package ?? '@waterx/pyth-rule';
|
|
160
|
+
const argumentsTypes = [
|
|
161
|
+
null
|
|
162
|
+
];
|
|
163
|
+
const parameterNames = ["config"];
|
|
164
|
+
return (tx) => tx.moveCall({
|
|
165
|
+
package: packageAddress,
|
|
166
|
+
module: 'pyth_rule',
|
|
167
|
+
function: 'default_max_confidence_bps',
|
|
168
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* The canonical kill switch is `oracle::set_rule_weight<SupraRule>(.., 0)`.
|
|
16
16
|
*/
|
|
17
17
|
import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
|
|
18
|
-
import { type Transaction } from '@mysten/sui/transactions';
|
|
18
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
19
19
|
export declare const SupraRule: MoveStruct<{
|
|
20
20
|
dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
|
|
21
21
|
}, "@waterx/supra-rule::supra_rule::SupraRule">;
|
|
@@ -56,16 +56,16 @@ export declare const SupraToleranceSet: MoveStruct<{
|
|
|
56
56
|
tolerance_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
57
57
|
}, "@waterx/supra-rule::supra_rule::SupraToleranceSet">;
|
|
58
58
|
export interface FeedArguments {
|
|
59
|
-
collector:
|
|
59
|
+
collector: TransactionArgument;
|
|
60
60
|
config: RawTransactionArgument<string>;
|
|
61
|
-
oracleHolder:
|
|
61
|
+
oracleHolder: TransactionArgument;
|
|
62
62
|
}
|
|
63
63
|
export interface FeedOptions {
|
|
64
64
|
package?: string;
|
|
65
65
|
arguments: FeedArguments | [
|
|
66
|
-
collector:
|
|
66
|
+
collector: TransactionArgument,
|
|
67
67
|
config: RawTransactionArgument<string>,
|
|
68
|
-
oracleHolder:
|
|
68
|
+
oracleHolder: TransactionArgument
|
|
69
69
|
];
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
18
18
|
import { bcs } from '@mysten/sui/bcs';
|
|
19
19
|
import * as vec_map from "./deps/sui/vec_map.js";
|
|
20
|
-
import * as vec_map_1 from "./deps/sui/vec_map.js";
|
|
21
20
|
const $moduleName = '@waterx/supra-rule::supra_rule';
|
|
22
21
|
export const SupraRule = new MoveStruct({ name: `${$moduleName}::SupraRule`, fields: {
|
|
23
22
|
dummy_field: bcs.bool()
|
|
@@ -27,7 +26,7 @@ export const Config = new MoveStruct({ name: `${$moduleName}::Config`, fields: {
|
|
|
27
26
|
/** Oracle symbol (e.g. `b"BTC_USD".to_string()`) → Supra pair ID (`u32`). */
|
|
28
27
|
pair_id_map: vec_map.VecMap(bcs.string(), bcs.u32()),
|
|
29
28
|
/** Per-symbol freshness tolerance in ms. Falls back to `DEFAULT_TOLERANCE_MS`. */
|
|
30
|
-
tolerance_ms_map:
|
|
29
|
+
tolerance_ms_map: vec_map.VecMap(bcs.string(), bcs.u64())
|
|
31
30
|
} });
|
|
32
31
|
export const SupraPairIdSet = new MoveStruct({ name: `${$moduleName}::SupraPairIdSet`, fields: {
|
|
33
32
|
symbol: bcs.string(),
|