@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
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
**************************************************************/
|
|
4
4
|
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
5
5
|
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
import * as table from "./deps/sui/table.js";
|
|
6
7
|
import * as emitter from "./deps/wormhole_sdk/emitter.js";
|
|
7
8
|
import * as vec_map from "./deps/sui/vec_map.js";
|
|
8
|
-
import * as vec_map_1 from "./deps/sui/vec_map.js";
|
|
9
9
|
import * as consumed_vaas from "./deps/wormhole_sdk/consumed_vaas.js";
|
|
10
10
|
import * as vec_set from "./deps/sui/vec_set.js";
|
|
11
|
-
import * as vec_set_1 from "./deps/sui/vec_set.js";
|
|
12
11
|
const $moduleName = '@waterx/wormhole-bridge::wormhole_bridge';
|
|
13
12
|
export const WormholeBridge = new MoveStruct({ name: `${$moduleName}::WormholeBridge`, fields: {
|
|
14
13
|
dummy_field: bcs.bool()
|
|
@@ -17,21 +16,46 @@ export const ChainTokenKey = new MoveStruct({ name: `${$moduleName}::ChainTokenK
|
|
|
17
16
|
chain_id: bcs.u16(),
|
|
18
17
|
token: bcs.vector(bcs.u8())
|
|
19
18
|
} });
|
|
19
|
+
export const BurnWindow = new MoveStruct({ name: `${$moduleName}::BurnWindow`, fields: {
|
|
20
|
+
burned: bcs.u64(),
|
|
21
|
+
window_start_ms: bcs.u64()
|
|
22
|
+
} });
|
|
23
|
+
export const PersonalBurnCap = new MoveStruct({ name: `${$moduleName}::PersonalBurnCap`, fields: {
|
|
24
|
+
cap_amount: bcs.u64(),
|
|
25
|
+
window_ms: bcs.u64(),
|
|
26
|
+
user_burns: table.Table
|
|
27
|
+
} });
|
|
20
28
|
export const Bridge = new MoveStruct({ name: `${$moduleName}::Bridge`, fields: {
|
|
21
29
|
id: bcs.Address,
|
|
22
30
|
emitter_cap: emitter.EmitterCap,
|
|
23
31
|
trusted_emitters: vec_map.VecMap(bcs.u16(), bcs.vector(bcs.u8())),
|
|
24
|
-
minted_per_token:
|
|
32
|
+
minted_per_token: vec_map.VecMap(ChainTokenKey, bcs.u64()),
|
|
25
33
|
consumed_vaas: consumed_vaas.ConsumedVAAs,
|
|
26
34
|
keepers: vec_set.VecSet(bcs.Address),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
daily_mint_limit: bcs.u64(),
|
|
36
|
+
/**
|
|
37
|
+
* True sliding-window mint accounting: a ring of `RL_BUCKETS` one-hour buckets. On
|
|
38
|
+
* each mint, buckets that rotated out of the trailing window are zeroed, then the
|
|
39
|
+
* sum of the remaining buckets plus `amount` is checked against
|
|
40
|
+
* `daily_mint_limit`. Because the ring always covers at least a full rolling day,
|
|
41
|
+
* no rolling 24-hour interval can exceed the limit. `mint_last_bucket` is the
|
|
42
|
+
* absolute index (now/RL_BUCKET_MS) of the most recent mint.
|
|
43
|
+
*/
|
|
44
|
+
mint_buckets: bcs.vector(bcs.u64()),
|
|
45
|
+
mint_last_bucket: bcs.u64(),
|
|
30
46
|
max_mint_per_tx: bcs.u64(),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
47
|
+
daily_burn_limit: bcs.u64(),
|
|
48
|
+
/** True sliding-window burn accounting — see `mint_buckets`. */
|
|
49
|
+
burn_buckets: bcs.vector(bcs.u64()),
|
|
50
|
+
burn_last_bucket: bcs.u64(),
|
|
34
51
|
max_burn_per_tx: bcs.u64(),
|
|
52
|
+
/**
|
|
53
|
+
* Bridge-local per-account daily burn cap on `burn_for_withdrawal_authorized`.
|
|
54
|
+
* Enforced _in addition to_ the CreditRegistry-side `personal_burn_cap` (which
|
|
55
|
+
* covers all burn-authorizing modules), so the bridge can apply a stricter
|
|
56
|
+
* per-account ceiling specifically for EVM-route exits.
|
|
57
|
+
*/
|
|
58
|
+
personal_burn_cap: PersonalBurnCap,
|
|
35
59
|
paused: bcs.bool(),
|
|
36
60
|
burn_nonce: bcs.u64(),
|
|
37
61
|
/**
|
|
@@ -42,7 +66,7 @@ export const Bridge = new MoveStruct({ name: `${$moduleName}::Bridge`, fields: {
|
|
|
42
66
|
* remove_supported_evm_token / set_rate_limits / set_paused / emergency_pause /
|
|
43
67
|
* add_keeper / remove_keeper paths.
|
|
44
68
|
*/
|
|
45
|
-
allowed_versions:
|
|
69
|
+
allowed_versions: vec_set.VecSet(bcs.u16())
|
|
46
70
|
} });
|
|
47
71
|
export function packageVersion(options = {}) {
|
|
48
72
|
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
@@ -61,9 +85,11 @@ export function initBridge(options) {
|
|
|
61
85
|
'u64',
|
|
62
86
|
'u64',
|
|
63
87
|
'u64',
|
|
88
|
+
'u64',
|
|
89
|
+
'u64',
|
|
64
90
|
'0x2::clock::Clock'
|
|
65
91
|
];
|
|
66
|
-
const parameterNames = ["_", "wormholeState", "
|
|
92
|
+
const parameterNames = ["_", "wormholeState", "dailyMintLimit", "maxMintPerTx", "dailyBurnLimit", "maxBurnPerTx", "personalBurnCapAmount", "personalBurnCapWindowMs"];
|
|
67
93
|
return (tx) => tx.moveCall({
|
|
68
94
|
package: packageAddress,
|
|
69
95
|
module: 'wormhole_bridge',
|
|
@@ -98,18 +124,25 @@ export function redeemVaa(options) {
|
|
|
98
124
|
});
|
|
99
125
|
}
|
|
100
126
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
127
|
+
* Account-authorized cross-chain burn. Only callable by a
|
|
128
|
+
* `CreditRegistry`-registered module witness `M` (production: `WithdrawQueue`, via
|
|
129
|
+
* `withdrawal_queue::execute_wormhole`), which vouches that `account_id` is the
|
|
130
|
+
* genuine originating wxa Account. `account_id` is the `burner` identity baked
|
|
131
|
+
* into `compute_withdrawal_id`, the `WithdrawalInitiated.burner` event field, and
|
|
132
|
+
* the credit registry's personal-burn-cap key — so the EVM-side withdrawal id and
|
|
133
|
+
* Sui-side cap accounting both bind to the source account, not whoever executes
|
|
134
|
+
* the queue entry (audit findings #3 / L03 / M14).
|
|
135
|
+
*
|
|
136
|
+
* There is intentionally no unauthenticated public burn: a raw `Coin<CREDIT>`
|
|
137
|
+
* holder cannot burn against a spoofed `account_id`.
|
|
107
138
|
*/
|
|
108
|
-
export function
|
|
139
|
+
export function burnForWithdrawalAuthorized(options) {
|
|
109
140
|
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
110
141
|
const argumentsTypes = [
|
|
111
142
|
null,
|
|
112
143
|
null,
|
|
144
|
+
`${options.typeArguments[1]}`,
|
|
145
|
+
'u16',
|
|
113
146
|
'0x2::object::ID',
|
|
114
147
|
null,
|
|
115
148
|
null,
|
|
@@ -119,11 +152,11 @@ export function burnForWithdrawal(options) {
|
|
|
119
152
|
'vector<u8>',
|
|
120
153
|
'0x2::clock::Clock'
|
|
121
154
|
];
|
|
122
|
-
const parameterNames = ["bridge", "registry", "accountId", "wormholeState", "coin", "wormholeFee", "evmDestinationChain", "evmRecipient", "evmToken"];
|
|
155
|
+
const parameterNames = ["bridge", "registry", "Witness", "version", "accountId", "wormholeState", "coin", "wormholeFee", "evmDestinationChain", "evmRecipient", "evmToken"];
|
|
123
156
|
return (tx) => tx.moveCall({
|
|
124
157
|
package: packageAddress,
|
|
125
158
|
module: 'wormhole_bridge',
|
|
126
|
-
function: '
|
|
159
|
+
function: 'burn_for_withdrawal_authorized',
|
|
127
160
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
128
161
|
typeArguments: options.typeArguments
|
|
129
162
|
});
|
|
@@ -207,7 +240,7 @@ export function setRateLimits(options) {
|
|
|
207
240
|
'u64',
|
|
208
241
|
'u64'
|
|
209
242
|
];
|
|
210
|
-
const parameterNames = ["_", "bridge", "
|
|
243
|
+
const parameterNames = ["_", "bridge", "newDailyMint", "newMaxMintPerTx", "newDailyBurn", "newMaxBurnPerTx"];
|
|
211
244
|
return (tx) => tx.moveCall({
|
|
212
245
|
package: packageAddress,
|
|
213
246
|
module: 'wormhole_bridge',
|
|
@@ -215,6 +248,49 @@ export function setRateLimits(options) {
|
|
|
215
248
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
216
249
|
});
|
|
217
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Admin: configure the bridge-local per-account daily burn cap. `cap_amount = 0`
|
|
253
|
+
* disables (default). `window_ms` must be > 0 even when disabled — `window_ms = 0`
|
|
254
|
+
* would reset the accumulator on every burn and silently degrade the cap to a
|
|
255
|
+
* per-tx ceiling. Mirrors `credit_registry::set_personal_burn_cap` but acts on
|
|
256
|
+
* this bridge only.
|
|
257
|
+
*/
|
|
258
|
+
export function setPersonalBurnCap(options) {
|
|
259
|
+
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
260
|
+
const argumentsTypes = [
|
|
261
|
+
null,
|
|
262
|
+
null,
|
|
263
|
+
'u64',
|
|
264
|
+
'u64'
|
|
265
|
+
];
|
|
266
|
+
const parameterNames = ["bridge", "_", "capAmount", "windowMs"];
|
|
267
|
+
return (tx) => tx.moveCall({
|
|
268
|
+
package: packageAddress,
|
|
269
|
+
module: 'wormhole_bridge',
|
|
270
|
+
function: 'set_personal_burn_cap',
|
|
271
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Admin: wipe a single user's bridge-local burn-window accumulator. Use to clear a
|
|
276
|
+
* stale entry after a long inactivity period or to forgive the in-window balance
|
|
277
|
+
* manually. Idempotent on absent users.
|
|
278
|
+
*/
|
|
279
|
+
export function resetPersonalBurnWindow(options) {
|
|
280
|
+
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
281
|
+
const argumentsTypes = [
|
|
282
|
+
null,
|
|
283
|
+
null,
|
|
284
|
+
'address'
|
|
285
|
+
];
|
|
286
|
+
const parameterNames = ["bridge", "_", "user"];
|
|
287
|
+
return (tx) => tx.moveCall({
|
|
288
|
+
package: packageAddress,
|
|
289
|
+
module: 'wormhole_bridge',
|
|
290
|
+
function: 'reset_personal_burn_window',
|
|
291
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
292
|
+
});
|
|
293
|
+
}
|
|
218
294
|
export function setPaused(options) {
|
|
219
295
|
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
220
296
|
const argumentsTypes = [
|
|
@@ -329,7 +405,7 @@ export function paused(options) {
|
|
|
329
405
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
330
406
|
});
|
|
331
407
|
}
|
|
332
|
-
export function
|
|
408
|
+
export function dailyMintLimit(options) {
|
|
333
409
|
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
334
410
|
const argumentsTypes = [
|
|
335
411
|
null
|
|
@@ -338,11 +414,16 @@ export function hourlyMintLimit(options) {
|
|
|
338
414
|
return (tx) => tx.moveCall({
|
|
339
415
|
package: packageAddress,
|
|
340
416
|
module: 'wormhole_bridge',
|
|
341
|
-
function: '
|
|
417
|
+
function: 'daily_mint_limit',
|
|
342
418
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
343
419
|
});
|
|
344
420
|
}
|
|
345
|
-
|
|
421
|
+
/**
|
|
422
|
+
* Tracked mint usage in the current sliding window (sum of all buckets). Stale
|
|
423
|
+
* buckets are evicted lazily on the next mint, so this can include
|
|
424
|
+
* not-yet-rotated-out buckets until the next `check_rate_limit`.
|
|
425
|
+
*/
|
|
426
|
+
export function dailyMinted(options) {
|
|
346
427
|
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
347
428
|
const argumentsTypes = [
|
|
348
429
|
null
|
|
@@ -351,7 +432,7 @@ export function hourlyMinted(options) {
|
|
|
351
432
|
return (tx) => tx.moveCall({
|
|
352
433
|
package: packageAddress,
|
|
353
434
|
module: 'wormhole_bridge',
|
|
354
|
-
function: '
|
|
435
|
+
function: 'daily_minted',
|
|
355
436
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
356
437
|
});
|
|
357
438
|
}
|
|
@@ -368,7 +449,7 @@ export function maxMintPerTx(options) {
|
|
|
368
449
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
369
450
|
});
|
|
370
451
|
}
|
|
371
|
-
export function
|
|
452
|
+
export function dailyBurnLimit(options) {
|
|
372
453
|
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
373
454
|
const argumentsTypes = [
|
|
374
455
|
null
|
|
@@ -377,11 +458,12 @@ export function hourlyBurnLimit(options) {
|
|
|
377
458
|
return (tx) => tx.moveCall({
|
|
378
459
|
package: packageAddress,
|
|
379
460
|
module: 'wormhole_bridge',
|
|
380
|
-
function: '
|
|
461
|
+
function: 'daily_burn_limit',
|
|
381
462
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
382
463
|
});
|
|
383
464
|
}
|
|
384
|
-
|
|
465
|
+
/** Tracked burn usage in the current sliding window — see `daily_minted`. */
|
|
466
|
+
export function dailyBurned(options) {
|
|
385
467
|
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
386
468
|
const argumentsTypes = [
|
|
387
469
|
null
|
|
@@ -390,7 +472,7 @@ export function hourlyBurned(options) {
|
|
|
390
472
|
return (tx) => tx.moveCall({
|
|
391
473
|
package: packageAddress,
|
|
392
474
|
module: 'wormhole_bridge',
|
|
393
|
-
function: '
|
|
475
|
+
function: 'daily_burned',
|
|
394
476
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
395
477
|
});
|
|
396
478
|
}
|
|
@@ -407,6 +489,53 @@ export function maxBurnPerTx(options) {
|
|
|
407
489
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
408
490
|
});
|
|
409
491
|
}
|
|
492
|
+
export function personalBurnCapAmount(options) {
|
|
493
|
+
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
494
|
+
const argumentsTypes = [
|
|
495
|
+
null
|
|
496
|
+
];
|
|
497
|
+
const parameterNames = ["bridge"];
|
|
498
|
+
return (tx) => tx.moveCall({
|
|
499
|
+
package: packageAddress,
|
|
500
|
+
module: 'wormhole_bridge',
|
|
501
|
+
function: 'personal_burn_cap_amount',
|
|
502
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
export function personalBurnCapWindowMs(options) {
|
|
506
|
+
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
507
|
+
const argumentsTypes = [
|
|
508
|
+
null
|
|
509
|
+
];
|
|
510
|
+
const parameterNames = ["bridge"];
|
|
511
|
+
return (tx) => tx.moveCall({
|
|
512
|
+
package: packageAddress,
|
|
513
|
+
module: 'wormhole_bridge',
|
|
514
|
+
function: 'personal_burn_cap_window_ms',
|
|
515
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Burn already counted in the user's current window. Returns 0 for unknown users,
|
|
520
|
+
* for users whose window has not been touched yet, AND for users whose stored
|
|
521
|
+
* window has expired (lazily — the on-burn path resets it; this view computes the
|
|
522
|
+
* same answer without mutating).
|
|
523
|
+
*/
|
|
524
|
+
export function personalBurned(options) {
|
|
525
|
+
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
526
|
+
const argumentsTypes = [
|
|
527
|
+
null,
|
|
528
|
+
'address',
|
|
529
|
+
'0x2::clock::Clock'
|
|
530
|
+
];
|
|
531
|
+
const parameterNames = ["bridge", "user"];
|
|
532
|
+
return (tx) => tx.moveCall({
|
|
533
|
+
package: packageAddress,
|
|
534
|
+
module: 'wormhole_bridge',
|
|
535
|
+
function: 'personal_burned',
|
|
536
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
537
|
+
});
|
|
538
|
+
}
|
|
410
539
|
export function burnNonce(options) {
|
|
411
540
|
const packageAddress = options.package ?? '@waterx/wormhole-bridge';
|
|
412
541
|
const argumentsTypes = [
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { WaterXClient } from "./client.ts";
|
|
2
2
|
export type { CreateClientOptions } from "./client.ts";
|
|
3
3
|
export { PYTH_DEFAULTS, WORMHOLE_DEFAULTS, clearConfigCache, defaultConfigUrl, loadConfig, } from "./config.ts";
|
|
4
|
-
export type { BasePackageEntry, WaterxReferralPackage, LoadConfigOptions, NativeCustodyAsset, NativeCustodyPackage, PythInfraConfig, PythRulePackage, PythSponsorRulePackage, TestnetFaucetPackage, TrustedEmitterRow, WaterXConfig, WaterXPackages, WaterxCreditPackage, WaterxOraclePackage, WaterxPerpMarketEntry, WaterxPerpPackage, WaterxStakingPackage, WithdrawalQueuePackage, WlpPackage, WormholeBridgePackage, WormholeInfraConfig, WxaAccountPackage, } from "./config.ts";
|
|
4
|
+
export type { BasePackageEntry, ConstantFeedEntry, WaterxReferralPackage, LoadConfigOptions, NativeCustodyAsset, NativeCustodyPackage, PythInfraConfig, PythRulePackage, PythSponsorRulePackage, SupraFeedEntry, SupraRulePackage, TestnetFaucetPackage, TrustedEmitterRow, WaterXConfig, WaterXPackages, WaterxCreditPackage, WaterxOraclePackage, WaterxPerpMarketEntry, WaterxPerpPackage, WaterxStakingPackage, WithdrawalQueuePackage, WlpPackage, WormholeBridgePackage, WormholeInfraConfig, WxaAccountPackage, } from "./config.ts";
|
|
5
5
|
export { ACTION_ADD_PRE_ORDER, ACTION_CANCEL_ORDER, ACTION_CANCEL_PRE_ORDER, ACTION_CLOSE_POSITION, ACTION_DECREASE_POSITION, ACTION_DEPOSIT_COLLATERAL, ACTION_INCREASE_POSITION, ACTION_LIQUIDATE, ACTION_OPEN_POSITION, ACTION_PLACE_ORDER, ACTION_UPDATE_ORDER, ACTION_WITHDRAW_COLLATERAL, BPS_SCALE, CRYPTO_FEE_RATE, DOUBLE_SCALE, DRY_RUN_SENDER, FLOAT_SCALE, MAINTENANCE_MARGIN_RATE, ORDER_LIMIT_BUY, ORDER_LIMIT_SELL, ORDER_STOP_BUY, ORDER_STOP_SELL, ORDER_TAG_WILDCARD, PERM_ALL, PERM_ALL_TRADING, PERM_CANCEL_ORDER, PERM_CLOSE_POSITION, PERM_DECREASE_POSITION, PERM_DEPOSIT_COLLATERAL, PERM_INCREASE_POSITION, PERM_MINT_WLP, PERM_OPEN_POSITION, PERM_PLACE_ORDER, PERM_REDEEM_WLP, PERM_WITHDRAW_COLLATERAL, STOCK_FEE_RATE, MS_PER_YEAR, SUI_DECIMALS, WLP_DECIMALS, COLLATERAL_DECIMALS, TOKEN_DECIMALS, } from "./constants.ts";
|
|
6
6
|
export type { Network } from "./constants.ts";
|
|
7
7
|
export { getMarketTickers, getCollateralAssets } from "./utils/config.ts";
|
|
8
|
-
export { annualizedApyFromRatio, annualizeFundingRate, calcBorrowRate, calcBorrowRateAccrual, calcDynamicFeeBps, calcEstLiqPrice, calcFee, calcFundingFeeUsd, calcFundingRate, calcImpactFeeRate, calcLeverage, calcNotional, calcPositionBorrowFee, calcTokenUtilizationBps, calcTotalTradingFeeRate, calcUnrealizedPnl, calcWlpIncentiveApy, calcWlpMintOut, calcWlpPrice, calcWlpRedeemOut, decodeFundingIndexDelta, rawPrice, } from "./utils/math.ts";
|
|
8
|
+
export { annualizedApyFromRatio, annualizeFundingRate, calcBorrowRate, calcBorrowRateAccrual, calcDynamicFeeBps, calcEffectiveCollateralUsd, calcEstLiqPrice, calcFee, calcFundingFeeUsd, calcFundingRate, calcImpactFeeRate, calcLeverage, calcMaxReducibleCollateralUsd, calcNotional, calcPositionBorrowFee, calcTokenUtilizationBps, calcTotalTradingFeeRate, calcUnrealizedPnl, calcWlpIncentiveApy, calcWlpMintOut, calcWlpPrice, calcWlpRedeemOut, decodeFundingIndexDelta, rawPrice, } from "./utils/math.ts";
|
|
9
9
|
export * from "./user/index.ts";
|
|
10
10
|
export * from "./tx-builders.ts";
|
|
11
11
|
export * from "./fetch.ts";
|
|
12
|
-
export { PythCache, aggregateTickerWithPyth, buildPythPriceUpdateCalls, fetchPriceFeedsUpdateData, refreshOraclePrices, updatePythPrices, } from "./utils/pyth.ts";
|
|
12
|
+
export { PythCache, aggregateTicker, aggregateTickerWithConstant, aggregateTickerWithPyth, buildPythPriceUpdateCalls, fetchPriceFeedsUpdateData, refreshOraclePrices, updatePythPrices, } from "./utils/pyth.ts";
|
|
13
13
|
export { fetchDepositVaa, fetchVaa, listBridgeWithdrawalVaas, listVaasByEmitter, padEvmEmitter, toWormholescanEmitter, vaaBase64ToBytes, vaaBase64ToHex, vaaBytesToBase64, waitForVaa, } from "./utils/wormhole.ts";
|
|
14
14
|
export type { VaaListItem, VaaResponse, WormholescanOptions } from "./utils/wormhole.ts";
|
|
15
15
|
export { AccountData as AccountDataBcs, GlobalConfigData as GlobalConfigDataBcs, MarketData as MarketDataBcs, OrderData as OrderDataBcs, PoolData as PoolDataBcs, PositionData as PositionDataBcs, RedeemRequestData as RedeemRequestDataBcs, TokenPoolData as TokenPoolDataBcs, } from "./generated/waterx_perp_view/view.ts";
|
|
@@ -26,3 +26,4 @@ export * as pythRuleCalls from "./generated/waterx_pyth_rule/pyth_rule.ts";
|
|
|
26
26
|
export * as pythSponsorRuleCalls from "./generated/pyth_sponsor_rule/pyth_sponsor_rule.ts";
|
|
27
27
|
export * as referralCalls from "./generated/waterx_referral/referral_table.ts";
|
|
28
28
|
export * as nativeCustodyCalls from "./generated/native_custody/custody_vault.ts";
|
|
29
|
+
export * as withdrawalQueueCalls from "./generated/withdrawal_queue/withdrawal_queue.ts";
|
package/dist/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { PYTH_DEFAULTS, WORMHOLE_DEFAULTS, clearConfigCache, defaultConfigUrl, l
|
|
|
5
5
|
export { ACTION_ADD_PRE_ORDER, ACTION_CANCEL_ORDER, ACTION_CANCEL_PRE_ORDER, ACTION_CLOSE_POSITION, ACTION_DECREASE_POSITION, ACTION_DEPOSIT_COLLATERAL, ACTION_INCREASE_POSITION, ACTION_LIQUIDATE, ACTION_OPEN_POSITION, ACTION_PLACE_ORDER, ACTION_UPDATE_ORDER, ACTION_WITHDRAW_COLLATERAL, BPS_SCALE, CRYPTO_FEE_RATE, DOUBLE_SCALE, DRY_RUN_SENDER, FLOAT_SCALE, MAINTENANCE_MARGIN_RATE, ORDER_LIMIT_BUY, ORDER_LIMIT_SELL, ORDER_STOP_BUY, ORDER_STOP_SELL, ORDER_TAG_WILDCARD, PERM_ALL, PERM_ALL_TRADING, PERM_CANCEL_ORDER, PERM_CLOSE_POSITION, PERM_DECREASE_POSITION, PERM_DEPOSIT_COLLATERAL, PERM_INCREASE_POSITION, PERM_MINT_WLP, PERM_OPEN_POSITION, PERM_PLACE_ORDER, PERM_REDEEM_WLP, PERM_WITHDRAW_COLLATERAL, STOCK_FEE_RATE, MS_PER_YEAR, SUI_DECIMALS, WLP_DECIMALS, COLLATERAL_DECIMALS, TOKEN_DECIMALS, } from "./constants.js";
|
|
6
6
|
// ======== Utilities ========
|
|
7
7
|
export { getMarketTickers, getCollateralAssets } from "./utils/config.js";
|
|
8
|
-
export { annualizedApyFromRatio, annualizeFundingRate, calcBorrowRate, calcBorrowRateAccrual, calcDynamicFeeBps, calcEstLiqPrice, calcFee, calcFundingFeeUsd, calcFundingRate, calcImpactFeeRate, calcLeverage, calcNotional, calcPositionBorrowFee, calcTokenUtilizationBps, calcTotalTradingFeeRate, calcUnrealizedPnl, calcWlpIncentiveApy, calcWlpMintOut, calcWlpPrice, calcWlpRedeemOut, decodeFundingIndexDelta, rawPrice, } from "./utils/math.js";
|
|
8
|
+
export { annualizedApyFromRatio, annualizeFundingRate, calcBorrowRate, calcBorrowRateAccrual, calcDynamicFeeBps, calcEffectiveCollateralUsd, calcEstLiqPrice, calcFee, calcFundingFeeUsd, calcFundingRate, calcImpactFeeRate, calcLeverage, calcMaxReducibleCollateralUsd, calcNotional, calcPositionBorrowFee, calcTokenUtilizationBps, calcTotalTradingFeeRate, calcUnrealizedPnl, calcWlpIncentiveApy, calcWlpMintOut, calcWlpPrice, calcWlpRedeemOut, decodeFundingIndexDelta, rawPrice, } from "./utils/math.js";
|
|
9
9
|
// ======== Transaction builders (user-side) ========
|
|
10
10
|
export * from "./user/index.js";
|
|
11
11
|
// ======== High-level Tx builders ========
|
|
@@ -13,7 +13,7 @@ export * from "./tx-builders.js";
|
|
|
13
13
|
// ======== Read-only queries ========
|
|
14
14
|
export * from "./fetch.js";
|
|
15
15
|
// ======== Pyth oracle utilities ========
|
|
16
|
-
export { PythCache, aggregateTickerWithPyth, buildPythPriceUpdateCalls, fetchPriceFeedsUpdateData, refreshOraclePrices, updatePythPrices, } from "./utils/pyth.js";
|
|
16
|
+
export { PythCache, aggregateTicker, aggregateTickerWithConstant, aggregateTickerWithPyth, buildPythPriceUpdateCalls, fetchPriceFeedsUpdateData, refreshOraclePrices, updatePythPrices, } from "./utils/pyth.js";
|
|
17
17
|
// ======== Wormhole / Wormholescan utilities (credit bridge) ========
|
|
18
18
|
export { fetchDepositVaa, fetchVaa, listBridgeWithdrawalVaas, listVaasByEmitter, padEvmEmitter, toWormholescanEmitter, vaaBase64ToBytes, vaaBase64ToHex, vaaBytesToBase64, waitForVaa, } from "./utils/wormhole.js";
|
|
19
19
|
// ======== Generated BCS types (sui-ts-codegen) ========
|
|
@@ -32,3 +32,4 @@ export * as pythRuleCalls from "./generated/waterx_pyth_rule/pyth_rule.js";
|
|
|
32
32
|
export * as pythSponsorRuleCalls from "./generated/pyth_sponsor_rule/pyth_sponsor_rule.js";
|
|
33
33
|
export * as referralCalls from "./generated/waterx_referral/referral_table.js";
|
|
34
34
|
export * as nativeCustodyCalls from "./generated/native_custody/custody_vault.js";
|
|
35
|
+
export * as withdrawalQueueCalls from "./generated/withdrawal_queue/withdrawal_queue.js";
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Transaction, type TransactionArgument } from "@mysten/sui/transactions";
|
|
2
|
+
import type { PredictClient } from "./client.ts";
|
|
3
|
+
import type { AccountIdentityParams, CoinRef, IdArgument, ObjectArgument } from "./types.ts";
|
|
4
|
+
export interface AccountBaseParams {
|
|
5
|
+
accountPackageId?: string;
|
|
6
|
+
accountRegistry?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CreateAccountParams extends AccountBaseParams, AccountIdentityParams {
|
|
9
|
+
alias: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolves the registry `0x2::object::ID` used by `request_deposit` / views from an on-chain
|
|
13
|
+
* `Account` object id (e.g. parsed from transaction effects).
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveRegistryAccountId(client: PredictClient, accountObjectId: string, params?: AccountBaseParams): Promise<string>;
|
|
16
|
+
export declare function createAccount(client: PredictClient, tx: Transaction, params: CreateAccountParams): TransactionArgument;
|
|
17
|
+
export interface TransferCoinToAccountParams extends AccountBaseParams {
|
|
18
|
+
accountId: IdArgument;
|
|
19
|
+
coin: ObjectArgument;
|
|
20
|
+
coinType?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function transferCoinToAccount(client: PredictClient, tx: Transaction, params: TransferCoinToAccountParams): Transaction;
|
|
23
|
+
export interface RequestDepositParams extends AccountBaseParams {
|
|
24
|
+
accountId: IdArgument;
|
|
25
|
+
coin: ObjectArgument;
|
|
26
|
+
coinType?: string;
|
|
27
|
+
extraData?: Uint8Array | number[];
|
|
28
|
+
}
|
|
29
|
+
export declare function requestDeposit(client: PredictClient, tx: Transaction, params: RequestDepositParams): TransactionArgument;
|
|
30
|
+
export interface ConsumeDepositDirectParams extends AccountBaseParams {
|
|
31
|
+
depositRequest: TransactionArgument;
|
|
32
|
+
coinType?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Finishes a `request_deposit` hot potato via `direct_rule` (same-coin credit). */
|
|
35
|
+
export declare function consumeDepositDirect(client: PredictClient, tx: Transaction, params: ConsumeDepositDirectParams): Transaction;
|
|
36
|
+
/**
|
|
37
|
+
* Full deposit: `request_deposit` + `consume_deposit_direct` in one PTB.
|
|
38
|
+
* Use this for testnet USD unless you implement a custom deposit policy consume path.
|
|
39
|
+
*/
|
|
40
|
+
export declare function deposit(client: PredictClient, tx: Transaction, params: RequestDepositParams): Transaction;
|
|
41
|
+
export interface RequestDepositFromReceivingsParams extends AccountBaseParams {
|
|
42
|
+
accountId: IdArgument;
|
|
43
|
+
coins: CoinRef[];
|
|
44
|
+
coinType?: string;
|
|
45
|
+
extraData?: Uint8Array | number[];
|
|
46
|
+
}
|
|
47
|
+
export declare function requestDepositFromReceivings(client: PredictClient, tx: Transaction, params: RequestDepositFromReceivingsParams): TransactionArgument;
|
|
48
|
+
export interface RequestWithdrawParams extends AccountBaseParams, AccountIdentityParams {
|
|
49
|
+
accountId: IdArgument;
|
|
50
|
+
amount: bigint | number | string;
|
|
51
|
+
recipient: string;
|
|
52
|
+
coinType?: string;
|
|
53
|
+
extraData?: Uint8Array | number[];
|
|
54
|
+
}
|
|
55
|
+
export declare function requestWithdraw(client: PredictClient, tx: Transaction, params: RequestWithdrawParams): TransactionArgument;
|
|
56
|
+
export interface ConsumeWithdrawDirectParams extends AccountBaseParams {
|
|
57
|
+
withdrawRequest: TransactionArgument;
|
|
58
|
+
coinType?: string;
|
|
59
|
+
}
|
|
60
|
+
/** Finishes a `request_withdraw` hot potato via `direct_rule` (same-coin payout). */
|
|
61
|
+
export declare function consumeWithdrawDirect(client: PredictClient, tx: Transaction, params: ConsumeWithdrawDirectParams): Transaction;
|
|
62
|
+
/**
|
|
63
|
+
* Full withdraw: `request_withdraw` + `consume_withdraw_direct` in one PTB.
|
|
64
|
+
* Use this for testnet USD unless you implement a custom withdraw policy consume path.
|
|
65
|
+
*/
|
|
66
|
+
export declare function withdraw(client: PredictClient, tx: Transaction, params: RequestWithdrawParams): Transaction;
|
|
67
|
+
export interface AddDelegateParams extends AccountBaseParams, AccountIdentityParams {
|
|
68
|
+
accountId: IdArgument;
|
|
69
|
+
delegate: string;
|
|
70
|
+
alias: string;
|
|
71
|
+
permissions: number;
|
|
72
|
+
expiresAtMs?: bigint | number | string | null;
|
|
73
|
+
}
|
|
74
|
+
export declare function addDelegate(client: PredictClient, tx: Transaction, params: AddDelegateParams): Transaction;
|
|
75
|
+
export interface RemoveDelegateParams extends AccountBaseParams, AccountIdentityParams {
|
|
76
|
+
accountId: IdArgument;
|
|
77
|
+
delegate: string;
|
|
78
|
+
}
|
|
79
|
+
export declare function removeDelegate(client: PredictClient, tx: Transaction, params: RemoveDelegateParams): Transaction;
|
|
80
|
+
export interface SetDelegatePredictionPermissionParams extends AccountBaseParams, AccountIdentityParams {
|
|
81
|
+
accountId: IdArgument;
|
|
82
|
+
delegate: string;
|
|
83
|
+
permissions: number;
|
|
84
|
+
predictionPackageId?: string;
|
|
85
|
+
}
|
|
86
|
+
export declare function setDelegatePredictionPermission(client: PredictClient, tx: Transaction, params: SetDelegatePredictionPermissionParams): Transaction;
|
|
87
|
+
export interface WhitelistPredictionProtocolParams extends AccountBaseParams {
|
|
88
|
+
adminCap: ObjectArgument;
|
|
89
|
+
predictionPackageId?: string;
|
|
90
|
+
}
|
|
91
|
+
export declare function whitelistPredictionProtocol(client: PredictClient, tx: Transaction, params: WhitelistPredictionProtocolParams): Transaction;
|
|
92
|
+
export interface PredictionProtocolAssetParams extends WhitelistPredictionProtocolParams {
|
|
93
|
+
coinType?: string;
|
|
94
|
+
}
|
|
95
|
+
export declare function allowPredictionProtocolAsset(client: PredictClient, tx: Transaction, params: PredictionProtocolAssetParams): Transaction;
|
|
96
|
+
export declare function disallowPredictionProtocolAsset(client: PredictClient, tx: Transaction, params: PredictionProtocolAssetParams): Transaction;
|